How to publish tf from unity

I have successfully imported my robot urdf to unity. Now, I want to know How to publish all robot frame from unity to ros.
I also check Robotics-Nav2-SLAM-Example, I read about ROSTransformTreePublisher.
So, I also copied Clock,TimeStamp,TransformExtensions,TransformTreeNode,ROSTransformTreePublisher c# scripts in my scripts folder. But this has some compilation error. I don't understand how to solve this:

Or is there another way to publish robot tf_tree from unity to ros.
Please help me


It looks like you're trying to use some code that was written for ROS2, but you haven't enabled the ROS2 compiler flag in the Robotics/ROS settings menu.
(Specifically, Header messages have one fewer field in ROS2, which is why you're getting the error about "no argument given" - in ROS1 the HeaderMsg constructor expects an extra argument. There are also some data type differences in the Time and Duration messages, which will be causing the int/uint error.)

@LaurieUnity Thanks for the reply. Is there a way to use this files for ros 1 ? Or maybe any way to publish tf_tree in ros1 from unity.

Sure, it should be fairly simple to get this code working under ROS1 - just fix the compile errors. Pass that extra argument to the HeaderMsg constructor (it's the first argument, "seq" - you can just pass 0), and add an (int) cast to stop it complaining about the uint/int mismatch.

Hi, using ROSTransforTreePublisher to publish some tf I'm facing this problem, gi below.

my tf tree is: odom=>base_footprint=>base_link=>(camera_link, imu_link, lidar_link)

Odom tf is fixed and it's OK.

The misbehavior are the robot's tf, when simulation is running and the robot is moving they get wrong position or getting wrong velocity.

The base_footprint, base_link and the sensor's tf should moving together.


@mig_seixas did you find the reason for this? and the way to solve it?