resettable.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 // SPDX-FileCopyrightText: Czech Technical University in Prague
3 
10 #pragma once
11 
12 #include <memory>
13 
14 #include <ros/node_handle.h>
15 #include <ros/time.h>
16 
18 
19 namespace cras
20 {
21 
22 struct ResettablePrivate;
23 
32 {
33 public:
39  virtual ~Resettable();
40 
44  virtual void reset() = 0;
45 
50  virtual void initRos(const ::ros::NodeHandle& pnh);
51 
52 private:
53  ::std::unique_ptr<::cras::ResettablePrivate> data;
54 };
55 
56 struct TimeJumpResettablePrivate;
57 
79 {
80 public:
86  ~TimeJumpResettable() override;
87 
93  void checkTimeJump();
94 
101  virtual void checkTimeJump(const ::ros::Time& now);
102 
107  void initRos(const ::ros::NodeHandle& pnh) override;
108 
112  void startAutoCheckTimeJump();
113 
118  virtual void startAutoCheckTimeJump(const ::ros::WallRate& rate);
119 
123  virtual void stopAutoCheckTimeJump();
124 
125 private:
126  ::std::unique_ptr<::cras::TimeJumpResettablePrivate> data;
127 };
128 
129 }
node_handle.h
cras::Resettable::data
::std::unique_ptr<::cras::ResettablePrivate > data
Private implementation (PIMPL) data.
Definition: resettable.h:53
cras
Definition: any.hpp:15
time.h
cras::Resettable
Interface for resettable nodes and nodelets.
Definition: resettable.h:31
cras::Resettable::reset
virtual void reset()=0
Do the resetting. Subclasses have to implement the logic.
cras::TimeJumpResettable::~TimeJumpResettable
~TimeJumpResettable() override
cras::Resettable::~Resettable
virtual ~Resettable()
cras::Resettable::Resettable
Resettable(const ::cras::LogHelperPtr &log)
Create the resettable interface. To also wire up to the reset topics, call initRos().
log_utils.h
ROS logging helpers.
cras::TimeJumpResettable::stopAutoCheckTimeJump
virtual void stopAutoCheckTimeJump()
Stop the timer that automatically checks for time jumps.
cras::TimeJumpResettable::startAutoCheckTimeJump
void startAutoCheckTimeJump()
Start a background 1 Hz timer that automatically checks for time jumps.
cras::TimeJumpResettable
Interface for resettable nodes and nodelets. Automatic reset on time jumps.
Definition: resettable.h:78
cras::TimeJumpResettable::data
::std::unique_ptr<::cras::TimeJumpResettablePrivate > data
Private implementation (PIMPL) data.
Definition: resettable.h:126
cras::LogHelperPtr
::cras::LogHelper::Ptr LogHelperPtr
Pointer to LogHelper.
Definition: log_utils.h:202
cras::TimeJumpResettable::checkTimeJump
void checkTimeJump()
Check if ROS time has not jumped back. If it did, call reset().
cras::TimeJumpResettable::initRos
void initRos(const ::ros::NodeHandle &pnh) override
Initialize the ROS part of the interface - subscriber to /reset and ~reset topics,...
cras::TimeJumpResettable::TimeJumpResettable
TimeJumpResettable(const ::cras::LogHelperPtr &log)
Create the resettable interface. To also wire up to the reset topics and time jump resets,...
cras::Resettable::initRos
virtual void initRos(const ::ros::NodeHandle &pnh)
Initialize the ROS part of the interface - subscriber to /reset and ~reset topics.


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