Robotics StackExchange | Archived questions

LaserScan moves instead of robot in Rviz

I recently run into following problem. While trying create a map from simulation data using slam_toolbox, my laserScan data are shifting based on robot movement instead of him. Robot stay in 0,0 position despite odometry changing.

Im sending data from simulator over UDP socket to ROS nodes that receive them and publish them to specific topics, these include /odom (receivernode) and /scan (receivernode2).

My launch file:

<launch>
<arg name="open_rviz" default="true" />

<node pkg="slam_toolbox" type="sync_slam_toolbox_node" name="slam_toolbox" output="screen">
    <rosparam command="load" file="$(find analyzer_lab)/config/mapper_params_online_sync.yaml" />
</node>

<node pkg="analyzer_lab" type="receiver_node" name="receiver_node" output="screen"/>

<node pkg="analyzer_lab" type="receiver_node2" name="receiver_node2" output="screen"/>

<param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_waffle.urdf.xacro laser_visual:=true" />

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

<node pkg="dynamic_transform_publisher" type="dynamic_transform_publisher" name="dynamic_tf_pub" >
    <rosparam>
        frame_id: odom
        child_frame_id: base_footprint
        x: 0.0
        y: 0.0
        z: 0.0
        roll: 0.0
        pitch: 0.0
        yaw: 0.0
        use_rpy : True
    </rosparam>
</node>

<node pkg="dynamic_transform_publisher" type="dynamic_transform_publisher" name="dynamic_tf_pub1" >
    <rosparam>
        frame_id: base_link
        child_frame_id: wheel_left_link
        x: 0.0
        y: 0.115
        z: 0.0
        roll: 0.0
        pitch: 0.0
        yaw: 0.0
        use_rpy : True
    </rosparam>
</node>

<node pkg="dynamic_transform_publisher" type="dynamic_transform_publisher" name="dynamic_tf_pub2" >
    <rosparam>
        frame_id: base_link
        child_frame_id: wheel_right_link
        x: 0.0
        y: -0.115
        z: 0.0
        roll: 0.0
        pitch: 0.0
        yaw: 0.0
        use_rpy : True
    </rosparam>
</node>


<!-- rviz -->
<group if="$(arg open_rviz)">
  <node pkg="rviz" type="rviz" name="rviz" required="true"
    args="-d $(find analyzer_lab)/rviz/gmapping.rviz" />
</group>

To see pictures, please refer here: https://stackoverflow.com/questions/76058524/ros-laserscan-moves-instead-of-robot

Please help!

Asked by jakub.miklus on 2023-04-20 03:55:00 UTC

Comments

Answers

A few things could be causing your laser scan data to shift based on robot movement instead of the robot.

One possibility is that the laserScan topic is not being published at the same rate as the odometry topic. This can happen if the simulation runs at a different speed than the ROS nodes. You can do this by using the rostopic hz command to check the publishing rate of each topic.

Here are some additional tips for troubleshooting this problem:

  • Make sure that the laserScan and odometry topics are being published on the same ROS network.

  • Check the laserScan and odometry data for any errors.

  • Reinstall the slam_toolbox package.

Asked by satvikgupta on 2023-06-08 02:45:11 UTC

Comments