I have a question about URDF models and tf transformations
Hi guys, I was convinced that if one defines, let's say 2 links, in a urdf file and joins them toghether with a joint element, then the physic relations between both links is going to be recognized automatically from tf when reading (parsing) the file at the moment to start the program. So it would be possible - I thought - to listen that transformation in my C++ program.
To make it clearer: I have the following urdf file (of course it is just a barebone example)
##### base_link ##############################################################
<link name="base_link">
<visual>
<origin xyz="0.0 0.0 ${offset_cg_ground}" rpy="${pi/2} 0.0 ${pi}"/>
<geometry>
<mesh filename="package://my_package/my_model.dae"
scale="${scale_factor} ${scale_factor} ${scale_factor}"/>
</geometry>
<material name="grey" >
<color rgba="0.4 0.4 0.5 1.0"/>
</material>
</visual>
</link>
##### base_frame ##############################################################
<link name="base_frame">
<visual>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
<geometry>
<cylinder length="${cylinder_height}" radius="${cylinder_radius}" />
</geometry>
</visual>
<!-- Inertial information is needed for Gazebo or simulation porpuses -->
<inertial>
<mass value="${mass}" />
<origin xyz="0 0 0" />
<inertia ixx="${Ixx}" ixy="${Ixy}" ixz="${Ixz}"
iyy="${Iyy}" iyz="${Iyz}"
izz="${Izz}" />
</inertial>
</link>
which are assembled togheter with the following joint:
<joint name="base_link_2_base_frame" type="fixed">
<parent link="base_link" />
<child link="base_frame" />
<origin xyz="0.0 0.0 ${offset_cg_ground}" rpy="0.0 0.0 0.0"/>
</joint>
Ok??
Now...in my C++ program I m going to broadcast only the transformation between the frames: /odom
and /base_link
. See the following snippet:
...
odom_transform_.header.stamp = ros::Time::now();
odom_transform_.header.frame_id = "/odom";
odom_transform_.child_frame_id = "/base_link";
ros::Rate loop( frequency_main_loop_ );
do
{
/* Time must be always updated */
odom_transform_.header.stamp = ros::Time::now();
/* Broadcast the position and orientation of the quadrotor */
odom_transform_.transform.translation.x = actual_pose_.position.x;
odom_transform_.transform.translation.y = actual_pose_.position.y;
odom_transform_.transform.translation.z = actual_pose_.position.z;
odom_transform_.transform.rotation = actual_pose_.orientation;
broadcaster_.sendTransform( odom_transform_ );
ros::spinOnce();
loop.sleep();
} while( ros::ok() );
...
so no transformatiions between /base_link
and /base_frame
are going to be published in my program since I thought that those frames are fixed and their relative position is already configured in the urdf file.
Now...taking a look to the tf transformation printed in the pdf file I got confirmation that those frames are linked and recognized by tf, BUT I discovered that the command
rosrun tf tf_echo base_link base_frame
outputs the followings statements:
me@YE-166:~/workspace_ros$ rosrun tf tf_echo base_link base_frame
Failure at 254.547000000
Exception thrown:"base_frame" passed to lookupTransform argument source_frame does not exist.
The current list of frames is:
Frame base_link exists with parent odom.
Failure at 254.547000000
Exception thrown:"base_frame" passed to lookupTransform argument source_frame does not exist.
The current list of frames is:
Frame base_link exists with parent odom.
At time 256.020
- Translation: [0.000, 0.000, 0.084]
- Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000]
in RPY [0.000, -0.000, 0.000]
At time 257.020
- Translation: [0.000, 0.000, 0 ...