Hwo can I transfrom a specific coordinates from frame_A into frame_B?
Hello, I'm using ROS melodic with Ubuntu 18.04.
I need to do a frame-transformation of some coordinates, and I also can make the likely function by myself, but I have a feeling that I should utilize tf2_ros
module.
As far as I know, tf2_ros
has the corresponding method named lookup_transform
according to here.
However, the coordinates I'd like to transform do NOT have a frame_id
, and because I'm not familiar with checking whether the specific frame is practically being broadcast, I'm not sure those poses are existing with its own frame_id
.
(Those poses are /gazebo/model_states
of gazebo_msgs/ModelStates
, actually.)
I also have investigated how to do that, and I think I should broadcast their frame_id
before executing transformation.(And I'm still not sure how to do it.)
What should I do to complete my work?
If anyone who's familiar with this kind of works, would you please teach or give me helpful advice?
Thanks in advance. :)
Hi @kane_choigo,
The
gazebo_msgs/ModelStates
mgs are not stamped msgs thus they do not contain anyheader/frame_id
field. What are you trying to achieve? Specifically what information are you trying to extract from that particular topic?. If you want to know the "real" pose of each model in the Gazebo world you can use a Odometry model plugin (or implement one yourself) that publish odometry and tf inforamtion over ROS.Besides, that partiacular poses are extracted direcly from Gazebo and are assumed to be with respect the internal "world" frame Gazebo has.
@Weasfas Thanks for your quick reply. Of course, I tried adopting
/odom
plugin which is a kind of/odom
topic. But what I want to know is literally the position of spawned model, and/odom
would not bepose
information, I think. When a mobile robot is bumped against a wall and the engineer gives/vel_cmd
command to the robot, the odometry sensor recognizes that the robot is still moving although it practically is stopped, because the inner odometry sensor counts a motor's resolution resulted from/vel_cmd
command. This is the reason that I gave up to useodom
topic. What I want to do is to subscribe to the correct position of each model's pose with theframe_id
. And as you said,/gazebo/model_states
, which includes the correct pose information, doesn't haveframe_id
, so I thought of that it might be possible to broadcast the new ...(more)@kane_choigo, well to do what you want you can implement a Gazebo world plugin, query gazebo for all models in the world and convert the multiple model world poses into indivisual odometry msgs with the
frame_if
of each model. However ,take in mind plugins like the P3D plugin, this is not a standard odometry plugin but a "Ground truth", thus no matter if the robot is colliding with a wall and the motor is sending newcmd_vel
commands the pose will remain the same.