tf android: No tf data received ??

asked 2016-05-31 07:29:56 -0500

andruino gravatar image

Hi everyone! I'm trying to implement a TF broadcaster in rosjava to transform from base_link to odom with the code shown below. When I run the command "rosrun tf view_frames" tells me "no tf recieved data", but if I run the command "rostopic echo tf" shows time, rotation and translation.

What am i missing?

public class nodo_odom_pub implements NodeMain {

String base_frame_id = "base_link";
String odom_frame_id = "odom";

@Override
public void onStart(final ConnectedNode node) {


    final Publisher<Odometry> publisher = node.newPublisher("/odom", "nav_msgs/Odometry");
    final Publisher<TransformStamped> broadcaster = node.newPublisher("/tf", TransformStamped._TYPE);

        node.executeCancellableLoop(new CancellableLoop() {

        @Override
        protected void setup() {

        }

        protected void loop() throws InterruptedException {

            long time_delta_millis = System.currentTimeMillis(); // - SystemClock.uptimeMillis();

            TransformStamped transform = broadcaster.newMessage();

                            transform.getTransform().getRotation().setX(0);
            transform.getTransform().getRotation().setY(0);
            transform.getTransform().getRotation().setZ(Math.sin(gAzimut / 2));
            transform.getTransform().getRotation().setW(Math.cos(gAzimut / 2));

            transform.getTransform().getTranslation().setX(x);
            transform.getTransform().getTranslation().setY(y);
            transform.getTransform().getTranslation().setZ(0);

            transform.getHeader().setStamp(Time.fromMillis(time_delta_millis));

            transform.setChildFrameId(base_frame_id);
            transform.getHeader().setFrameId(odom_frame_id);

            broadcaster.publish(transform);


        }

    });

}

}

edit retag flag offensive close merge delete