Class TimeJumpResettable
Defined in File resettable.h
Inheritance Relationships
Base Type
public cras::Resettable(Class Resettable)
Derived Types
protected cras::NodeletWithSharedTfBuffer< ::nodelet::Nodelet >(Template Struct NodeletWithSharedTfBuffer)protected cras::NodeletWithSharedTfBuffer< BaseNodelet >(Template Struct NodeletWithSharedTfBuffer)public cras::NodeletManagerSharingTfBuffer(Class NodeletManagerSharingTfBuffer)protected cras::NodeletWithSharedTfBuffer< NodeletType >(Template Struct NodeletWithSharedTfBuffer)
Class Documentation
-
class TimeJumpResettable : public cras::Resettable
Interface for resettable nodes and nodelets. Automatic reset on time jumps.
This class reads the following ROS parameters when initRos() is called:
/jump_back_tolerance(float, default 3.0 s in wall time and 0.0 s in sim time): Threshold for ROS time jump back detection.~jump_back_tolerance(float, default from/jump_back_tolerance): Threshold for ROS time jump back detection.~reset_on_time_jump_back(bool, default True): Whether to call reset() when ROS time jumps back./jump_forward_tolerance(float, default 10.0 s in sim time and max duration in wall time): Threshold for ROS time jump forward detection.~jump_forward_tolerance(float, default from/jump_forward_tolerance): Threshold for ROS time jump forward detection.~reset_on_time_jump_forward(bool, default True in sim time and False in wall time): Whether to call reset() when ROS time jumps forward.
This class subscribes the following topics:
/reset(any type): When a message is received on this topic, reset() is called.~reset(any type): When a message is received on this topic, reset() is called.
Subclassed by cras::NodeletWithSharedTfBuffer< ::nodelet::Nodelet >, cras::NodeletWithSharedTfBuffer< BaseNodelet >, cras::NodeletManagerSharingTfBuffer, cras::NodeletWithSharedTfBuffer< NodeletType >
Public Functions
-
explicit TimeJumpResettable(const ::cras::LogHelperPtr &log)
Create the resettable interface. To also wire up to the reset topics and time jump resets, call initRos().
- Parameters:
log – [in] The logger to use for message logging.
-
~TimeJumpResettable() override
-
void checkTimeJump()
Check if ROS time has not jumped back. If it did, call reset().
Note
This function should be called periodically. Call startAutoCheckTimeJump() to run a timer that will do these periodic calls automatically. Or you can call this function from your callbacks.
-
virtual void checkTimeJump(const ::ros::Time &now)
Check if ROS time has not jumped back. If it did, call reset().
Note
This function should be called periodically. Call startAutoCheckTimeJump() to run a timer that will do these periodic calls automatically. Or you can call this function from your callbacks.
- Parameters:
now – [in] The timestamp that should be interpreted as current time.
-
virtual void initRos(const ::ros::NodeHandle &pnh) override
Initialize the ROS part of the interface - subscriber to /reset and ~reset topics, read time jump limits.
- Parameters:
pnh – [in] The (private) node handle to setup the interface for.
-
void startAutoCheckTimeJump()
Start a background 1 Hz timer that automatically checks for time jumps.
-
virtual void startAutoCheckTimeJump(const ::ros::WallRate &rate)
Start a background timer that automatically checks for time jumps.
- Parameters:
rate – [in] Checking rate
-
virtual void stopAutoCheckTimeJump()
Stop the timer that automatically checks for time jumps.