Ho to publish a transform between base_link and map
Hi, I am trying to move a robot through the map in the RVIZ. I have a robot URDF file and also a map. Is it possible to publish a transform between robot base link and map?
By assuming that it is possible, I am trying to is that,
<launch>
<arg name="model" default="$(find robot_description)/urdf/description.urdf"/>
<arg name="gui" default="true" />
<arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />
<param name="use_sim_time" value="false"/>
<param name="robot_description" command="$(find xacro)/xacro $(arg model)" />
<param name="use_gui" value="$(arg gui)" />
<node pkg="map_server" type="map_server" name="map_server" args="$(find lidar_simulation)/map/z_map_canteen_28_03_test1.yaml">
<param name="frame_id" value="map" />
</node>
<node pkg="tf" type="static_transform_publisher" name="base_map" args="0 0 0 0 0 0 /odom /map 100" />
<node pkg="tf" type="static_transform_publisher" name="base_link_odom" args="0 0 0 1.571 0 0 /map /base_link 100" />
<node if="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />
<node unless="$(arg gui)" name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
</launch>
The above is the launch file. When I launch it, the RVIZ opens and can also visualize the robot and the map. example
To move the robot along with the map, I use topic_tools/transform package and publishing the topic with the following commands.
rosrun topic_tools transform /tf /tf tf2_msgs/TFMessage '[std_msgs.msgeader(0, rospy.Time.now(), "/map"), "/base_link", geometry_msgs.msg.Transform(geometry_msgs.msg.Vector3(1,1,0), geometry_msgs.msg.Quaternion(1.571,0,0,1))]' --import rospy std_msgs geometry_msgs
rosrun topic_tools transform /tf /tf tf2_msgs/TFMessage 'geometry_msgs.msg.TransformStamped [std_msgs.msg.Header(0, rospy.Time.now(), "/map"), "/base_link", geometry_msgs.msg.Transform(geometry_msgs.msg.Vector3(1,1,0), geometry_msgs.msg.Quaternion(1.571,0,0,1))]' --import rospy std_msgs geometry_msgs
Since, the /tf topic uses tf2_msgs/TFMessage and, the rosmsg types and details
But this not working by showing the error TypeError: Invalid number of arguments, args should be ['transforms'] args are( ) . Is there any way to move the robot along with the map or also do my currently trying ways correct?
Thanks for your attention.