Help with controlling my motors with rplidar data
I'm trying to build an autonomous mapping and navigation robot with rplidar, arduino ( controlling the motors and ROS)
So far I I have got lidar, hector slam, hector exploration planner, and run the simpleexplorationcontroller and of course rosserial working fine.
I'm getting values from cmdvel from simpleexploration_controller.
Can I controll my motors speed by using these cmd_values ? and just try to connect it to my arduino vis rosserial ?
Thank you
Asked by hamzh.albar@gmail.com on 2018-07-19 23:46:09 UTC
Comments
How exactly are you connecting to your motors? Do they have encoders? Are you running a H bridge from the arduino? The answer to your question is yes but we'll need to know more details to give you a more useful answer.
Asked by PeteBlackerThe3rd on 2018-07-20 01:02:30 UTC
@PeteBlackerThe3rd I'm connecting to the motors through an Arduino and a motor driver (Dual TB6612FNG), I'm not using encoders.
Asked by hamzh.albar@gmail.com on 2018-07-20 09:13:19 UTC
Okay, the problem you're going to have here is controlling the motors speed at all. Without encoders you will need to do open loop control which will make accurately controlling the motors speed hard/impossible.
Asked by PeteBlackerThe3rd on 2018-07-20 10:16:03 UTC
If the load on the motors is fairly constant such as if you robot will always work on a smooth horizontal floor then you may be able to tune it so it's not too bad. But I'd really recommend trying to get some encoders so you can use closed loop control, then you can set the speed accurately.
Asked by PeteBlackerThe3rd on 2018-07-20 10:18:59 UTC
@PeteBlackerThe3rd I can add encoders, but I have read that hector slam does not need odometry? If I add encoders, am I using anything other than cmd_values as my feedback ?
Asked by hamzh.albar@gmail.com on 2018-07-20 11:48:07 UTC
Hector slam may well not need odometry but to accurately obey cmd_vel messages your rover will need to control its wheel speed precisely. This can be done either using open loop stepper motors or closed loop DC motors. A closed loop controller needs to measure the speed of the wheels.
Asked by PeteBlackerThe3rd on 2018-07-20 17:13:20 UTC
@PeteBlackerThe3rd That's make sense thank you. So as I understood, the cmd_vel and the encoder value will be fed into another code ( Arduino code ) and I should write the closed loop controller on the Arduino ?
Asked by hamzh.albar@gmail.com on 2018-07-20 17:38:51 UTC
Yes that's right. The cmd_vel values will be passed to the arduino which will calculate the required wheel speeds. Two closed loop controllers will use the encoders to determine the wheels speed and set the motor voltages appropriately. These will probably be PID controllers.
Asked by PeteBlackerThe3rd on 2018-07-21 01:54:42 UTC
@PeteBlackerThe3rd , can you describe briefly, how I can pass the cmd_vel and use it to control the speed ? It would be great if there is an arduino code example. Thank you
Asked by hamzh.albar@gmail.com on 2018-07-21 18:11:13 UTC