Commit 9b3a965d authored by Nathan Girard's avatar Nathan Girard
Browse files

position m3508 + correction numero roues

parent 0495443b
Subproject commit 1cfd4a2bf6001fb18a671a08775f75b5d51baa3b Subproject commit 645a1cb8acfd878204b39c235c8b83d428769da5
...@@ -471,7 +471,7 @@ ...@@ -471,7 +471,7 @@
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>20</FileNumber> <FileNumber>20</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\BSP\Device\motor.c</PathWithFileName> <PathWithFileName>..\BSP\Device\motor.c</PathWithFileName>
......
...@@ -166,16 +166,12 @@ int main(void) ...@@ -166,16 +166,12 @@ int main(void)
m3508_backleft.target += 500; m3508_backleft.target += 500;
m3508_backright.target += 500; m3508_backright.target += 500;
gm6020.target += 40;
if (m3508_frontleft.target > 2000) if (m3508_frontleft.target > 2000)
{ {
m3508_frontleft.target = 0; m3508_frontleft.target = 0;
m3508_frontright.target = 0; m3508_frontright.target = 0;
m3508_backleft.target = 0; m3508_backleft.target = 0;
m3508_backright.target = 0; m3508_backright.target = 0;
gm6020.target = 0;
} }
// PWM_SetAllDuty(&htim1, 0.1f, 0.1f, 0.1f, 0.1f); // PWM_SetAllDuty(&htim1, 0.1f, 0.1f, 0.1f, 0.1f);
// HAL_Delay(2500); // HAL_Delay(2500);
...@@ -209,13 +205,13 @@ int main(void) ...@@ -209,13 +205,13 @@ int main(void)
}; };
m3508_frontleft.target = -MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] + rc_ctrl.rc.ch[1] + rc_ctrl.rc.ch[4]); m3508_frontleft.target = MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] + rc_ctrl.rc.ch[1] - rc_ctrl.rc.ch[4]);
m3508_frontright.target = MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] - rc_ctrl.rc.ch[1] - rc_ctrl.rc.ch[4]); m3508_frontright.target = -MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] - rc_ctrl.rc.ch[1] + rc_ctrl.rc.ch[4]);
m3508_backleft.target = MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] + rc_ctrl.rc.ch[1] - rc_ctrl.rc.ch[4]); m3508_backright.target = -MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] + rc_ctrl.rc.ch[1] + rc_ctrl.rc.ch[4]);
m3508_backright.target = -MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] - rc_ctrl.rc.ch[1] + rc_ctrl.rc.ch[4]); m3508_backleft.target = MAX_BASE_SPEED_COEFF*(rc_ctrl.rc.ch[0] - rc_ctrl.rc.ch[1] - rc_ctrl.rc.ch[4]);
gm6020_down.target = gm6020_down.target - rc_ctrl.rc.ch[3]*0.1; gm6020_down.target = gm6020_down.target - rc_ctrl.rc.ch[3]*0.1;
gm6020_up.target = gm6020_up.target + rc_ctrl.rc.ch[2]*0.04; gm6020_up.target = gm6020_up.target - rc_ctrl.rc.ch[2]*0.1;
if (gm6020_down.target > gm6020_down.MAX_POSITION){gm6020_down.target = gm6020_down.MAX_POSITION;} if (gm6020_down.target > gm6020_down.MAX_POSITION){gm6020_down.target = gm6020_down.MAX_POSITION;}
...@@ -236,8 +232,8 @@ int main(void) ...@@ -236,8 +232,8 @@ int main(void)
oled_clear(Pen_Clear); oled_clear(Pen_Clear);
oled_printf(1, 1, "M3508"); oled_printf(1, 1, "M3508");
oled_printf(2, 1," Target: %f", m3508_frontleft.target); oled_printf(2, 1," Target: %f", m3508_frontleft.target);
oled_printf(3, 1," Speed: %i", m3508_frontleft.info.M3508_info.speed); oled_printf(3, 1," Speed: %i", gm6020_up.info.GM6020_info.angle);
oled_printf(4, 1," Angle: %i", m3508_frontleft.info.M3508_info.angle); oled_printf(4, 1," Angle: %i", gm6020_down.info.GM6020_info.angle);
oled_refresh_gram(); oled_refresh_gram();
// oled_clear(Pen_Clear); // oled_clear(Pen_Clear);
...@@ -264,7 +260,7 @@ int main(void) ...@@ -264,7 +260,7 @@ int main(void)
set_motor_position(&gm6020_up); set_motor_position(&gm6020_up);
set_motor_position(&gm6020_down); set_motor_position(&gm6020_down);
set_motor_voltage(0, &m3508_frontleft, &m3508_frontright, &m3508_backleft, &m3508_backright); //0x200 set_motor_voltage(0, &m3508_frontleft, &m3508_frontright, &m3508_backright, &m3508_backleft); //0x200
set_motor_voltage(1, &gm6020_up, &gm6020_down, &m2006, NULL); //0x1ff set_motor_voltage(1, &gm6020_up, &gm6020_down, &m2006, NULL); //0x1ff
HAL_Delay(10); HAL_Delay(10);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment