Can we have the seq number in a ROS Header not incremented by a publish?
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 /jointpathcommand 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.
Asked by robot_commander on 2018-06-13 23:36:20 UTC
Comments
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.
Asked by mgruhler on 2018-06-14 01:04:40 UTC
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.
Asked by gvdhoorn on 2018-06-14 01:49:28 UTC
@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!
Asked by robot_commander on 2018-06-14 12:21:22 UTC
@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.
Asked by robot_commander on 2018-06-14 12:28:20 UTC