Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
environment_monitor.h
Go to the documentation of this file.
1
26#ifndef TESSERACT_ENVIRONMENT_ENVIRONMENT_MONITOR_H
27#define TESSERACT_ENVIRONMENT_ENVIRONMENT_MONITOR_H
28
30#include <chrono>
31
33{
35{
44 DEFAULT = 0,
45
57 SYNCHRONIZED = 1
58};
59
62{
63public:
64 using Ptr = std::shared_ptr<EnvironmentMonitor>;
65 using ConstPtr = std::shared_ptr<const EnvironmentMonitor>;
66 using UPtr = std::unique_ptr<EnvironmentMonitor>;
67 using ConstUPtr = std::unique_ptr<const EnvironmentMonitor>;
68
73 EnvironmentMonitor(std::string monitor_namespace) : monitor_namespace_(monitor_namespace) {}
74
81 : env_(std::move(env)), monitor_namespace_(monitor_namespace)
82 {
83 }
84
85 virtual ~EnvironmentMonitor() = default;
86
88 virtual const std::string& getNamespace() const { return monitor_namespace_; }
89
98
102 virtual const tesseract_environment::Environment& environment() const { return *env_; }
103
112
118
124 virtual bool waitForConnection(std::chrono::duration<double> duration = std::chrono::seconds(0)) const = 0;
125
127 virtual void startPublishingEnvironment() = 0;
128
130 virtual void stopPublishingEnvironment() = 0;
131
133 virtual void setEnvironmentPublishingFrequency(double hz) = 0;
134
136 virtual double getEnvironmentPublishingFrequency() const = 0;
137
143 virtual void startStateMonitor(const std::string& joint_states_topic, bool publish_tf = true) = 0;
144
146 virtual void stopStateMonitor() = 0;
147
154 virtual void setStateUpdateFrequency(double hz = 10) = 0;
155
157 virtual double getStateUpdateFrequency() const = 0;
158
165
170 virtual void startMonitoringEnvironment(const std::string& monitored_namespace,
172
174 virtual void stopMonitoringEnvironment() = 0;
175
182 virtual bool waitForCurrentState(std::chrono::duration<double> duration = std::chrono::seconds(1)) = 0;
183
185 virtual void shutdown() = 0;
186
187protected:
191};
192
193} // namespace tesseract_environment
194#endif // TESSERACT_ENVIRONMENT_ENVIRONMENT_MONITOR_H
Tesseract Environment Monitor Interface Class.
Definition: environment_monitor.h:62
virtual void stopStateMonitor()=0
Stop the state monitor.
EnvironmentMonitor(tesseract_environment::Environment::Ptr env, std::string monitor_namespace)
Constructor.
Definition: environment_monitor.h:80
std::string monitor_namespace_
Definition: environment_monitor.h:189
virtual void setStateUpdateFrequency(double hz=10)=0
Update the scene using the monitored state at a specified frequency, in Hz. This function has an effe...
virtual tesseract_environment::Environment & environment()
Returns an threadsafe reference to the current environment.
Definition: environment_monitor.h:97
virtual void stopMonitoringEnvironment()=0
Stop monitoring the external environment.
virtual const tesseract_environment::Environment & environment() const
Returns an threadsafe const reference to the current environment.
Definition: environment_monitor.h:102
MonitoredEnvironmentMode mode_
Definition: environment_monitor.h:190
virtual void startStateMonitor(const std::string &joint_states_topic, bool publish_tf=true)=0
Start the current state monitor.
std::unique_ptr< const EnvironmentMonitor > ConstUPtr
Definition: environment_monitor.h:67
virtual void stopPublishingEnvironment()=0
Stop publishing the maintained environment.
virtual const std::string & getNamespace() const
Get the namespace of this monitor.
Definition: environment_monitor.h:88
virtual void startMonitoringEnvironment(const std::string &monitored_namespace, MonitoredEnvironmentMode mode=MonitoredEnvironmentMode::DEFAULT)=0
Start the monitoring of an environment topic.
std::shared_ptr< const EnvironmentMonitor > ConstPtr
Definition: environment_monitor.h:65
virtual tesseract_environment::Environment::ConstPtr getEnvironment() const
Returns an threadsafe const shared point to the current environment.
Definition: environment_monitor.h:117
EnvironmentMonitor(std::string monitor_namespace)
Constructor.
Definition: environment_monitor.h:73
tesseract_environment::Environment::Ptr env_
Definition: environment_monitor.h:188
virtual bool waitForConnection(std::chrono::duration< double > duration=std::chrono::seconds(0)) const =0
Wait for connection to upstream environment.
virtual bool waitForCurrentState(std::chrono::duration< double > duration=std::chrono::seconds(1))=0
Wait for robot state to become more recent than time t.
virtual void setEnvironmentPublishingFrequency(double hz)=0
Set the maximum frequency at which environment are being published.
std::shared_ptr< EnvironmentMonitor > Ptr
Definition: environment_monitor.h:64
virtual void updateEnvironmentWithCurrentState()=0
Update the scene using the monitored state. This function is automatically called when an update to t...
virtual tesseract_environment::Environment::Ptr getEnvironment()
Returns an threadsafe shared pointer to the current environment.
Definition: environment_monitor.h:111
std::unique_ptr< EnvironmentMonitor > UPtr
Definition: environment_monitor.h:66
virtual double getStateUpdateFrequency() const =0
Get the maximum frequency (Hz) at which the current state of the planning scene is updated.
virtual void startPublishingEnvironment()=0
Start publishing the maintained environment.
virtual double getEnvironmentPublishingFrequency() const =0
Get the maximum frequency at which environment are published (Hz)
virtual void shutdown()=0
Shutdown advertised services.
Definition: environment.h:65
std::shared_ptr< Environment > Ptr
Definition: environment.h:71
std::shared_ptr< const Environment > ConstPtr
Definition: environment.h:72
Definition: command.h:39
MonitoredEnvironmentMode
Definition: environment_monitor.h:35
@ SYNCHRONIZED
The synchronized behavior when monitoring another environment is the following.
@ DEFAULT
The default behavior when monitoring another environment is the following.
auto env
Definition: tesseract_environment_cache_unit.cpp:67