![](/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: mecanum.h
- Revision:
- 10:04f2a82cfd89
- Parent:
- 5:6efda58ff71b
- Child:
- 41:a4e37077833b
--- a/mecanum.h Tue Jul 11 09:39:40 2017 +0000 +++ b/mecanum.h Sun Jul 16 04:06:49 2017 +0000 @@ -20,8 +20,9 @@ */ -#define rotaPower 0.3 -#define boost_K 0.5 +#define rotaPower 0.4 +#define boost_A 0.5 +#define boost_K 0.9 #define PI 3.141592 class Mecanum{ @@ -45,17 +46,46 @@ void boost(){ if(vy > 0.4){ - V1 += boost_K; - V2 += -boost_K; - V3 += boost_K; - V4 += -boost_K; + V1 += boost_A; + V2 += -boost_A; + V3 += boost_A; + V4 += -boost_A; }else if(vy < -0.4){ - V1 += -boost_K; - V2 += boost_K; - V3 += -boost_K; - V4 += boost_K; + V1 += -boost_A; + V2 += boost_A; + V3 += -boost_A; + V4 += boost_A; } - } + } + + void boost_forward(){ + V1 = -boost_K; + V2 = boost_K; + V3 = -boost_K; + V4 = boost_K; + } + + void boost_back(){ + V1 = boost_K; + V2 = -boost_K; + V3 = boost_K; + V4 = -boost_K; + } + + void boost_right(){ + V1 = boost_K; + V2 = -boost_K; + V3 = -boost_K; + V4 = boost_K; + } + + void boost_left(){ + V1 = -boost_K; + V2 = boost_K; + V3 = boost_K; + V4 = -boost_K; + } + void xy_cal(float Vx, float Vy){ V1 = Vx / 2 + Vy / 2;