修轮子方向

This commit is contained in:
Robofish 2025-10-05 19:10:49 +08:00
parent 24160f21dc
commit 89092f771b

View File

@ -73,9 +73,9 @@ static void Chassis_UpdateChassisState(Chassis_t *c) {
return;
// 从轮子编码器估计机体速度 (参考C++代码)
float left_wheel_speed_dps = c->feedback.wheel[0].rotor_speed; // dps (度每秒)
float left_wheel_speed_dps = -c->feedback.wheel[0].rotor_speed; // dps (度每秒)
float right_wheel_speed_dps =
c->feedback.wheel[1].rotor_speed; // dps (度每秒)
-c->feedback.wheel[1].rotor_speed; // dps (度每秒)
// 将dps转换为rad/s
float left_wheel_speed = left_wheel_speed_dps * M_PI / 180.0f; // rad/s
@ -263,10 +263,10 @@ void Chassis_Output(Chassis_t *c) {
// }
float out[4] = {
c->output.joint[0], c->output.joint[1], c->output.joint[2], c->output.joint[3]};
// out[0] = -1.0f;
// out[1] = 1.0f;
// out[2] = 1.0f;
// out[3] = -1.0f;
// out[0] = 0.0f;
// out[1] = 0.0f;
// out[2] = 0.0f;
// out[3] = 0.0f;
Virtual_Chassis_SendJointTorque(&virtual_chassis, out);
Virtual_Chassis_SendWheelCommand(&virtual_chassis, c->output.wheel[0], c->output.wheel[1]);
// for (int i = 0; i < 2; i++) {