ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Is it possible that you're invoking publication of TF messages from multiple threads? I would suggest to create a single thread per topic you are publishing on and then interace that one with a BlockingQueue, e.g. LinkedBlockingQueue:

    BlockingQueue<tf2_msgs.TFMessage> outQueue = new LinkedBlockingQueue<tf2_msgs.TFMessage>();

and then in your publisher thread loop something along the lines of

@Override
        protected void loop() throws InterruptedException
        {
            TFMessage msg = outQueue.take();                    
            publisher.publish(msg);
        }

This should make the publishing mechanics run in a single thread and protect them from any concurrency issues.