![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
2023春ロボ2班 足回りコード
Dependencies: CalPID_2022 Encoder_2022 MPU6050 Madgwickfilter MotorController_2022 mbed
Diff: main.cpp
- Revision:
- 2:f1e26c8084f2
- Parent:
- 0:1b4780d434ab
- Child:
- 3:7c29db78fa24
--- a/main.cpp Thu Oct 27 05:41:49 2022 +0000 +++ b/main.cpp Thu Oct 27 07:10:24 2022 +0000 @@ -18,16 +18,17 @@ Serial pc(USBTX,USBRX); //速度制御のPID 前3つが係数なのでこれを調整 P→D→Iの順に調整 -CalPID speed_pidA(0.000,0.0,0.000,DELTA_T,DUTY_MAX); -CalPID speed_pidB(0.00,0.0,0.000,DELTA_T,DUTY_MAX); -CalPID speed_pidC(0.00,0.0,0.000,DELTA_T,DUTY_MAX); -CalPID speed_pidD(0.00,0.0,0.000,DELTA_T,DUTY_MAX); +CalPID speed_pidA(0.01,0.0,0.000,DELTA_T,DUTY_MAX); +CalPID speed_pidB(0.01,0.0,0.000,DELTA_T,DUTY_MAX); +CalPID speed_pidC(0.01,0.0,0.000,DELTA_T,DUTY_MAX); +CalPID speed_pidD(0.01,0.0,0.000,DELTA_T,DUTY_MAX); //角度制御のPID 今回は不要だけどMotorContorollerの引数なので消さずに放置してください CalPID angle_omega_pid(0.0,0.0,0.0,DELTA_T,OMEGA_MAX); //エンコーダ(A層,B層,分解能) //モーター(正転,逆転,PWM周期,エンコーダ,CALPIDの角速度PID,角度PID) /////////////R1(f446re)//////////////// +/* //タイヤA Ec2multi ecA(PC_6,PC_8,RESOLUTION); MotorController motorA(PA_8,PA_9,50,ecA,speed_pidA,angle_omega_pid); @@ -40,6 +41,21 @@ //タイヤD Ec2multi ecD(PC_2,PC_3,RESOLUTION); MotorController motorD(PB_4,PB_5,50,ecD,speed_pidC,angle_omega_pid); +*/ + + +//タイヤA +Ec2multi ecA(PC_3,PC_2,RESOLUTION); +MotorController motorA(PA_8,PA_9,50,ecA,speed_pidA,angle_omega_pid); +//タイヤB +Ec2multi ecB(PC_12,PC_10,RESOLUTION); +MotorController motorB(PB_1,PA_11,50,ecB,speed_pidB,angle_omega_pid); +//タイヤC +Ec2multi ecC(PC_6,PC_8,RESOLUTION); +MotorController motorC(PA_0,PA_1,50,ecC,speed_pidC,angle_omega_pid); +//タイヤD +Ec2multi ecD(PB_14,PB_15,RESOLUTION); +MotorController motorD(PB_4,PB_5,50,ecD,speed_pidC,angle_omega_pid); ////////////////R2(f303k8)///////////////////////