Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

RVIZ - how to get robot camera positions

Hi all,

Let me start with some background: ROS melodic on Ubuntu 18.04, mostly using python, custom-built differential robot with a Teensy controlling the motor driver and publishing Odometry. Robot has lidar for mapping/nav and cameras for taking inspection pictures. The robot uses a URDF and the robot state publisher to publish offsets.

I have the robot set up to take pictures every 0.2m, there is a custom python node that reads the Odometry and counts 0.2 meters, then sends a ROS message to take pictures. What I want to do is record the absolute positions of all cameras (in their map co-ordinate frames) so that I can use it to generate a panorama later on.

This is where I'm stuck. I can get the relative positions of the cameras (to the base_link) using lookup_transform(). What I cannot seem to figure out is where to find the camera positions in the map (global) frame. If I try:

lookup_transform('map', 'camera1', rospy.Time(0))

I get "Frame id /map does not exist!..."

I know these transforms exist, since in RVIZ when I launch the TF node and expand the camera1 frame it lists both the global and relative positions of camera1 (see image). So I can see it in RVIZ, but how can I access it using python?? Any help would be appreciated!!

image description