mit-racecar / racecar

225 stars 141 forks source link

Need to center the steering #11

Closed ArtlyStyles closed 6 years ago

ArtlyStyles commented 6 years ago

I built a Racecar J and could use teleop to drive it. I found, however, my car always turn right a little bit, even when I drive it straight. I think the steering is not centered. Is there anything I can tune with the BLDC tool? Or I have the tune the car mechanical parts?

mboulet commented 6 years ago

I'm not an RC car expert, but I believe that there is a way to adjust the steering mechanically. But first, I would suggest tuning the steering_angle_to_servo_offset parameter in vesc.yaml if you are using the throttle_interpolator.py node.

ArtlyStyles commented 6 years ago

hi @mboulet Chaning the steering_angle_to_servo_offset did fix the issue when the car was moving forward. However, when the car was moving backward, it still turned right slightly. Do you know how to fix that?

Thank you very much.

mboulet commented 6 years ago

Hi @ArtlyStyles . That is an interesting result. I would suggest using rostopic echo to publish the servo command sent to the vesc driver (likely the /vesc/commands/servo/position topic, but it could be different on your system) when driving straight forwards and straight backwards. I would think that they would be the same, but its possible that your code includes some logic that changes the servo command based on the sign of the vehicle speed.

If the servo command value is the same when going forwards and backwards and you still see the vehicle turning slightly, you could try to add logic to ackermann_to_vesc.cpp to use a different servo center value depending on the sign of the speed.

However, I think you could spend a lot of time adjusting the servo center parameters to eliminate slight turning and perhaps find that it starts turning again slightly after the RACECAR has been running for an hour or with a different track surface. You are experiencing a fundamental issue with an open-loop approach. In order to navigate effectively, you will likely need some sort of feedback from sensors in order to correct for slight errors between the command and how the RACECAR actually responds.