Public Member Functions | Private Attributes | List of all members
cras::TimeJumpResettable Class Reference

Interface for resettable nodes and nodelets. Automatic reset on time jumps. More...

#include <resettable.h>

Inheritance diagram for cras::TimeJumpResettable:
Inheritance graph
[legend]

Public Member Functions

void checkTimeJump ()
 Check if ROS time has not jumped back. If it did, call reset(). More...
 
virtual void checkTimeJump (const ::ros::Time &now)
 Check if ROS time has not jumped back. If it did, call reset(). More...
 
void initRos (const ::ros::NodeHandle &pnh) override
 Initialize the ROS part of the interface - subscriber to /reset and ~reset topics, read time jump limits. More...
 
void startAutoCheckTimeJump ()
 Start a background 1 Hz timer that automatically checks for time jumps. More...
 
virtual void startAutoCheckTimeJump (const ::ros::WallRate &rate)
 Start a background timer that automatically checks for time jumps. More...
 
virtual void stopAutoCheckTimeJump ()
 Stop the timer that automatically checks for time jumps. More...
 
 TimeJumpResettable (const ::cras::LogHelperPtr &log)
 Create the resettable interface. To also wire up to the reset topics and time jump resets, call initRos(). More...
 
 ~TimeJumpResettable () override
 
- Public Member Functions inherited from cras::Resettable
virtual void reset ()=0
 Do the resetting. Subclasses have to implement the logic. More...
 
 Resettable (const ::cras::LogHelperPtr &log)
 Create the resettable interface. To also wire up to the reset topics, call initRos(). More...
 
virtual ~Resettable ()
 

Private Attributes

::std::unique_ptr<::cras::TimeJumpResettablePrivate > data
 Private implementation (PIMPL) data. More...
 

Detailed Description

Interface for resettable nodes and nodelets. Automatic reset on time jumps.

This class reads the following ROS parameters when initRos() is called:

This class subscribes the following topics:

Definition at line 78 of file resettable.h.

Constructor & Destructor Documentation

◆ TimeJumpResettable()

cras::TimeJumpResettable::TimeJumpResettable ( const ::cras::LogHelperPtr log)
explicit

Create the resettable interface. To also wire up to the reset topics and time jump resets, call initRos().

Parameters
[in]logThe logger to use for message logging.

◆ ~TimeJumpResettable()

cras::TimeJumpResettable::~TimeJumpResettable ( )
override

Member Function Documentation

◆ checkTimeJump() [1/2]

void cras::TimeJumpResettable::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.

◆ checkTimeJump() [2/2]

virtual void cras::TimeJumpResettable::checkTimeJump ( const ::ros::Time now)
virtual

Check if ROS time has not jumped back. If it did, call reset().

Parameters
[in]nowThe timestamp that should be interpreted as current time.
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.

◆ initRos()

void cras::TimeJumpResettable::initRos ( const ::ros::NodeHandle pnh)
overridevirtual

Initialize the ROS part of the interface - subscriber to /reset and ~reset topics, read time jump limits.

Parameters
[in]pnhThe (private) node handle to setup the interface for.

Reimplemented from cras::Resettable.

◆ startAutoCheckTimeJump() [1/2]

void cras::TimeJumpResettable::startAutoCheckTimeJump ( )

Start a background 1 Hz timer that automatically checks for time jumps.

◆ startAutoCheckTimeJump() [2/2]

virtual void cras::TimeJumpResettable::startAutoCheckTimeJump ( const ::ros::WallRate rate)
virtual

Start a background timer that automatically checks for time jumps.

Parameters
[in]rateChecking rate

◆ stopAutoCheckTimeJump()

virtual void cras::TimeJumpResettable::stopAutoCheckTimeJump ( )
virtual

Stop the timer that automatically checks for time jumps.

Member Data Documentation

◆ data

::std::unique_ptr<::cras::TimeJumpResettablePrivate> cras::TimeJumpResettable::data
private

Private implementation (PIMPL) data.

Definition at line 126 of file resettable.h.


The documentation for this class was generated from the following file:


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Tue Nov 26 2024 03:49:04