Robotics StackExchange | Archived questions

Problem visualizing odom msgs in Rviz2

Hi all,

(I am new to writing im markdown, forgive me !)

Envirorment

Problem

Pleas forgive my possible clumsiness of describing the situation...

I am trying to visualize an odometry msg from gazebo in Rviz2 using the libgazeborosp3d.so plugin.

I have setup a seperate model and plugin folder under a Gazebo folder in my home dir.

The plugins are then copied from the colcon ws build folder into my gazebo plugin dir.

Plugin in the model .sdf file

libgazeborosp3d.so:

<?xml version="1.0" ?>
<sdf version='1.6'>
  <model name='botsy'>
    <link name='base_link'>
      <(properties in link is not shown in question)>
    </link>
    <!-- P3D publishes ground truth data of object -->
    <plugin name="gazebo_ros_p3d_botsy" filename="libgazebo_ros_p3d.so">
      <ros>
        <argument>odom:=botsy/odom/base_link</argument>
      </ros>
      <body_name>base_link</body_name>
      <frame_name>odom</frame_name>
      <update_rate>10</update_rate>
      <xyz_offset>0.0 0.0 0.0</xyz_offset>
      <rpy_offset>0.0 0.0 0.0</rpy_offset>
      <gaussian_noise>0.01</gaussian_noise>
    </plugin>
  </model>
<\sdf>

libgazeborosimu_sensor.so (adding for completeness, I am not trying to view this in rviz2)

<plugin filename="libgazebo_ros_imu_sensor.so" name="RosImuPlugin_zed_mini">
    <ros>
        <argument>~/out:=zed_mini_imu/imu</argument>
        <frame_name>zed_mini_imu_frame</frame_name>  
    </ros>
</plugin>

Launching gazebo and adding model

When launching gazebo, using:

"ros2 launch gazebo_ros gazebo.launch.py"

Then in gazebo i add the model, i get some warnings in the terminal:

```

GAZEBO_PLUGIN_PATH :/home/void/Gazebo_botsy/plugin
GAZEBO_MODEL_PATH :/home/void/Gazebo_botsy/models
LD_LIBRARY_PATH /opt/ros/eloquent/opt/yaml_cpp_vendor/lib:/opt/ros/eloquent/opt/rviz_ogre_vendor/lib:/opt/ros/eloquent/lib/x86_64-linux-gnu:/opt/ros/eloquent/lib:/home/void/Gazebo_botsy/plugin
Gazebo setup OK!
ROS2 setup OK!
[INFO] [launch]: All log files can be found below /home/void/.ros/log/2021-02-19-11-07-34-736982-NotAVm-23394
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [23408]
[INFO] [gzclient   -2]: process started with pid [23410]
[gzserver-1] [WARN] [rcl]: Found remap rule '~/out:=zed_mini_imu/imu'. This syntax is deprecated. Use '--ros-args --remap ~/out:=zed_mini_imu/imu' instead.
[gzserver-1] [WARN] [rcl]: Found remap rule '~/out:=sensor_aux/imu'. This syntax is deprecated. Use '--ros-args --remap ~/out:=sensor_aux/imu' instead.
[gzserver-1] [WARN] [rcl]: Found remap rule 'odom:=botsy/odom/base_link'. This syntax is deprecated. Use '--ros-args --remap odom:=botsy/odom/base_link' instead.
[gzserver-1] [WARN] [gazebo_ros_p3d_botsy]: <frame_name> [odom] does not exist.
[gzserver-1] [WARN] [rcl]: Found remap rule 'odom:=botsy/odom/zed_mini'. This syntax is deprecated. Use '--ros-args --remap odom:=botsy/odom/zed_mini' instead.
[gzserver-1] [WARN] [gazebo_ros_p3d_zed_mini]: <frame_name> [odom] does not exist.
[gzserver-1] [WARN] [rcl]: Found remap rule 'odom:=botsy/odom/aux_imu'. This syntax is deprecated. Use '--ros-args --remap odom:=botsy/odom/aux_imu' instead.
[gzserver-1] [WARN] [gazebo_ros_p3d_imu]: <frame_name> [odom] does not exist.

```

viewing the Ros topics gives:

```

/botsy/odom/aux_imu
/botsy/odom/base_link
/botsy/odom/zed_mini
/clock
/parameter_events
/rosout
/sensor_aux/imu
/zed_mini_depth/camera_info
/zed_mini_depth/depth/camera_info
/zed_mini_depth/depth/image_raw
/zed_mini_depth/image_raw
/zed_mini_depth/points
/zed_mini_imu/imu
/zed_mini_rgb/camera_info
/zed_mini_rgb/image_raw

```

The /botsey/odom/base_link topic has the following header:

´´´

header:
  stamp:
    sec: 512
    nanosec: 452000000
  frame_id: odom
child_frame_id: botsy::base_link
pose:
  pose:
    position:
      x: 0.029298000000005445
      y: -0.051209999999999437
      z: 0.053999999992331495
    orientation:
      x: -4.83408196325272e-15
      y: 4.9896276853249836e-14
      z: -1.3318259918022349e-15
      w: 1.0

´´´

Trying to vizulize in rviz2

I launch rviz2 using

"ros2 run rviz2 rviz2"

First it looks like this (can't poste picture, I have to few points :'( ):

link:imgur_link (https://i.imgur.com/doCFFvT.png)

I try to tie the tf's together with:

"ros2 run tf2ros statictransform_publisher 0.0 0.0 0.0 0.0 0.0 0.0 1.0 map odom"

Then It looks like this (abit optimistic since something is happening)

link:imgur_link (https://i.imgur.com/c1Oz8Zh.png)

Conclusion

This where I am stuck, I would have hoped that the "dynamic transforms" from the Gazebo plugins would create the "botsy::base_link" frame and add that to rviz...

Any help will be greatly appreciated

Asked by SnowFlake on 2021-02-19 05:49:47 UTC

Comments

Answers