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

What is the problem with my odom fixed frame

asked 2018-11-07 22:52:22 -0500

Saa gravatar image

updated 2018-11-08 04:20:16 -0500

Hi everybody, As I was exploring some tutorials in the internet, I encountered an issue that is: Why my odom fixed frame act strangely when I load it with Rviz and how can I fix it ... I understand that odom frame is supposed to be like a wrapper that wraps all robots main components and through it we can exchange messages with the robot ... but that is not what I get when I launch my Rviz!

image description

however, only when I select chassis frame, things seem to work as they supposed to be! except that the center of the robot as a whole, is the center of the 3D chassis model

image description

this is my transform tree: image description

Can anybody help me with this issue?

Here are more pictures (see how when the fixed frame is odom, I won't be able to read my laser sensor .. the reading only shows if it was chassis, or hokuyo): image description image description

This is my tf, which illustrats how everythigs are attached to the chassis which attached to odom ...

image description

these are my plugins:

<gazebo reference="hokuyo">
  <sensor type="gpu_ray" name="head_hokuyo_sensor">
    <pose>0 0 0 0 0 0</pose>
    <visualize>false</visualize>
    <update_rate>40</update_rate>
    <ray>
      <scan>
        <horizontal>
          <samples>720</samples>
          <resolution>1</resolution>
          <min_angle>-2.35619</min_angle>
          <max_angle>2.35619</max_angle>
        </horizontal>
      </scan>
      <range>
        <min>0.10</min>
        <max>30.0</max>
        <resolution>0.01</resolution>
      </range>
      <noise>
        <type>gaussian</type>
        <mean>0.0</mean>
        <stddev>0.01</stddev>
      </noise>
    </ray>
    <plugin name="gazebo_ros_head_hokuyo_controller" filename="libgazebo_ros_gpu_laser.so">
      <topicName>/laser/scan</topicName>
      <frameName>hokuyo</frameName>
    </plugin>
  </sensor>
</gazebo>

 <gazebo>
  <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
    <legacyMode>false</legacyMode>
    <alwaysOn>true</alwaysOn>
    <updateRate>10</updateRate>
    <leftJoint>LRear_wheel_hinge</leftJoint>
    <rightJoint>RRear_wheel_hinge</rightJoint>
    <wheelSeparation>0.4</wheelSeparation>
    <wheelDiameter>0.2</wheelDiameter>
    <torque>10</torque>
    <commandTopic>cmd_vel</commandTopic>
    <odometryTopic>odom</odometryTopic>
    <odometryFrame>odom</odometryFrame>
    <robotBaseFrame>chassis</robotBaseFrame>
  </plugin>
</gazebo>
edit retag flag offensive close merge delete

Comments

Please attach all your images directly to your question. I've given you enough karma for that.

Links to google driver/dropbox/imgur/<insert random other image host> won't work.

gvdhoorn gravatar image gvdhoorn  ( 2018-11-08 02:29:28 -0500 )edit

Thank you so much @gvdhoorn ... I have edited as you suggested ..

Saa gravatar image Saa  ( 2018-11-08 03:39:02 -0500 )edit

I have the exact same problem...were you able to solve it?

Thank you in advance.

chillbird gravatar image chillbird  ( 2019-10-25 02:38:16 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-06-12 00:36:15 -0500

In my case I just make the "use_sim_time" value "true" then the base_link-> laser_link, base_link->imu_link and base_footprint->base_link start publishing the transform. You can see the scan topic from odom frame. This is how my launch file look like.

<launch>
  <!-- overwriting these args -->
  <arg name="debug" default="false" />
  <arg name="gui" default="true" />
  <arg name="pause" default="false" />
  <arg name="world" default="$(find my_simulations)/world/empty_world.world" />

  <!--Gazebo empty world launch file-->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(arg world)" />
        <arg name="debug" value="false" />
        <arg name="gui" value="true" />
        <arg name="paused" value="false"/>
        <arg name="use_sim_time" value="true"/>
        <arg name="headless" value="false"/>
        <arg name="verbose" value="true"/>
  </include>

  <!--Robot Description from URDF-->
  <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find robot_description)/urdf/mybot.xacro'" />
  <param name="use_gui" value="false"/>

  <!--Nodes-->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>
  <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model mybot -verbose" output="screen"/>
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find cobot_description)/rviz/mybot.rviz" required="true"/>

</launch>
edit flag offensive delete link more
0

answered 2018-11-08 01:46:50 -0500

updated 2018-11-08 05:22:19 -0500

A few things. Odom and the TF tree have nothing to do with message passing at all, they are used to define the geometric relationships of different parts of the robot and the world.

For the ROS navigation stack to work properly there should be a dynamic transform from odom to base_link (chassis in your case but base_link is the standard) this is usually provided by wheel odometry. There should also be a dynamic transform from map to odom which publishes corrections based on some type of absolute sensing such as SLAM or GPS. These two transforms combine to describe the location of the robot within a map.

When you say things don't work as they're supposed to, what exactly do you mean?

UPDATE:

I had a close look at your TF tree and there is a big time difference between some of the most recent transforms. the odom to chassis transform is over 400 seconds old, as are the sensor frame transforms. The wheel transforms are current though. If you select the odom frame you can see that the wheel transforms are not picked up because their time stamps are over 5 minutes ahead.

Is gazebo publishing sim time? This looks like a problem with the time stamps of the transforms that are being published. Is Gazebo running on the same machine as RVIZ?

edit flag offensive delete link more

Comments

Hi Blacker, I understand that ... however when you use Rviz you need to select your fixed frame before you start your simulator, right? I have added more pictures, and my plugins codes .. please refer to them.

Saa gravatar image Saa  ( 2018-11-08 04:20:47 -0500 )edit

You can choose the fixed frame in RVIZ at any time as often as you want, it has no bearing on the simulator. I've updated my answer now, I think the timing is the problem.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-11-08 05:23:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-11-07 22:46:40 -0500

Seen: 2,779 times

Last updated: Nov 08 '18