# Can you update pose of either frame after setting static transform?

I have set up a simple tree: odom->base_link->odom_sensor.

The odom sensor is offset from the centre of the robot and output's Odometry messages in the odom reference frame. I need to transform these messages essentially so they describe the transform between odom and base_link.

I have set a static transform from base_link to odom_sensor and that works well to transform the Odometry Twist messages.

My plan was to use set the transform between the odom and odom_sensor using the Pose from the odometry sensor, then lookup the transform from odom to base_link. (I might have to invert it as lookup_transform returns transform that will transform a pose not a frame).

If I update the TF tree to change odom to base_link I see that the pose of odom_sensor updates as it should. But if I update odom to odom_sensor I find that the pose of base_link doesn't update. Can I not update the pose of the child in the static transform?

I could set a static transform from odom_sensor->base_link, such that the tree was odom->odom_sensor->base_link. But that is a pain, as I have other inputs that can update odom->base_link.

I feel like my best option is to work out how to apply the offset odom_sensor->odom->base_link myself, and then update the tree with odom->base_link afterwards (using the static transform base_link -> odom_sensor to update the pose of odom_sensor).

edit retag close merge delete

Keep in mind that your tf tree must be a tree. Meaning any given frame can have only one parent. Based on the text in your question, it sounds like you might be changing the parent of odom_sensor such that it is sometimes base_link and other times odom. You cannot do this, and if you do all bets are off regarding any future calculations that will require tree parsing. Once you've defined a tree structure, if you need to update transforms the updates should maintain the structure. http://wiki.ros.org/tf/FAQ#Frames_are...
Yes, thank you for confirming. You are essentially right - Odometry from the sensor and for the robot have the world frame (odom) as a parent. I need to compute the Odometry for the robot (in the odom frame) from the sensor Odometry (also in the odom frame), but given the tree is odom->base_link->odom_sensor I can't directly update the pose of the odom_sensor frame in the odom (grandparent) then look up odom to base_link as I hoped.
After much head scratching (and many unit tests) I have now worked out how to do the transformation to account for the offset between the sensor and robot centre. I compute this then update odom->base_link, then (if I need it) the pose of the odom_sensor in odom updates too.