how to turn my robot with different controllers?
Hello,
I using ROS Kinetic and I have built a 4-wheel robot called labrob, which I want to control. The robot can be seen in the following picture: Screenshot from 2016-07-25 18-49-27.png
At this robot I have added 2 motors (at the two front wheels) and also differential_drive_controller plugins:
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<alwaysOn>true</alwaysOn>
<updateRate>100</updateRate>
<leftJoint>joint_f_r_wheel</leftJoint>
<wheelDiameter>0.4</wheelDiameter>
<torque>20</torque>
<commandTopic>motor1/cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>base_footprint</robotBaseFrame>
<robotNamespace>labrob</robotNamespace>
<legacyMode>true</legacyMode>
</plugin>
</gazebo>
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<alwaysOn>true</alwaysOn>
<updateRate>100</updateRate>
<leftJoint>joint_f_l_wheel</leftJoint>
<wheelDiameter>0.4</wheelDiameter>
<torque>20</torque>
<commandTopic>motor2/cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>base_footprint</robotBaseFrame>
<robotNamespace>labrob</robotNamespace>
<legacyMode>true</legacyMode>
</plugin>
</gazebo>
at the wheels that I want to control. But when I run it in gazebo and then do:
rostopic list
I cannot see the topics motor1/cmd_vel and motor2/cmd_vel . If, however, I add only one plugin for controlling both motors at the same time (in this case, the robot doesn't turn) like this:
<gazebo>
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<alwaysOn>true</alwaysOn>
<updateRate>100.0</updateRate>
<leftJoint>joint_f_l_wheel</leftJoint>
<rightJoint>joint_f_r_wheel</rightJoint>
<wheelSeperation>0.53</wheelSeperation>
<wheelDiameter>0.4</wheelDiameter>
<torque>20</torque>
<topicName>/labrob/cmd_vel</topicName>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>base_footprint</robotBaseFrame>
<publishWheelJointState>false</publishWheelJointState>
<legacyMode>true</legacyMode>
<robotNamespace>labrob</robotNamespace>
</plugin>
</gazebo>
everything works fine and after rostopic list
I can see the labrob/cmd_vel topic and publish messages on it.
Could you please tell me what should I change, so I can control the motors separately? Or if there is another type of controller for this task?
Thank you for your answers and your time in advance.
Edited:
I would like to ask what is the difference between <commandTopic>
and <topicName>
. None of the two are being identified by the rostopic list
command. Also is there a relationship in the order I put the xml tags? For example, is it possible that I need to put <WheelDiameter>
higher or lower in the code so it can be run correctly?
Maybe it should be helpful to add that I get these messages on my terminal after the gazebo roslaunch of my model:
SUMMARY
========
PARAMETERS
* /robot_description: <?xml version="1....
* /rosdistro: kinetic
* /rosversion: 1.12.2
* /use_sim_time: True
NODES
/
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)
labrob_spawn (gazebo_ros/spawn_model)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
process[gazebo-1]: started with pid [6836]
process[gazebo_gui-2]: started with pid [6843]
process[labrob_spawn-3]: started with pid [6850]
spawn_model script started
[ INFO] [1469543270.209498030]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1469543270.210093847]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[INFO] [WallTime: 1469543270.297032] [0.000000] Loading model xml from ros parameter
[INFO] [WallTime: 1469543270.299725] [0.000000] Waiting for service /gazebo/spawn_urdf_model
[ INFO] [1469543270.759606848, 0.023000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1469543270.795880524 ...