Hi Augusto, <br><br>Could you please ask this on <a href="http://answers.ros.org">answers.ros.org</a>..  This is a nice specific question with one or more answers which another person could learn from.  <br><br>Thanks,<br>

Tully<br><br><div class="gmail_quote">On Tue, May 10, 2011 at 9:51 PM, Augusto Luis Ballardini <span dir="ltr"><<a href="mailto:aballardini@tiscali.it">aballardini@tiscali.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div>Hi everybody, I have a question about frames , transforms and TF. I would like to extend the simples Turtle tf tutorials (<a href="http://www.ros.org/wiki/tf/Tutorials" target="_blank">http://www.ros.org/wiki/tf/Tutorials</a>) based on a 2D space but I'm having a lot of troubles doing it. Unfortunately I didn't find (yet) something on the mailing list or on ros-answers...</div>



<div>I have this 3 frames:</div></div><div><ul><li>world_frame</li><li>odom_frame (with a fixed transform respect to world)</li><li>cart_frame (I move this frame with the odometry data</li></ul><div>Here is the code:</div>



<div><br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

static tf::TransformBroadcaster br;<br>static tf::TransformListener tf_;<br></blockquote><div> </div><div>and this </div><div><br></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



while (ros::ok()){</blockquote><div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>transform.setOrigin(tf::Vector3(3,3,0));<br>transform.setRotation(tf::createQuaternionFromRPY(0.0,0.0,0.0));<br>br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/world", "/odom"));<br>



</blockquote></div><div><br></div><div>here, with updateOdom I calculate the x,y,theta position from the odometry (like the <a href="https://code.ros.org/svn/ros-pkg/branches/trunk_cturtle/stacks/ros_pkg_tutorials/turtle_tf/src/turtle_tf_broadcaster.cpp" target="_blank">tutorial</a>)</div>



<div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

updateOdom(1);</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

try</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

{</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<span style="white-space: pre-wrap;">   </span>transform.setOrigin(tf::Vector3(x,y,0));</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



<span style="white-space: pre-wrap;">   </span>transform.setRotation(tf::createQuaternionFromRPY(0.0,0.0,th));</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



<span style="white-space: pre-wrap;">   </span>br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/odom", "/cart_frame"));</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



}  catch(tf::TransformException e)</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

{<span style="white-space: pre-wrap;">  </span>ROS_WARN("errore transformpose (%s)", e.what()); }</blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



 </blockquote><div><br></div><div>Now what I'm trying to do is move the cart_frame not only with the x+y+th params but with a full 6-dof transform, as if the the cart_frame was moving on a circular garage car ramp, and here starts my question: the simplest way is to add the information to the odometry, so I can call the sendtransform() directly, but what if I had a situation where the odometer always sends only 2D transforms? </div>



<div>In the example I tried to send a transform with a small pitch at the beginning of the while (ros ok())</div><div><br></div><div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



transform.setOrigin(tf::Vector3(3,3,0));<br>transform.setRotation(tf::createQuaternionFromRPY(0.0,0.4,0.0));<br>br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/world", "/odom"));</blockquote>



</div><div><br></div><div>and this is the outcome <a href="http://www.youtube.com/watch?v=d4ktwwukCV0" target="_blank">http://www.youtube.com/watch?v=d4ktwwukCV0</a>, not properly what I want...</div><div><br></div><div>

Ok, probably  I am very tired and confused today but if someone can tell me where I'm wrong I'll be infinitely grateful =)</div>

<div>Thank you </div><div><br></div><font color="#888888"><div>Augusto</div></font></div>
<br>_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Tully Foote<br>Systems Engineer<br>Willow Garage, Inc.<br><a href="mailto:tfoote@willowgarage.com">tfoote@willowgarage.com</a><br>(650) 475-2827<br>