// power the motor in order to test them // sequence : left motor forward then backward // right motor forward then backward // nether return void motors_wrapper_test(void) { for (int i = 0; i < 50; ++i) { motors_wrapper_left_motor_set_duty_cycle(i); platform_led_toggle(PLATFORM_LED0); for (volatile int t = 0; t < 1000000; t++); //delay } for (int i = 0; i < 50; ++i) { motors_wrapper_left_motor_set_duty_cycle(-i); platform_led_toggle(PLATFORM_LED1); for (volatile int t = 0; t < 1000000; t++); } for (int i = 0; i < 50; ++i) { motors_wrapper_right_motor_set_duty_cycle(i); platform_led_toggle(PLATFORM_LED2); for (volatile int t = 0; t < 1000000; t++); } for (int i = 0; i < 50; ++i) { motors_wrapper_right_motor_set_duty_cycle(-i); platform_led_toggle(PLATFORM_LED3); for (volatile int t = 0; t < 1000000; t++); } while(1); }
static void control_system_set_motors_ref(struct control_system *UNUSED(am), float d_mm, float theta) # endif { uint32_t axle_track_mm = position_get_axle_track_mm(); int32_t right_motor_ref = position_mm_to_ticks(d_mm + (1.0 * axle_track_mm * theta) / 2); int32_t left_motor_ref = position_mm_to_ticks(d_mm - (1.0 * axle_track_mm * theta) / 2); # ifdef USE_MOTOR_SPEED_CS ausbee_cs_set_reference(&(am->csm_right_motor), right_motor_ref); ausbee_cs_set_reference(&(am->csm_left_motor), left_motor_ref); # else motors_wrapper_right_motor_set_duty_cycle(NULL, right_motor_ref); motors_wrapper_left_motor_set_duty_cycle(NULL, left_motor_ref); # endif }