Rosanswers logo

I am trying to control an ABB 6640 robot through the motion download interface (see here -> 1.3.3 Motion Control -> Subscribed Topics). With a python publisher (built as described here) I publish the following message to the topic /joint_path_command:

  seq: 0
    secs: 0
    nsecs:         0
  frame_id: ''
joint_names: [joint_1, joint_2, joint_3, joint_4, joint_5, joint_6]
    positions: [0, 0, 0, 0, 0, 0]
    velocities: []
    accelerations: []
    effort: []
      secs: 0
      nsecs:         0

I also tried sending the current position of the robot as the first waypoint, but in either way the robot will ignore the first message it is sent. It will only move if the message is send once more after waiting for a little amount of time. Sending the duplicate immediately after the first message will not make it move.

[Edit] The code sending the message:

#!/usr/bin/env python
from trajectory_msgs.msg import *
import rospy

def test():    
    pub = rospy.Publisher('/joint_path_command',JointTrajectory,queue_size=2)
    rate = rospy.Rate(1)

    #while not rospy.is_shutdown():
    for i in range(2):
        msg = JointTrajectory()
        msg.joint_names = ["joint_1","joint_2","joint_3","joint_4","joint_5","joint_6"]
        msg.points = [target]
if __name__ == '__main__':
    except rospy.ROSInterruptException:

I am running ROS Kinetic Kame in an Ubuntu 16.04 64-bit VM. The Windows host runs a Robot Studio instance with a simulated ABB IRB 6640 robot that was prepared as described in the 3 tutorials here. For controlling it I run roscore and roslaunch abb_irb6640_support robot_interface_download_irb6640_185_280.launch robot_ip:=...

What do I need to change to make the robot listen on the first message sent as well?

Originally posted by trhfdntzrtfghdgh on ROS Answers with karma: 3 on 2019-01-22

Post score: 0


1 Answer 1


Rosanswers logo

Can you please show us some code? I suspect you're sending the message "too soon", which leads to your message getting lost, as no subscriber has connected yet.

This is one of the reasons why using the Action server is preferred / recommended: you are guaranteed to receive feedback.


The subscriber is started manually before launching the script - it should have enough time to set up [..]

It's not about the subscriber having time to set up, it's the time needed to establish communication between the publisher and the subscriber.

Your code shows virtually zero time between creating the publisher and publishing the first message, so I would expect it to get lost.

re: get_num_connections(): that should help, yes. Wait until that returns 1 (or as many subscribers that you are expecting / require).

If you're still losing messages, then it could still be that you're publishing too soon. There's nothing specific in the driver that affects any of this, it's all basic roscpp.

Originally posted by gvdhoorn with karma: 86574 on 2019-01-22

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by trhfdntzrtfghdgh on 2019-01-23:
@gvdhoorn I added the full code to my question and will try the action approach. The subscriber is started manually before launching the script - it should have enough time to set up before the first message is sent.

Comment by trhfdntzrtfghdgh on 2019-01-23:
Using the /joint_trajectory_action works as expected (also with only one call). @gvdhoorn Before sending my first message in the topic approach, calling pub.get_num_connections() returns 1, so there is a subscriber connected when I do the call. There also should be only one in my setup.

Comment by trhfdntzrtfghdgh on 2019-01-23:
So there is no way to check if messages can be sent safely (as I'd expect get_num_connections())? Or any recommended time to wait before sending messages?

Comment by gvdhoorn on 2019-01-23:
get_num_connections() should work. Can you show how you are using it?

And it's not a solution, but using the action server is really recommended.

Edit: you don't have a rostopic echo .. running somewhere? That would also count as a subscriber.

Comment by trhfdntzrtfghdgh on 2019-01-23:
I'm sorry, there actually was another subscriber (rqt) running... When shutting down all other subscribers than the /motion_download_interface I see 0 subscribers for the first iteration and one for the second one. So get_num_connections seems to work.

Comment by gvdhoorn on 2019-01-23:
re: rqt: yes, that will interfere here.

Good to hear that we got things sorted out.

Comment by trhfdntzrtfghdgh on 2019-01-23:
Yes, indeed. I wonder why this is not documented. Like this you should expect the official python publisher tutorial (link in question) to not work...
Can I at least be sure that the action will be delivered?

Comment by gvdhoorn on 2019-01-23:
What is not documented?

Can I at least be sure that the action will be delivered?

If you set things up properly and use wait_for_server().

Comment by gvdhoorn on 2019-01-23:
And as always: documentation is either hosted on a wiki, or in API docs generated using Doxygen or Sphinx or some other tool.

ROS is (mostly) a community project. Without community members improving things like documentation, other users are going to run into the same questions again and again.

Comment by trhfdntzrtfghdgh on 2019-01-23:
Ah yes, I forgot about the wait_for_server().
The python publisher/subscriber tutorial lacks a warning that one needs to wait (for an undefined amount of time?!) before publishing a message - at least if you need it delivered. The code shown there also does not wait (that's why I did not).

Comment by gvdhoorn on 2019-01-23:\

The code shown there also does not wait (that's why I did not).

no, it doesn't. But that is because it uses a different approach: it's a periodic publisher. Anon-pub-sub is not really meant for guaranteed delivery of messages. It's fire-and-forget with no guarantees whatsoever. ..

Comment by gvdhoorn on 2019-01-23:
.. If you need guarantees (and feedback), use services (blocking calls and error messages) or actions (asynchronous services with futures and progress callbacks).

Topics are typically used for dataflows where a single lost msg is not a problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.