Not able to subscribe to /cmd_vel topic
Hi, I'm new to ros,I followed a tutorial in internet to build a two-wheeled robot.Here is the problem,when i run rosrun teleop_twist_keyboard teleop_twist_keyboard.py
the output is
Waiting for subscriber to connect to /cmd_vel
here is launch file:
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find m2wr_description)/urdf/m2wr.xacro'" />
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0.5"/>
<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
args="-urdf -param robot_description -model m2wr -x $(arg x) -y $(arg y) -z $(arg z)" />
<node pkg="teleop_twist_keyboard" type="teleop_twist_keyboard.py" name="teleop">
</node>
</launch>
Here is my gazebo plugin code:
<gazebo>
<plugin filename="libgazebo_ros_diff_drive.so" name="differential_drive_controller">
<alwaysOn>true</alwaysOn>
<updateRate>20</updateRate>
<leftJoint>joint_left_wheel</leftJoint>
<rightJoint>joint_right_wheel</rightJoint>
<wheelSeparation>0.4</wheelSeparation>
<wheelDiameter>0.2</wheelDiameter>
<torque>0.1</torque>
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>link_chassis</robotBaseFrame>
</plugin>
</gazebo>
I don't know what is the problem. Please help!
First, check that the
/cmd_vel
topic exists and have a look which nodes subscribe/publish to it. (Please edit your question with the respective output. Userostopic list | grep cmd_vel
androstopic info /cmd_vel
for that.I've also experienced "issues" (rather non-issues, no warnings, no errors, simply didn't work) when the respective plugins aren't installed. Please check that you have
ros-noetic-gazebo-plugins
installed. It does not come with the defaultros-noetic-gazebo-ros
package.Thanks! I installed plugins and it worked.