ROS Answers: Open Source Q&A Forum - RSS feedhttps://answers.ros.org/questions/Open source question and answer forum written in Python and DjangoenROS Answers is licensed under Creative Commons Attribution 3.0Wed, 07 Feb 2018 08:14:27 -0600Tf: refresh broadcaster's sendTransform parametershttps://answers.ros.org/question/281758/tf-refresh-broadcasters-sendtransform-parameters/ Hy Community!
I am really new in ROS tf, but i am starting to be familiar with it. I just need a little help with my thesis work.
I get the main code from this [tutorial](http://wiki.ros.org/navigation/Tutorials/RobotSetup/TF).
double X_w, Y_w, Z_w, theta_dx;
ros::Subscriber operationTopic;
void callbackCallback(const DroneNavigationPackage::TransformParameters::ConstPtr& msg)
{
X_w = msg -> X_w;
Y_w = msg -> Y_w;
Z_w = msg -> Z_w;
theta_dx = msg -> theta_dx;
}
I added this callback function to help my node to fulfill it's task. The goal of this callback function is to refresh the transformation parameters of my Drone's coordinate system related to the world coordinate system (i have an indoor ultrasonic localization system, and i would like to calculate the destination's coordinates in the drone's coordinate system). I get this sensitive data long after my DroneNavigationPackage is started (along with this node too).
ros::init(argc, argv, "w2d_tf_broadcaster");
ros::NodeHandle node;
ros::Rate r(100);
tf::TransformBroadcaster broadcaster;
while( node.ok() )
{
operationTopic = node.subscribe("/ControlCenter/set_transform_params", 100, callbackCallback);
broadcaster.sendTransform(
tf::StampedTransform(
tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(X_w, Y_w, Z_w)),
ros::Time::now(),"{W}", "{D}"));
r.sleep();
}
But the problem is when I send the new values on the topic, the new data does not appear in the broadcasted relation.
So my question is: how can I refresh the sendTransform parameters to their new values? I mean i want to add
- new tf::Vector3 variable
- new tf:Quaternion() variable
to this tf imaging: world -> drone.
Thanks in advance!
Steve
Sun, 04 Feb 2018 14:39:00 -0600https://answers.ros.org/question/281758/tf-refresh-broadcasters-sendtransform-parameters/Comment by Steve_RosUsr for <p>Hy Community!</p>
<p>I am really new in ROS tf, but i am starting to be familiar with it. I just need a little help with my thesis work.
I get the main code from this <a href="http://wiki.ros.org/navigation/Tutorials/RobotSetup/TF">tutorial</a>.</p>
<pre><code>double X_w, Y_w, Z_w, theta_dx;
ros::Subscriber operationTopic;
void callbackCallback(const DroneNavigationPackage::TransformParameters::ConstPtr& msg)
{
X_w = msg -> X_w;
Y_w = msg -> Y_w;
Z_w = msg -> Z_w;
theta_dx = msg -> theta_dx;
}
</code></pre>
<p>I added this callback function to help my node to fulfill it's task. The goal of this callback function is to refresh the transformation parameters of my Drone's coordinate system related to the world coordinate system (i have an indoor ultrasonic localization system, and i would like to calculate the destination's coordinates in the drone's coordinate system). I get this sensitive data long after my DroneNavigationPackage is started (along with this node too).</p>
<pre><code>ros::init(argc, argv, "w2d_tf_broadcaster");
ros::NodeHandle node;
ros::Rate r(100);
tf::TransformBroadcaster broadcaster;
while( node.ok() )
{
operationTopic = node.subscribe("/ControlCenter/set_transform_params", 100, callbackCallback);
broadcaster.sendTransform(
tf::StampedTransform(
tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(X_w, Y_w, Z_w)),
ros::Time::now(),"{W}", "{D}"));
r.sleep();
}
</code></pre>
<p>But the problem is when I send the new values on the topic, the new data does not appear in the broadcasted relation.
So my question is: how can I refresh the sendTransform parameters to their new values? I mean i want to add </p>
<ul>
<li>new tf::Vector3 variable</li>
<li>new tf:Quaternion() variable</li>
</ul>
<p>to this tf imaging: world -> drone.</p>
<p>Thanks in advance!
Steve</p>
https://answers.ros.org/question/281758/tf-refresh-broadcasters-sendtransform-parameters/?comment=282016#post-id-282016GG, thanksWed, 07 Feb 2018 08:14:27 -0600https://answers.ros.org/question/281758/tf-refresh-broadcasters-sendtransform-parameters/?comment=282016#post-id-282016