Help with controlling my motors with rplidar data

asked 2018-07-19 23:46:09 -0500 gravatar image

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 simple_exploration_controller and of course rosserial working fine.

I'm getting values from cmd_vel from simple_exploration_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

edit retag flag offensive close merge delete


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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-20 01:02:30 -0500 )edit

@PeteBlackerThe3rd I'm connecting to the motors through an Arduino and a motor driver (Dual TB6612FNG), I'm not using encoders. gravatar image  ( 2018-07-20 09:13:19 -0500 )edit

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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-20 10:16:03 -0500 )edit

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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-20 10:18:59 -0500 )edit

@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 ? gravatar image  ( 2018-07-20 11:48:07 -0500 )edit

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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-20 17:13:20 -0500 )edit

@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 ? gravatar image  ( 2018-07-20 17:38:51 -0500 )edit

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.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-07-21 01:54:42 -0500 )edit