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):
I got the above image from the srs_ui_butROS package, with [this github page.] (https://github.com/ipa320/srs_public)
There is a file called view.cpp in the github repo with directory srs_public/srs_ui_but/src/but_data_fusion/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 base_link 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 base_link. How can I publish a Marker shaped like the camera frustum that moves as though it is attached to the base_link in RViz, in Python? The screenshot below shows the coordinates of my map and base_link, I want the Marker frustum to translate and rotate exactly how the base_link does. Please please help out, thank you.
Not an answer, but would jsk_rviz_plugins/camera_info not do this for you?
Thanks for your reply. How do I use jsk_rviz_plugins? As in what is the process of using a plugin with RViz?
You install the package, (re)start RViz and click
Add
on the Displays section. Then scroll to where thecamera_info
display plugin is in the list that pops up, add it and then configure it like any other RViz Display.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.
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.