Tf: refresh broadcaster's sendTransform parameters

asked 2018-02-04 14:39:00 -0500

Steve_RosUsr gravatar image

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.

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);
            tf::Transform(tf::Quaternion(0, 0, 0, 1), tf::Vector3(X_w, Y_w, Z_w)),
            ros::Time::now(),"{W}", "{D}"));


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

edit retag flag offensive close merge delete


GG, thanks

Steve_RosUsr gravatar image Steve_RosUsr  ( 2018-02-07 08:14:27 -0500 )edit