Mavros Offboard example: Visualization of path in rviz

Hello !
I was curious to see the relat time plot of the path of the quadcopter in gazebo. I looked into rviz, however I am unable to view the robot model in rviz. Has anyone done this ? I needed a starting point. I have been following the tutorial mentioned http://gazebosim.org/tutorials?tut=drcsim_visualization&cat=. However installing drcsim is giving me errors, since I am using ROS kinetic. Please can someone help me regarding this ?
Thanks much !

1 Like

Here is the link on how to setup SITL gazebo for PX4: https://dev.px4.io/en/simulation/gazebo.html
I hope that helps!

Thanks much @baumanta ! I tried that, however I was unable to do it.

Ok, it is not really clear to me where you are stuck. Does SITL work for you? Can you start the simulation and see the fcu frame moving in rviz? If not, what did you try and how did it fail?

1 Like

Hello @baumanta ! Yes SITL works for me ! I just want to visualize the trajectory of the quad in rviz. Here is the screenshot of my rviz screen. I see nothing, do I have to attach a marker at my frame to visualize it. Thanks much for your time on this !

Please note that the quadcopter is flying in gazebo.

ok, that looks good so far. Now you only have to add rostopics. In RVIZ go to ADD -> by topic and add what you want to see (e.g. /mavros/local_position/pose)

Thanks much @baumanta ! I tried that earlier, however I do not see anything in rviz. Here is the rviz screen,

It seems like the simulation is running correctly. But you seem to have a frame problem as you can see in the transform error. I suggest you try a few different Global Options -> Fixed frames. And maybe try:

rosrun tf view_frames
evince frames.pdf

This might give us an idea, why it is complaining about a frame called “map”
Because the topic /mavros/local_position/pose should be published in local_origin frame and you set the fixed frame to fcu. It is not clear to me from that why Rviz is looking for a frame called “map”.

1 Like

Thanks much @baumanta ! Yesterday I used map as my fixed frame, and was able to view pose from mavros. However global status had a warning sign. (It goes green only when I choose fcu as my fixed frame). There is some problem with frames. I will check and keep you posted.

i am having same/similar errors as yours,
My setup:
Px4 autopilot sitl, x500_depth vehicle, simulation running on gazebo, and bridged ros-gz for camera and depth camera topics, ROS2 humble
i am aiming to plot a point cloud from my depth camera’s data. or any type of mapping in rviz2 but not able to receive any data except my camera’s image.

i even tried to look for my fixed frame by running commands for my setup (which is currently set to ‘map’.

ros2 run tf2_tools view_frames 

which is returning me a pdf file which is stating No tf data received

DepthCloud -Warning
Message
Expected topic type of ‘sensor_msgs/msg/Image’, saw topic type ‘sensor_msgs/msg/Image’

PointCloud2 - status ok but, nothing is being visualised

Image - status ok and, you can see in screenshot that image is being displayed in image Window below display section. it is from topic /camera

Error at terminal
I am also encountering an error on terminal when i am running depth camera

[INFO] [1735132258.527217640] [rviz]: Message Filter dropping message: frame 'x500_depth_0/OakD-Lite/base_link/IMX214' at time 368.512 for reason 'discarding message because the queue is full'

I’m also facing this issue. Could you help me out? How did you solve the problem of visualizing the robot model in RViz?

Hey veryone this post is very old and both MAVROS and PX4 have come a long way since then and changed drastically. Please open a new post for support.