I had my robot moving on the ground by using the teleop_twist_keyboard package, but the robot is not really going straight and it deviates to the left from the straight line after few seconds. Does this issue relate to the wrong ROS param settings for velocity calculations? My robot can move forward and backward so the wiring should be good. Thanks!
I don’t believe this is happening due to something from the ROS side. This happens in many cases, especially with low-cost robots due to many factors (small differences in wheel speeds, frictions…). A possible fix would be to use some kind of external sensor data (maybe odometry data, but I don’t think this will be accurate either) in order to correct this deviation (aka control system).
What is being published on the cmd_vel topic? If it looks good then its probably a hardware issue. What type of hardware setup you are running?
Thanks for your replying! Do you think applying a PID controller would alleviate this issue? Or do you have any further suggestions? Appreciate for your time.
Thanks for your replying! Since the required magician chassis in the lecture part lists is out of order, I use this one for alternative: https://www.amazon.com/gp/product/B07ZJ4ZXWP/ref=ppx_yo_dt_b_asin_title_o07_s01?ie=UTF8&psc=1
Meanwhile the required RPI li-po power board in the lecture part lists is out of order as well, I use this one for alternative:
All the other hardware are the same as what have inside the lecture part lists. The cmd_vel topic is fine, I use rostopic info to check that the publisher is teleop_twist_keyboard and the subscriber is part2_cmr which converts the keyboard command input to power input to Arduino. Could you provide any further suggestion? Appreciate a lot for your time.
I have worked with BO Motors(same as the ones mentioned in the part list) before and they usually don’t have consistent RPM for a given voltage. In fact most DC motors don’t, hence making your bot go in a straight line is actually quite difficult practically.
One of the easiest ways to tackle this issue is using encoders.
I’m note sure how bad its drifting but to narrow it down you can switch the power going to the left to the right and if there is no change switch the motors left to right. That will tell you if its the motors or the power supply. If you need a precise velocity or distance you should be using steppers or servos. and if you don’t want any drift in your odometry you should be utilizing SLAM.
I am by no means a professional but I am building an autonomous lawnmower
@tonyli19970130 I think a PID controller might be also helpful in this case, yes.