Пример #1
0
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
}
Пример #2
0
static void control_system_set_motors_ref(float d_mm, float theta)
{
  uint32_t axle_track_mm = position_get_axle_track_mm();

  d_mm = -d_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);

  //printf("cmd right %d   left %d\r\n", (int)right_motor_ref, (int)left_motor_ref);

  motors_wrapper_motor_set_duty_cycle(RIGHT_MOTOR, right_motor_ref);
  motors_wrapper_motor_set_duty_cycle(LEFT_MOTOR, left_motor_ref);

  //ausbee_cs_set_reference(&(am.csm_right_motor), right_motor_ref);
  //ausbee_cs_set_reference(&(am.csm_left_motor), left_motor_ref);
}