ros_msg_parser
ros_msg_parser copied to clipboard
Time stamp not getting updated and does not have nsecs in Topic Subscriber
Hi,
I want to record all the data from /gripper/joint_states
topic. But, the value for /gripper/joint_states/header/stamp
key does not change and does not have nsecs
. I am using this to print the data:
printf("--------- %s ----------\n", topic_name.c_str());
for (auto it : deserialized_msg->renamed_vals)
{
const std::string& key = it.first;
double value = it.second;
std::cout << key << " = " << value << std::endl;
}
for (auto it : deserialized_msg->flat_msg.name)
{
const std::string& key = it.first.toStdString();
const std::string& value = it.second;
std::cout << key << " = " << value << std::endl;
}
The output is:
--------- /gripper/joint_states ----------
/gripper/joint_states/header/seq = 2092
/gripper/joint_states/header/stamp = 1.66437e+09
/gripper/joint_states/position.0 = 0.785903
/gripper/joint_states/velocity.0 = 0
/gripper/joint_states/header/frame_id =
/gripper/joint_states/name.0 = gripper_finger1_joint
--------- /gripper/joint_states ----------
/gripper/joint_states/header/seq = 2093
/gripper/joint_states/header/stamp = 1.66437e+09
/gripper/joint_states/position.0 = 0.785903
/gripper/joint_states/velocity.0 = 0
/gripper/joint_states/header/frame_id =
/gripper/joint_states/name.0 = gripper_finger1_joint
But, when I run rostopic echo /gripper/joint_states
, I get this output:
header:
seq: 37982
stamp:
secs: 1664374975
nsecs: 506310939
frame_id: ''
name: [gripper_finger1_joint]
position: [0.0]
velocity: [0.0]
effort: []
---
header:
seq: 37983
stamp:
secs: 1664374975
nsecs: 538561105
frame_id: ''
name: [gripper_finger1_joint]
position: [0.0]
velocity: [0.0]
effort: []
secs
changes after each second and nsecs
also changes for each message, but by using ros_msg_parser
I can't get the updated time stamp. Could you please help?