Robotics StackExchange | Archived questions

Drawing camera frustum in RViz using tf and Visualization Marker

I am trying to draw the camera frustum in RViz using Visualization Markers, specifically the Line Strip (LINE_STRIP=4) marker in Python. I have a rosbag file that contains:

types:       tf2_msgs/TFMessage
topics:      /tf   366 msgs    : tf2_msgs/TFMessage

I would like to draw a frustum that moves with base_link frame, basically indicating my camera's frustum, something like this (red lines indicate camera frustum):

image description

I got the above image from the srsuibut ROS package, with this github page.

There is a file called view.cpp in the github repo with directory srspublic/srsuibut/src/butdatafusion/view.cpp that shows how to draw the camera frustum in C++ but I am trying to do this in Python, that too with the frustum being attached to the baselink frame and moving with it.

So far, I looked at this page for seeing an example of how to publish a marker, but it does not show how to make the marker move according to the tf of the baselink. How can I publish a Marker shaped like the camera frustum that moves as though it is attached to the baselink in RViz, in Python? The screenshot below shows the coordinates of my map and baselink, I want the Marker frustum to translate and rotate exactly how the baselink does. Please please help out, thank you.

image description

Asked by hunterlineage1 on 2022-11-30 01:07:09 UTC

Comments

Not an answer, but would jsk_rviz_plugins/camera_info not do this for you?

Asked by gvdhoorn on 2022-11-30 06:16:28 UTC

Thanks for your reply. How do I use jsk_rviz_plugins? As in what is the process of using a plugin with RViz?

Asked by hunterlineage1 on 2022-11-30 12:37:49 UTC

You install the package, (re)start RViz and click Add on the Displays section. Then scroll to where the camera_info display plugin is in the list that pops up, add it and then configure it like any other RViz Display.

Asked by gvdhoorn on 2022-11-30 15:14:31 UTC

I am a beginner -- sorry if this is a silly question, but how do I install the package? Just to confirm, does this link show the correct way to do it? Thank you again.

Asked by hunterlineage1 on 2022-11-30 15:45:23 UTC

Just to confirm, does this link show the correct way to do it?

No. Please stay away from compiling packages yourself whenever possible.

See #q320046.

As a tip: try to use Google to search ROS Answers. Append site:answers.ros.org to your query. I dare to say that over the past 12+ years, just about all questions have been asked here on ROS Answers.

To not have to wait on someone answering yours, try and see whether there is already a post discussing the same topic.

Asked by gvdhoorn on 2022-11-30 16:03:09 UTC

Answers