ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Why doesn't gazebo publish /odom topic?

asked 2018-11-12 02:48:10 -0500

stevemartin gravatar image

updated 2018-11-12 06:50:31 -0500

This is my launch file:

<launch>

  <param name="use_sim_time" value="true" />

  <param name="robot_description" command="$(find xacro)/xacro '$(find genius_description)/urdf/test.xacro'"/>

  <node name="state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find genius_gazebo)/worlds/test.world" />
  </include>

  <node name="genius_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
   args="-urdf -param robot_description -model genius" />

   <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
         respawn="false" output="screen">
  </node>
   <node pkg="rviz" type="rviz" name="rviz"/>

</launch>

So as you can see, I am spawning gazebo but at the end I do not see /odom topic to be published. This is strange because this launch file worked earlier and now, no odom topic. Shouldn't gazebo publish /odom topic automatically?

Here is the gazebo plugin I am using:

<gazebo>
    <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>30</updateRate>
          <legacyMode>false</legacyMode>
      <leftJoint>left_wheel_hinge</leftJoint>
      <rightJoint>right_wheel_hinge</rightJoint>
      <wheelSeparation>${chassisWidth+wheelWidth}</wheelSeparation>
      <wheelDiameter>${2*wheelRadius}</wheelDiameter>
      <torque>10</torque>
      <commandTopic>cmd_vel</commandTopic>
      <odometryTopic>odom</odometryTopic>
      <odometryFrame>odom</odometryFrame>
      <robotBaseFrame>base_link</robotBaseFrame>
      <rosDebugLevel>1</rosDebugLevel>
      <publishWheelTF>true</publishWheelTF>
      <publishWheelJointState>true</publishWheelJointState>
      <wheelTorque>20</wheelTorque>
    </plugin>
  </gazebo>
edit retag flag offensive close merge delete

Comments

Shouldn't gazebo publish /odom topic automatically?

No, not as far as I know.

Do you load any plugins in your urdf/xacro?

Gazebo is basically a replacement for the hardware of your robot. You'll still need to load the necessary drivers (ie: plugins).

gvdhoorn gravatar image gvdhoorn  ( 2018-11-12 03:17:01 -0500 )edit

@gvdhoorn I have updated my answer

stevemartin gravatar image stevemartin  ( 2018-11-12 06:50:47 -0500 )edit

Your launch file doesn't appear to be starting the differential_drive_controller. There should be a controller_manager/spawner node in there.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-12 08:48:46 -0500 )edit

You're also starting two robot_state_publishers, possibly one of these is meant to be your controller_manager spawner.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-12 09:04:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-11-13 01:15:28 -0500

stevemartin gravatar image

updated 2018-11-23 09:02:11 -0500

Okay, I found the solution. After making apt-get upgrade of my system, I was able to create an odom using gazebo. If you are spawining gazebo, odom MUST be created automatically.

Guys, just try sudo apt-get upgrade. For the comment below, yes, I have used the differential gazebo plugin.

edit flag offensive delete link more

Comments

1

odom MUST be created automatically.

what do you mean by this? Without the plugin, Gazebo won't publish any odometry.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-13 02:56:46 -0500 )edit

To answer your own question can you please explain to other uses how you solved your problem. If someone else can't read your answer and work out how to do the same thing then it won't be able to help anyone.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-13 03:41:15 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-12 02:48:10 -0500

Seen: 3,096 times

Last updated: Nov 23 '18