cansat program1
Dependencies: ADXL345 BME280 HMC5883L ITG3200 MBed_Adafruit-GPS-Library XBee agzIDLIST cansat mbed
Fork of Cansat_program4_1 by
Diff: main.cpp
- Revision:
- 15:dd7c2ab65a09
- Parent:
- 14:4dfeeca65308
- Child:
- 16:a3a0e5654835
--- a/main.cpp Wed Aug 12 07:27:45 2015 +0000 +++ b/main.cpp Wed Aug 12 12:11:25 2015 +0000 @@ -108,7 +108,7 @@ int change = 0; int mode = 2; //ロボットのモード -double target_x = 37.52260177176629,target_y = 139.93881346945034; +double target_x = 40.085592,target_y = 139.592383; double goal_Pressure, goal_Temperature,goal_Humidity; //地表地点の気圧、気温、湿度 Timer sep_Timer; @@ -166,8 +166,8 @@ if (myGPS->fix) { cansat.nowStatus = GPS_AVAIL; - cansat.set_robot_x((double)myGPS->latitudeH + (double)(myGPS->latitudeL / 10000.0)); - cansat.set_robot_y((double)myGPS->longitudeH +(double)(myGPS->longitudeL / 10000.0)); + cansat.set_robot_x((double)myGPS->latitudeH + (double)(myGPS->latitudeL / 1000000.0)); + cansat.set_robot_y((double)myGPS->longitudeH +(double)(myGPS->longitudeL / 1000000.0)); if(flag < COUNTER_MAX){ @@ -329,6 +329,15 @@ /****************************** 落下モード ******************************/ +void falling_print(){ + + xbee.printf("%d times, x:%f, y:%f, speed:%d\n", log_number, cansat.get_robot_x(), cansat.get_robot_y(), cansat.get_speed()); + xbee.printf("Pressure:%04.2f hPa\n", cansat.get_pressure()); + + log_number++; + +} + void falling(){ cansat.set_temperature(sensor.getTemperature()); @@ -348,6 +357,9 @@ } } + + falling_print(); + } /****************************** @@ -358,7 +370,7 @@ xbee.printf("%d times, x:%f, y:%f, speed:%d\n", log_number, cansat.get_robot_x(), cansat.get_robot_y(), cansat.get_speed()); xbee.printf("moter command: %c\n", cansat.motor_command); - xbee.printf("robot_angle:%d, target_angle:%d, robot_compass:%f, %04.2f hPa\n",cansat.get_robot_angle(), cansat.get_target_angle(), cansat.get_compass_angle(), cansat.get_pressure()); + xbee.printf("robot_angle:%d, target_angle:%d, robot_compass:%f, prressure:%04.2f hPa\n",cansat.get_robot_angle(), cansat.get_target_angle(), cansat.get_compass_angle(), cansat.get_pressure()); log_number++;