Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 11:a6fadff7cc78
- Parent:
- 10:a335588b9ef0
- Child:
- 12:9a5de6adae9c
--- a/main.cpp Wed May 01 11:53:58 2019 +0000 +++ b/main.cpp Thu May 02 00:51:47 2019 +0000 @@ -300,7 +300,7 @@ leg_li.setPIDcontroller(&pid_li); robot.setLeg(&leg_lo, &leg_li); robot.setTickerTime(0.01); //モータ出力間隔 0.01 - motor_lo.setDutyLimit(0.5); + motor_lo.setDutyLimit(0.5);//0.5 motor_li.setDutyLimit(0.5); reset(); printf("bus standby\n\r"); @@ -318,11 +318,11 @@ //Sample //スタート直進 printf("dist:%.3f\r\n", get_dist_forward()); - while(/*get_dist_back() < 300*/1) + while(get_dist_back() < 300) { - //straightAndInfinity(0, 5); - wait(0.01); - printf("angle: %.3f\r\n", degree0); + straightAndInfinity(0, 5); + //wait(0.01); + //printf("angle: %.3f\r\n", degree0); } printf("back dist:%.3f\r\n", get_dist_back()); //段差前旋回 @@ -337,8 +337,11 @@ //ロープ前旋回 turn(-90); //ロープ - while(1) straight(step_num_l, step_num_r); - + while(1) + { + straightAndInfinity(0, 5); + printf("forward:%.3f back:%.3f\r\n", get_dist_forward(),get_dist_back()); + } } void turn(float turn_degree)//turn_degreeを超えるまで旋回し続ける関数 { @@ -502,7 +505,6 @@ } double get_dist_forward() { - //sensor_forward.start(); - //return sensor_forward.get_dist_cm(); - return 0.0; + sensor_forward.start(); + return sensor_forward.get_dist_cm(); }