Publish /tf in data ROS2 Dashing with python
Hi.
I have created a simple .urdf file describing my "robot". I can change the position of the model in the "world_coordinate_system" running "ros2 run tf2_ros static_tranform_publisher" from terminal, describing a transform from "world" to "base_link". ("base_link" describes the model body)
Further I want to create a Node using python that updates the position of the model by publishing the tranform data from "world" to "base_link", but I cant find any good resources on how this is done in ROS2 Dashing.
So far I have tried using geometry_msgs.msg.TransformStamped(), then giving the transform as an input to tf2_msgs.msgTFMessage(), but I cant get it to work.
Do any of you have any examples on how this is done, or a better way to do it?
Thanks in advance, any help as well as links to tutorials or documentation is appriciated!
Have you looked at the tf2 tutorials http://wiki.ros.org/tf2/Tutorials ?
Yes, Ive used the tutorials as a guide, but Im having trouble adapting it to ROS2. Part of the problem Im having is getting the ROS2 equivalent of rospy.time.now().
ROS2 does not have rospy.time.now() but on your nodes you can use get_clock().now().
When I try to use get_clock().now() I get the error "The stamp field must be a sub message of type Time". Why is this? Thanks!
You can use get_clock().now().to_msg() which will return the type of header.stamp
Thanks, that worked. Still not able to broadcast the transform as the tf2_ros package is not available for ROS2. Any tips as for what I should do instead?
Have you installed the package? It's available in all the indexed versions of ROS 2 https://index.ros.org/p/tf2_ros/#eloq...
So it is not supported in Dashing, but in eloquent?