odometry

Odometry.h

Committer:
zatakon
Date:
2015-08-11
Revision:
0:402f8c75d394
Child:
1:1765665581cc

File content as of revision 0:402f8c75d394:

#ifndef Odometry_H
#define Odometry_H

#include <vector>
#include "mbed.h"
#include "math.h"
#define M_PI           3.14159265358979323846  /* pi */


class Robot
{
  public:
    Robot(float wheelbase, float width, float countPerMeter);
    
    /* returns radius in [m]. When turning right, radius is negativ
     *    left is positive
     *
     * param servoAngle is how is the servo angle in radians. Center 
     *    is pi/2 (1.571)
    */ 
    float getRadius(float servoAngle);
    
    void countRadius(float servoAngle);
    
    float getServoAngle(float R);
    
    /* returns speed in format 
     *      [0] = linear x
     *      [1] = linear y
     *      [2] = angular z
     *
     * function needs actual R     
     */         
    std::vector<float> getSpeed(std::vector<int> encoders);
  
    std::vector<float> getMotorRatio();
    
    std::vector<float> getMotorRatio(float R);

  private:  
    float _whbs;      // wheelbase
    float _w;         // width
    float _R;
    uint32_t _countPerMeter;
    
    std::vector<float> _odom;
    std::vector<float> _ratio;
};

#endif