Can we have the seq number in a ROS Header not incremented by a publish?

asked 2018-06-13 23:36:20 -0600

robot_commander gravatar image

Hi, I noticed that with every rostopic publish, the seq number in the ROS Header is being incremented.

I have a situation where I'm running the robot to get the trajectories, saving them onto a file and then publishing straight onto the /joint_path_command topic, bypassing move_group. And I am using the seq value in the ROS Header to number the plans. But I discovered that it gets incremented every time I publish. Can we have a hack/method where I can make it not increment it? I am using python and rospy.

edit retag flag offensive close merge delete


Have you tried Setting the seq manually? Anyways, I'd not do it like that but rather use a custom message that includes this ID. Worst case Scenario, you have to adapt the Publishing and receiving nodes, or add a converter in between.

mgruhler gravatar image mgruhler  ( 2018-06-14 01:04:40 -0600 )edit

This is not a use-case that seq was introduced for, and in any case, the usage of the field has been deprecated (and it's even been removed in ROS2, see some earlier Q&As about this).

I would suggest to use some additional metadata (in your file?) to encode this information.

gvdhoorn gravatar image gvdhoorn  ( 2018-06-14 01:49:28 -0600 )edit

@mig: well so, yeah. I have resorted to making a custom message to include the plan_id number. I'm unpacking the information in the subscriber side. Thank you for your inputs!

robot_commander gravatar image robot_commander  ( 2018-06-14 12:21:22 -0600 )edit

@gvdhoorn: yes, I realize that this is not the intention/use case of the "seq". Basically I didn't want to change the industrial_robot_client generic package to unpack my custom message, which is why I wanted to use the already available Header in the JointTrajectory.

robot_commander gravatar image robot_commander  ( 2018-06-14 12:28:20 -0600 )edit