ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is going to start to sound repetitive -- as I also answered like this in #q407159 -- but: you can't. That's not how this works.

ros::Time (in ROS 1) wraps your system clock, unless it's been setup to use simulation time. See wiki/roscpp/overview/time for more info.

If your node is responsible for publishing Clock messages, you could theoretically do what you ask, but that's not very common, and most likely also not what you should be doing.

And as in #q407159: could you perhaps clarify why you're trying to do this? If you could explain what it is you're actually trying to achieve, perhaps we can provide you with a way to do that.

This is going to start to sound repetitive -- as I also answered like this in #q407159 -- but: you can't. That's not how this works.

ros::Time (in ROS 1) wraps your system clock, unless it's been setup to use simulation time. See wiki/roscpp/overview/time for more info.

If your node is responsible for publishing Clock messages, you could theoretically do what you ask, but that's not very common, and most likely also not what you should be doing.

And as in #q407159: could you perhaps clarify why you're trying to do this? If you could explain what it is you're actually trying to achieve, perhaps we can provide you with a way to do that.


Edit:

I am looking to extract velocity and angular velocity information from the position and orientation information of an AR marker.

Also, I want to reset ros::time::now in order to calculate the micro time to calculate the velocity. I can actually calculate the micro-time without resetting the timer, but I want to set the value of the timer to 0 when the node is executed to make it look better.

I'd suggest using a separate variable to keep track of the passage of time in that case. You don't need to (nor should you want to) "reset ros::time::now" (note: that's a function, not a variable, so it cannot be reset).

Just keep a variable in your algorithm which stores the "previous time" instance, compares it to the current time and calculates delta-t. Then dX/dT (for simple finite differencing).