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 /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.
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.
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.
@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!
@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.