Poses Arithemetic
Let's say I have a PoseStamped in frame 'baselink'. Now I want to do Poses arithmetic: I have a different pose that I know its relations to the previous pose and I want to get its position and orientation in frame 'base link'. An option to do it is to broadcast the first Pose as a frame in tf2ros.TransformBroadcaster() and than use transformPose. But is there an elegant way to do it without publishing the first pose as a frame?
Asked by amit_z on 2021-11-30 04:16:15 UTC
Answers
You don't have to publish the frame out (and then have to wait with the tf subscriber to get what you already know returned back to you), you can create a local tf2 BufferCore and set needed transforms within it then query their relationship as if it was a tf listener buffer. This will be faster, and if you already know how to do tf lookups you can continue to use that interface, avoid any error prone transform math in your node (though you have to be careful with the initial setting of transforms still).
For your particular problem you convert your Poses into Transforms and set them into the buffer core, and you could do a regular tf listener lookup between your base_link and pose1 and set that into the buffer_core, then set your pose1->pose2 transform, after that you can look up base_link->pose2. You could make all the transforms static if nothing is changing over time for the duration you care about.
There isn't a ton of documentation or examples but I've made this (maybe a handful of other answers here): https://github.com/lucasw/tf_demo/blob/master/scripts/buffer_core_demo.py
Asked by lucasw on 2022-04-30 14:05:26 UTC
Comments