2015/08/14
Dependencies: VNH5019
Fork of cansat by
cansat.h@6:601cac49d4b1, 2015-08-10 (annotated)
- Committer:
- s1200058
- Date:
- Mon Aug 10 18:22:25 2015 +0000
- Revision:
- 6:601cac49d4b1
- Parent:
- 5:534a54a44b22
add printf;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kityann | 0:3f50511c1c1f | 1 | #ifndef CANSAT_H |
kityann | 0:3f50511c1c1f | 2 | #define CANSAT_H |
kityann | 0:3f50511c1c1f | 3 | |
kityann | 0:3f50511c1c1f | 4 | /** |
kityann | 0:3f50511c1c1f | 5 | * Includes |
kityann | 0:3f50511c1c1f | 6 | */ |
kityann | 0:3f50511c1c1f | 7 | #include "mbed.h" |
kityann | 2:0f76226be922 | 8 | #include "VNH5019.h" |
kityann | 2:0f76226be922 | 9 | enum STATUS {GPS_AVAIL = 0, GPS_UNAVAIL = 1,GPS_OUT_AREA = 2}; |
kityann | 0:3f50511c1c1f | 10 | |
kityann | 2:0f76226be922 | 11 | const int distance_threshold[2]={0.1,0.5}; |
kityann | 1:6a034792e059 | 12 | |
kityann | 0:3f50511c1c1f | 13 | class CanSat{ |
kityann | 0:3f50511c1c1f | 14 | public: |
kityann | 2:0f76226be922 | 15 | STATUS nowStatus; |
kityann | 2:0f76226be922 | 16 | |
kityann | 2:0f76226be922 | 17 | char motor_command; |
kityann | 2:0f76226be922 | 18 | void control_Motor(int,int);//動き、スピード |
kityann | 2:0f76226be922 | 19 | |
kityann | 2:0f76226be922 | 20 | CanSat(VNH5019 agzSheild); |
kityann | 0:3f50511c1c1f | 21 | //ロボットとターゲットの方角からロボットの動きを決める |
kityann | 0:3f50511c1c1f | 22 | char get_moving_angle(int robot_angle,int target_angle); |
kityann | 0:3f50511c1c1f | 23 | //ロボットとターゲットの距離の計算 |
kityann | 0:3f50511c1c1f | 24 | double get_taget_distance(); |
kityann | 0:3f50511c1c1f | 25 | //ロボットとターゲットの距離から速度を決める |
kityann | 0:3f50511c1c1f | 26 | int get_roboto_velocity(); |
kityann | 0:3f50511c1c1f | 27 | //気圧の取得 |
kityann | 0:3f50511c1c1f | 28 | double get_pressure(); |
kityann | 0:3f50511c1c1f | 29 | //スタック判定:加速度データをもとに? |
kityann | 0:3f50511c1c1f | 30 | bool is_stack(); |
kityann | 0:3f50511c1c1f | 31 | //ログデータの送信 |
kityann | 0:3f50511c1c1f | 32 | void log_send(); |
kityann | 2:0f76226be922 | 33 | |
kityann | 2:0f76226be922 | 34 | //get関数 |
kityann | 2:0f76226be922 | 35 | double get_robot_x(); |
kityann | 2:0f76226be922 | 36 | double get_robot_y(); |
kityann | 2:0f76226be922 | 37 | double get_robotKalman_x(); |
kityann | 2:0f76226be922 | 38 | double get_robotKalman_y(); |
s1210160 | 5:534a54a44b22 | 39 | int16_t get_compass_x(); |
s1210160 | 5:534a54a44b22 | 40 | int16_t get_compass_y(); |
s1210160 | 5:534a54a44b22 | 41 | int16_t get_compass_z(); |
s1210160 | 5:534a54a44b22 | 42 | double get_compass_angle(); |
s1200058 | 4:8713fff9e20d | 43 | double get_target_distance(); |
s1200058 | 4:8713fff9e20d | 44 | double get_target_x(); |
s1200058 | 4:8713fff9e20d | 45 | double get_target_y(); |
s1200058 | 4:8713fff9e20d | 46 | |
s1200058 | 4:8713fff9e20d | 47 | int get_speed(); |
s1200058 | 4:8713fff9e20d | 48 | int get_robot_angle(); |
s1200058 | 4:8713fff9e20d | 49 | int get_target_angle(); |
s1200058 | 4:8713fff9e20d | 50 | |
s1200058 | 4:8713fff9e20d | 51 | double get_temperature(); |
s1200058 | 4:8713fff9e20d | 52 | double get_humidity(); |
kityann | 2:0f76226be922 | 53 | |
kityann | 2:0f76226be922 | 54 | //set関数 |
kityann | 2:0f76226be922 | 55 | void set_robot_x(double); |
kityann | 2:0f76226be922 | 56 | void set_robot_y(double); |
kityann | 2:0f76226be922 | 57 | void set_robotKalman_x(double); |
kityann | 2:0f76226be922 | 58 | void set_robotKalman_y(double); |
kityann | 0:3f50511c1c1f | 59 | |
kityann | 2:0f76226be922 | 60 | void set_gyro(double x, double y, double z); |
s1210160 | 5:534a54a44b22 | 61 | void set_compass(int16_t x, int16_t y, int16_t z, double angle); |
kityann | 2:0f76226be922 | 62 | void set_pressure(double p); |
kityann | 2:0f76226be922 | 63 | void set_temperature(double t); |
kityann | 2:0f76226be922 | 64 | void set_humidity(double h); |
kityann | 2:0f76226be922 | 65 | void set_acceleration(double x, double y, double z); |
s1200058 | 4:8713fff9e20d | 66 | |
s1200058 | 4:8713fff9e20d | 67 | void set_target_distance(double distance); |
s1200058 | 4:8713fff9e20d | 68 | void set_speed(int new_speed); |
s1200058 | 4:8713fff9e20d | 69 | void set_robot_angle(int robot_angle); |
s1200058 | 4:8713fff9e20d | 70 | void set_target_angle(int target_angle); |
s1200058 | 6:601cac49d4b1 | 71 | void set_target(double x, double y); |
kityann | 2:0f76226be922 | 72 | |
kityann | 0:3f50511c1c1f | 73 | private: |
kityann | 0:3f50511c1c1f | 74 | //モータ |
kityann | 2:0f76226be922 | 75 | VNH5019 _agzSheild; |
kityann | 1:6a034792e059 | 76 | //ロボットのスピード:32,64,128の3つ? |
kityann | 1:6a034792e059 | 77 | int speed; |
kityann | 0:3f50511c1c1f | 78 | //ロボットとターゲットの座標(緯度と経度)を表す |
kityann | 2:0f76226be922 | 79 | double robot_x,robot_y; |
kityann | 2:0f76226be922 | 80 | double robotK_x,robotK_y;//kalman filter |
s1200058 | 6:601cac49d4b1 | 81 | double target_x, target_y; |
s1210160 | 5:534a54a44b22 | 82 | //ロボットとターゲットの方角を表す。北を0として北東:1、東:1、南東3のように0~7の値を持つ |
kityann | 0:3f50511c1c1f | 83 | int robot_angle,target_angle; |
kityann | 0:3f50511c1c1f | 84 | //ジャイロ |
kityann | 2:0f76226be922 | 85 | int gyro_x,gyro_y,gyro_z; |
kityann | 0:3f50511c1c1f | 86 | //コンパス |
kityann | 2:0f76226be922 | 87 | int compass_x,compass_y,compass_z; |
s1210160 | 5:534a54a44b22 | 88 | double compass_angle; |
kityann | 2:0f76226be922 | 89 | //加速度 |
kityann | 2:0f76226be922 | 90 | double acceleration_x,acceleration_y,acceleration_z; |
kityann | 0:3f50511c1c1f | 91 | //気圧計の気圧、気温、湿度 |
kityann | 0:3f50511c1c1f | 92 | double pressure,temperature,humidity; |
kityann | 0:3f50511c1c1f | 93 | //ロボットの速度 |
kityann | 0:3f50511c1c1f | 94 | int velocity; |
kityann | 0:3f50511c1c1f | 95 | //ターゲットまでの距離 |
kityann | 0:3f50511c1c1f | 96 | int target_distance; |
kityann | 0:3f50511c1c1f | 97 | }; |
kityann | 0:3f50511c1c1f | 98 | |
s1200058 | 4:8713fff9e20d | 99 | #endif |