2016/07/23

Dependents:   Cansat2016_v1 Cansat2016_v1

Cansat2016.h

Committer:
s1210160
Date:
2016-07-23
Revision:
0:b42b5cb8b646
Child:
1:dad5c9475937

File content as of revision 0:b42b5cb8b646:

#include "mbed.h"
#include "VNH5019.h"

#define M_PI 3.1415926535897932384626433832795
class Cansat2016
{

private:
    typedef struct {
        double x;           // latitude
        double y;           // longitude
        int direction;      // compass
    } BasicData;

    // robot data, target data
    BasicData robot, target;
    // distance of robot and target
    double sub_x, sub_y;
    double distance;
    // motor
    VNH5019 _motor;
    // speed of robot
    int speed;
    // action of robot
    char action;

public:
    // constructor
    Cansat2016(VNH5019 motor);

    void calc_distance(void);
    void robot_compass(DigitalIn *sensor);
    void target_compass();
    void robot_action(void);
    void motor_control(void);

    // set
    void set_robotGPS(double x, double y);
    void set_targetGPS(double x, double y);
    void set_action(char a);

    // get 
    double get_x(void);
    double get_y(void);
    int get_compass(char c);
    double get_distance(void);
    char get_action(void);
};