![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
ライブラリ化を行った後
Dependencies: QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo
Fork of 17robo_Practice1 by
Diff: main.cpp
- Revision:
- 26:3280d0300b04
- Parent:
- 25:124aee8a7742
- Child:
- 27:2ffbc5587399
diff -r 124aee8a7742 -r 3280d0300b04 main.cpp --- a/main.cpp Mon Aug 07 08:48:15 2017 +0000 +++ b/main.cpp Mon Aug 07 08:56:32 2017 +0000 @@ -61,8 +61,7 @@ Accel v3; Accel v4; Cylinder cylinder(pin_cylinder_on,pin_cylinder_off); -Cyclic sword_left; -Cyclic sword_right; +Cyclic sword; //追加点 Encoder enc_cylinder(encoder_A,encoder_B); @@ -74,8 +73,7 @@ void cylinder_cal(); void boost(); void cylinder_origin(); -void sword_left_cal(); -void sword_right_cal(); +void sword_cal(); float yaw, target_yaw; @@ -114,8 +112,7 @@ { motor_cal(); cylinder_cal(); - sword_left_cal(); - sword_right_cal(); + sword_cal(); //boost(); static int counter; @@ -139,7 +136,7 @@ counter ++; break; case 4: - rs422.put(id[counter], ((float)sword_right.getState()*0.8),((float)sword_left.getState()*0.8)); + rs422.put(id[counter], ((float)sword.getState()*0.8),0.0); counter = 0; break; default: @@ -147,12 +144,8 @@ }; } -void sword_left_cal(){ - sword_left.cyclic(sbdbt.left); -} - -void sword_right_cal(){ - sword_right.cyclic(sbdbt.maru); +void sword_cal(){ + sword.cyclic(sbdbt.maru); } void cylinder_origin(){ @@ -165,22 +158,24 @@ void cylinder_cal() { - cylinder.cyclic(sbdbt.right); + cylinder.cyclic(sbdbt.shikaku); } void boost(){ - if(sbdbt.sankaku) { + if(sbdbt.r2){ mecanum.boost_forward(); } - if(sbdbt.batu) { + if(sbdbt.l2){ mecanum.boost_back(); } + /* if(sbdbt.shikaku) { mecanum.boost_left(); } if(sbdbt.maru) { mecanum.boost_right(); } + */ } void motor_cal()