This commit is contained in:
Richie 2023-11-20 14:47:51 +08:00
parent ef9197d899
commit f8f009dd39
2 changed files with 24 additions and 23 deletions

View File

@ -30,7 +30,7 @@ set_wheel_direction(uint32_t direction)
void void
update_target_yaw(volatile direction_t * g_direction) update_target_yaw(volatile direction_t * g_direction)
{ {
updateDirection(g_direction); // updateDirection(g_direction);
g_direction->target_yaw = g_direction->yaw; g_direction->target_yaw = g_direction->yaw;
} }

View File

@ -105,27 +105,28 @@ set_wheel_speed_synced(uint32_t pwm_level, car_struct_t *pp_car_strut)
set_wheel_speed(pwm_level, pp_car_strut->p_right_motor); set_wheel_speed(pwm_level, pp_car_strut->p_right_motor);
} }
///*! /*!
// * @brief Set the distance to travel before stopping, must be called after * @brief Set the distance to travel before stopping, must be called after
// * setting the speed and direction. * setting the speed and direction.
// * @param distance_cm distance to travel in cm * @param distance_cm distance to travel in cm
// */ */
//void void
//distance_to_stop(float distance_cm) distance_to_stop(car_struct_t * pp_car_struct, float distance_cm)
//{ {
// float initial = g_motor_right.speed.distance_cm; float initial = pp_car_struct->p_left_motor->speed.distance_cm;
//
// for (;;) for (;;)
// { {
// if (g_motor_right.speed.distance_cm - initial >= distance_cm) if (pp_car_struct->p_left_motor->speed.distance_cm - initial >= distance_cm)
// { {
// set_wheel_speed_synced(0u); set_wheel_speed_synced(0u);
// break; break;
// } }
// vTaskDelay(pdMS_TO_TICKS(10)); vTaskDelay(pdMS_TO_TICKS(10));
// } }
// vTaskDelay(pdMS_TO_TICKS(1000)); vTaskDelay(pdMS_TO_TICKS(1000));
// g_motor_right.speed.distance_cm = g_motor_left.speed.distance_cm; pp_car_struct->p_right_motor->speed.distance_cm =
//} pp_car_struct->p_left_motor->speed.distance_cm;
}
#endif /* MOTOR_SPEED_H */ #endif /* MOTOR_SPEED_H */