How do I get a tf from specific sensor?
I'm doing a visual servoing aplication. I want a robotic arm to reach a desired position given by camera data. I have 2 cameras in my setup to detect a single apriltag tag. The first camera is fixed far way from the tag and the other one is coupled in the arm.
The fixed camera has a wide range of vision and the arm camera has more precise position data. I want to get the transform between the tag using the data from the arm camera and, if it's not available, then get the data from the fixed camera.
I know the tf msgs have an frame_id in the header. Is it possible to use this id to get the transform?
Now I'm using "lookupTransform('world', tagString, rospy.Time(0))" to get the position but I'm not sure from which camera the data comes from.
Using Ros Melodic and Ubuntu 18.04
---
transforms:
-
header:
seq: 0
stamp:
secs: 207
nsecs: 170049000
frame_id: "sim_camera_arm/armcameraframe_color_optical_frame"
child_frame_id: "tag_2"
transform:
translation:
x: -0.459798174616
y: -0.109403070212
z: 1.45586707359
rotation:
x: 0.884761772023
y: -0.197385909851
z: 0.344390176089
w: 0.244194217728
---
transforms:
-
header:
seq: 0
stamp:
secs: 207
nsecs: 210051000
frame_id: "sim_camera/cameraframe_color_optical_frame"
child_frame_id: "tag_2"
transform:
translation:
x: -0.699637507022
y: -0.524468569595
z: 3.26440053099
rotation:
x: 0.998620267484
y: 0.00357684425666
z: -0.0517392437204
w: 0.0082351814975
---