Ask Your Question
0

gazebo_ros_laser and tf questions

asked 2019-05-06 04:24:17 -0600

hustermxx gravatar image

This is a demo robot_desecription file

<launch>
    <param name="robot_description"
         command=" $(find xacro)/xacro  $(find cobot_description)/urdf/cobot.urdf.xacro" />
    <node name="robot_state_publisher"   pkg="robot_state_publisher"     type="robot_state_publisher" />
    <node name="joint_state_publisher"   pkg="joint_state_publisher"     type="joint_state_publisher" />

    <!--<node pkg="tf" type="static_transform_publisher" name="laser_broadcaster" args="0 0.4 0.18 1.57 0 0 base_link laser_link 100" />
    <node pkg="tf" type="static_transform_publisher" name="imu_broadcaster" args="0 0 0.18 0 0 0 base_link imu_link 100" />-->
</launch>

as you can see here robot_state_publisher publish tf for each joint,but not fixed joints,like this.

fixed joint:TF base_link->lase_link
Broadcaster: /robot_state_publisher
Average rate: 10000.000 Hz
Most recent transform: 0.000 ( 1557130482.917 sec old)
Buffer length: 0.000 sec

in addition,scan message generated by gazebo plugin has incorrect timestamps:

header: 
  seq: 11173
  stamp: 
    secs: 3042
    nsecs: 503000000
  frame_id: "laser_link"

the secs have only 4 digits which results in dropping by others for that it's too old; Any guys could give me some suggestions?Appreciate man!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-06-12 00:34:17 -0600

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

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: 2019-05-06 04:24:17 -0600

Seen: 68 times

Last updated: May 06 '19