summaryrefslogtreecommitdiffstats
path: root/Navigation.h
blob: 561e342f4d0334b9e1f7ed8edbcbe1c4e420a1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _ROBOCUP_NAVIGATION_H_
#define _ROBOCUP_NAVIGATION_H_

#include "Motor.h"
#include "util.h"


class Navigation {
  private:
    Motor *motors[3];
    float motorPos[3];
    
    float speed;
    float direction;
    float spin;
    
    void update();
  public:
    Navigation(Motor *m1, float p1, Motor *m2, float p2, Motor *m3, float p3);
    
    void setSpeed(float speed) {this->speed = CLAMP(0.0, speed, 1.0); update();}
    float getSpeed() {return speed;}
    
    void setDirection(float direction) {this->direction = direction; update();}
    float getDirection() {return direction;}
    
    void setSpin(float spin) {this->spin = CLAMP(-1.0, spin, 1.0); update();}
    float getSpin() {return spin;}
};

#endif