0
$\begingroup$

Rosanswers logo

Hi everyone!

I'm having troubles creating my own TF2 broadcaster to publish a tf from odom to base_link. I'm using a .sdf file in gazebo ignition fortress and not an urdf so i cant use robot_state_publisher, and i think i have to create a custom broadcaster to solve the lack of tf in the odom to base_link frames. I tried following the tutorial at (https://docs.ros.org/en/rolling/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Py.html) but had no success.

I'm using ROS 2 Foxy with ubuntu focal 20.04 and gazebo ignition fortress.

My ign topic list is as follow:

/clock /gazebo/resource_paths /gui/camera/pose /model/prius_hybrid/cmd_vel /model/prius_hybrid/imu /model/prius_hybrid/laserscan /model/prius_hybrid/laserscan/points /model/prius_hybrid/odometry /stats /world/empty/clock /world/empty/dynamic_pose/info /world/empty/model/prius_hybrid/joint_state /world/empty/pose/info /world/empty/scene/deletion /world/empty/scene/info /world/empty/state /world/empty/stats

If i echo the /world/empty/pose/info i got at the prius_hybrid pose the following:

pose { name: "prius_hybrid" id: 8 position { x: 5.43665402911271 y: 2.1081258650307535 z: 0.012649947145117342 } orientation { x: 2.6633471804933985e-09 y: -1.5456830808628278e-08 z: 0.97151594503524608 w: -0.23697419383188628 } }

I'm using ign_bridge to port topics to ros2, echoing the odometry, imu and laser i verified it's all working as it should, like i can view lidar data on rviz2. But if i try to use slam_toolbox for example or robot_localization it misses the odom to base_link tf.

If anyone has any suggestion all help will be appreciated, thanks!


Originally posted by marcelomm103 on ROS Answers with karma: 13 on 2022-05-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The odom->base_link transform is responsible for keeping track of the motion of the robot based on its odometry sensors. This is the primary way that other systems can find the location of the robot in the world. You could use an EKF, like robot_localization, to produce this odometry. Small sidenote: I find this package to be one of the greatest unsung heroes in the ROS/ROS2 ecosystem. It is incredibly flexible, well documented, and does a fantastic job in producing ego motion. It also produces the odom->base_link transform that you seek.


Originally posted by Per Edwardsson with karma: 501 on 2022-05-20

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Joe28965 on 2022-05-20:
Also, C++ and Python tutorials on how to create a broadcaster in Foxy yourself. However, I agree that it's best to use robot_localization in your case.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.