Carlo Collodi / kangaroo

Dependencies:   QEI mbed

include/dynamics.hpp

Committer:
Sparker
Date:
2013-11-24
Revision:
35:a4e89e78d034
Parent:
28:21773a6fb6df
Child:
37:bf257a0154db

File content as of revision 35:a4e89e78d034:

#include "mbed.h"

#ifndef DYNAMICS_HPP
#define DYNAMICS_HPP

#define l1 1 //gantry point to hip joint
#define l2 1 //hip length
#define l3 1 //leg length
#define l4 1 //foot length

class Kangaroo {

    public:
        Kangaroo();
        void zero();
        void start();
        void run();
        void stop();
        void updatePose() {
        
        // position of foot is (x,y)
        
        double theta1 = 2 * atan(sqrt( ( (l2+l3+l4)^2 - x^2 - y^2) / (x^2 + y^2 - (l2+l4-l3)^2) ));
        double theta2 = atan2(y,x) - atan2(l3*sin(theta1), l2 + l4 + l3*cost(theta1));
        }
};

#endif