cansat
Dependencies: VNH5019
Fork of cansat2 by
cansat.h@2:0f76226be922, 2015-07-23 (annotated)
- Committer:
- kityann
- Date:
- Thu Jul 23 08:16:33 2015 +0000
- Revision:
- 2:0f76226be922
- Parent:
- 1:6a034792e059
- Child:
- 4:8713fff9e20d
2015/07/23
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(); |
kityann | 2:0f76226be922 | 39 | |
kityann | 2:0f76226be922 | 40 | //set関数 |
kityann | 2:0f76226be922 | 41 | void set_robot_x(double); |
kityann | 2:0f76226be922 | 42 | void set_robot_y(double); |
kityann | 2:0f76226be922 | 43 | void set_robotKalman_x(double); |
kityann | 2:0f76226be922 | 44 | void set_robotKalman_y(double); |
kityann | 0:3f50511c1c1f | 45 | |
kityann | 2:0f76226be922 | 46 | void set_gyro(double x, double y, double z); |
kityann | 2:0f76226be922 | 47 | void set_compass(double x, double y, double z); |
kityann | 2:0f76226be922 | 48 | void set_pressure(double p); |
kityann | 2:0f76226be922 | 49 | void set_temperature(double t); |
kityann | 2:0f76226be922 | 50 | void set_humidity(double h); |
kityann | 2:0f76226be922 | 51 | void set_acceleration(double x, double y, double z); |
kityann | 2:0f76226be922 | 52 | |
kityann | 0:3f50511c1c1f | 53 | private: |
kityann | 0:3f50511c1c1f | 54 | //モータ |
kityann | 2:0f76226be922 | 55 | VNH5019 _agzSheild; |
kityann | 1:6a034792e059 | 56 | //ロボットのスピード:32,64,128の3つ? |
kityann | 1:6a034792e059 | 57 | int speed; |
kityann | 0:3f50511c1c1f | 58 | //ロボットとターゲットの座標(緯度と経度)を表す |
kityann | 2:0f76226be922 | 59 | double robot_x,robot_y; |
kityann | 2:0f76226be922 | 60 | double robotK_x,robotK_y;//kalman filter |
kityann | 2:0f76226be922 | 61 | double target_x,target_y; |
kityann | 0:3f50511c1c1f | 62 | //ロボットとターゲットの方角を表す。北を1として北東:2、東:3、南東4のように1~8の値を持つ |
kityann | 0:3f50511c1c1f | 63 | int robot_angle,target_angle; |
kityann | 0:3f50511c1c1f | 64 | //ジャイロ |
kityann | 2:0f76226be922 | 65 | int gyro_x,gyro_y,gyro_z; |
kityann | 0:3f50511c1c1f | 66 | //コンパス |
kityann | 2:0f76226be922 | 67 | int compass_x,compass_y,compass_z; |
kityann | 2:0f76226be922 | 68 | //加速度 |
kityann | 2:0f76226be922 | 69 | double acceleration_x,acceleration_y,acceleration_z; |
kityann | 0:3f50511c1c1f | 70 | //気圧計の気圧、気温、湿度 |
kityann | 0:3f50511c1c1f | 71 | double pressure,temperature,humidity; |
kityann | 0:3f50511c1c1f | 72 | //ロボットの速度 |
kityann | 0:3f50511c1c1f | 73 | int velocity; |
kityann | 0:3f50511c1c1f | 74 | //ターゲットまでの距離 |
kityann | 0:3f50511c1c1f | 75 | int target_distance; |
kityann | 0:3f50511c1c1f | 76 | }; |
kityann | 0:3f50511c1c1f | 77 | |
kityann | 0:3f50511c1c1f | 78 | #endif |