Rviz2 can't visualize image from Gazebo
Hello, I'm using Ubuntu 20.04 with Ros Foxy and I'm trying to visualize in Rviz2 the images captured by a camera in Gazebo attached to a drone. I have the following tree frames:
odom_frame
drone
robot_camera_link
The transformation between drone
and odom_frame
is supplied by a Ros2 node, while the transformation between drone
and robot_camera_link
is given through the command ros2 run tf2_ros static_transform_publisher 0.2 0 0 0 0 0 drone robot_camera_link
; so far everything works and in Rviz I can correctly visualize the three frames.
After adding the image plugin and setting the QoS policies as required by the publisher, Rviz doesn't show the image and on the terminal is continuously printed the message
[rviz]: Message Filter dropping message: frame 'robot_camera_link' at time ... for reason 'Unknown'
I managed to get the right image in just two cases:
- running
ros2 run tf2_ros static_transform_publisher 0.2 0 0 0 0 0 **odom_frame** robot_camera_link
, so attaching the frame of the camera directly to the fixed frame, or - changing the
Fixed Frame
parameter todrone
instead ofodom_frame
So it seems as the plugin must always be attached to the fixed frame to be properly visualized, but I'm sure it's not and I'm certainly doing something wrong that I can't figure out.
You can find below the SDF files I'm using.
Please let me know if you need further info.
Thank you very much for your help.
<?xml version='1.0'?>
<sdf version='1.5'>
<model name='iris_fpv_cam'>
<include>
<uri>model://iris</uri>
</include>
<include>
<uri>model://fpv_cam</uri>
<pose>0.2 0 0 0 0 0</pose>
</include>
<joint name="fpv_cam_joint" type="fixed">
<child>fpv_cam::link</child>
<parent>iris::base_link</parent>
<axis>
<xyz>0 0 1</xyz>
<limit>
<upper>0</upper>
<lower>0</lower>
</limit>
</axis>
</joint>
</model>
</sdf>
////////////////////////////////////////////////////////////////////////////
<?xml version='1.0'?>
<sdf version='1.6'>
<model name='fpv_cam'>
<pose>-0.158979 -0.04405 0.045074 0 -0 0</pose>
<link name='link'>
<inertial>
<mass>0.015</mass>
<inertia>
<ixx>4.15e-6</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>2.407e-6</iyy>
<iyz>0</iyz>
<izz>2.407e-6</izz>
</inertia>
</inertial>
<collision name='collision'>
<geometry>
<box>
<size>0.01 0.01 0.01</size>
</box>
</geometry>
<max_contacts>10</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<ode/>
</friction>
</surface>
</collision>
<visual name='visual'>
<geometry>
<box>
<size>0.01 0.01 0.01</size>
</box>
</geometry>
</visual>
<sensor name='camera' type='camera'>
<update_rate>30.0</update_rate>
<always_on>1</always_on>
<visualize>1</visualize>
<camera name="camera">
<horizontal_fov>1.3962634</horizontal_fov>
<image>
<width>800</width>
<height>800</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.02</near>
<far>300</far>
</clip>
<distortion>
<k1>0.0</k1>
<k2>0.0</k2>
<k3>0.0</k3>
<p1>0.0</p1>
<p2>0.0</p2>
<center>0.5 0.5</center>
</distortion>
</camera>
<plugin filename="libgazebo_ros_camera.so" name="camera_controller">
<ros>
<namespace>/bocbot</namespace>
<argument>camera/image_raw:=/bocbot/camera/image</argument>
<argument>camera ...