Ask Your Question
0

Why doesn't gazebo publish /odom topic?

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

stevemartin gravatar image

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

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 imagegvdhoorn ( 2018-11-12 03:17:01 -0600 )edit

@gvdhoorn I have updated my answer

stevemartin gravatar imagestevemartin ( 2018-11-12 06:50:47 -0600 )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 imagePeteBlackerThe3rd ( 2018-11-12 08:48:46 -0600 )edit

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

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2018-11-12 09:04:50 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

stevemartin gravatar image

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

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

odom MUST be created automatically.

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

gvdhoorn gravatar imagegvdhoorn ( 2018-11-13 02:56:46 -0600 )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 imagePeteBlackerThe3rd ( 2018-11-13 03:41:15 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 363 times

Last updated: Nov 23 '18