Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
tesseract_environment::EnvironmentMonitor Class Referenceabstract

Tesseract Environment Monitor Interface Class. More...

#include <environment_monitor.h>

Collaboration diagram for tesseract_environment::EnvironmentMonitor:
Collaboration graph
[legend]

Public Types

using Ptr = std::shared_ptr< EnvironmentMonitor >
 
using ConstPtr = std::shared_ptr< const EnvironmentMonitor >
 
using UPtr = std::unique_ptr< EnvironmentMonitor >
 
using ConstUPtr = std::unique_ptr< const EnvironmentMonitor >
 

Public Member Functions

 EnvironmentMonitor (std::string monitor_namespace)
 Constructor. More...
 
 EnvironmentMonitor (tesseract_environment::Environment::Ptr env, std::string monitor_namespace)
 Constructor. More...
 
virtual ~EnvironmentMonitor ()=default
 
virtual const std::string & getNamespace () const
 Get the namespace of this monitor. More...
 
virtual tesseract_environment::Environmentenvironment ()
 Returns an threadsafe reference to the current environment. More...
 
virtual const tesseract_environment::Environmentenvironment () const
 Returns an threadsafe const reference to the current environment. More...
 
virtual tesseract_environment::Environment::Ptr getEnvironment ()
 Returns an threadsafe shared pointer to the current environment. More...
 
virtual tesseract_environment::Environment::ConstPtr getEnvironment () const
 Returns an threadsafe const shared point to the current environment. More...
 
virtual bool waitForConnection (std::chrono::duration< double > duration=std::chrono::seconds(0)) const =0
 Wait for connection to upstream environment. More...
 
virtual void startPublishingEnvironment ()=0
 Start publishing the maintained environment. More...
 
virtual void stopPublishingEnvironment ()=0
 Stop publishing the maintained environment. More...
 
virtual void setEnvironmentPublishingFrequency (double hz)=0
 Set the maximum frequency at which environment are being published. More...
 
virtual double getEnvironmentPublishingFrequency () const =0
 Get the maximum frequency at which environment are published (Hz) More...
 
virtual void startStateMonitor (const std::string &joint_states_topic, bool publish_tf=true)=0
 Start the current state monitor. More...
 
virtual void stopStateMonitor ()=0
 Stop the state monitor. More...
 
virtual void setStateUpdateFrequency (double hz=10)=0
 Update the scene using the monitored state at a specified frequency, in Hz. This function has an effect only when updates from the CurrentStateMonitor are received at a higher frequency. In that case, the updates are throttled down, so that they do not exceed a maximum update frequency specified here. More...
 
virtual double getStateUpdateFrequency () const =0
 Get the maximum frequency (Hz) at which the current state of the planning scene is updated. More...
 
virtual void updateEnvironmentWithCurrentState ()=0
 Update the scene using the monitored state. This function is automatically called when an update to the current state is received (if startStateMonitor() has been called). The updates are throttled to a maximum update frequency however, which is set by setStateUpdateFrequency(). More...
 
virtual void startMonitoringEnvironment (const std::string &monitored_namespace, MonitoredEnvironmentMode mode=MonitoredEnvironmentMode::DEFAULT)=0
 Start the monitoring of an environment topic. More...
 
virtual void stopMonitoringEnvironment ()=0
 Stop monitoring the external environment. More...
 
virtual bool waitForCurrentState (std::chrono::duration< double > duration=std::chrono::seconds(1))=0
 Wait for robot state to become more recent than time t. More...
 
virtual void shutdown ()=0
 Shutdown advertised services. More...
 

Protected Attributes

tesseract_environment::Environment::Ptr env_
 
std::string monitor_namespace_
 
MonitoredEnvironmentMode mode_ { MonitoredEnvironmentMode::DEFAULT }
 

Detailed Description

Tesseract Environment Monitor Interface Class.

Member Typedef Documentation

◆ ConstPtr

◆ ConstUPtr

◆ Ptr

◆ UPtr

Constructor & Destructor Documentation

◆ EnvironmentMonitor() [1/2]

tesseract_environment::EnvironmentMonitor::EnvironmentMonitor ( std::string  monitor_namespace)
inline

Constructor.

Parameters
monitor_namespaceA name identifying this monitor, must be unique

◆ EnvironmentMonitor() [2/2]

tesseract_environment::EnvironmentMonitor::EnvironmentMonitor ( tesseract_environment::Environment::Ptr  env,
std::string  monitor_namespace 
)
inline

Constructor.

Parameters
envThe environment to use internal to the monitor
monitor_namespaceA name identifying this monitor, must be unique

◆ ~EnvironmentMonitor()

virtual tesseract_environment::EnvironmentMonitor::~EnvironmentMonitor ( )
virtualdefault

Member Function Documentation

◆ environment() [1/2]

virtual tesseract_environment::Environment & tesseract_environment::EnvironmentMonitor::environment ( )
inlinevirtual

Returns an threadsafe reference to the current environment.

Modification should only be made if this monitor is the master. If this is monitoring another environment the local changes will get removed on the next update cycle. Recommend using the TesseractMonitorInterface to apply commands to the monitored environment until the todo below is implemented.

Returns
The current environment.

◆ environment() [2/2]

virtual const tesseract_environment::Environment & tesseract_environment::EnvironmentMonitor::environment ( ) const
inlinevirtual

Returns an threadsafe const reference to the current environment.

Returns
The current environment.

◆ getEnvironment() [1/2]

virtual tesseract_environment::Environment::Ptr tesseract_environment::EnvironmentMonitor::getEnvironment ( )
inlinevirtual

Returns an threadsafe shared pointer to the current environment.

Modification should only be made if this monitor is the master. If this is monitoring another environment the local changes will get removed on the next update cycle. Recommend using the TesseractMonitorInterface to apply commands to the monitored environment until the todo below is implemented.

Returns
The current environment.

◆ getEnvironment() [2/2]

virtual tesseract_environment::Environment::ConstPtr tesseract_environment::EnvironmentMonitor::getEnvironment ( ) const
inlinevirtual

Returns an threadsafe const shared point to the current environment.

Returns
The current environment.

◆ getEnvironmentPublishingFrequency()

virtual double tesseract_environment::EnvironmentMonitor::getEnvironmentPublishingFrequency ( ) const
pure virtual

Get the maximum frequency at which environment are published (Hz)

◆ getNamespace()

virtual const std::string & tesseract_environment::EnvironmentMonitor::getNamespace ( ) const
inlinevirtual

Get the namespace of this monitor.

◆ getStateUpdateFrequency()

virtual double tesseract_environment::EnvironmentMonitor::getStateUpdateFrequency ( ) const
pure virtual

Get the maximum frequency (Hz) at which the current state of the planning scene is updated.

◆ setEnvironmentPublishingFrequency()

virtual void tesseract_environment::EnvironmentMonitor::setEnvironmentPublishingFrequency ( double  hz)
pure virtual

Set the maximum frequency at which environment are being published.

◆ setStateUpdateFrequency()

virtual void tesseract_environment::EnvironmentMonitor::setStateUpdateFrequency ( double  hz = 10)
pure virtual

Update the scene using the monitored state at a specified frequency, in Hz. This function has an effect only when updates from the CurrentStateMonitor are received at a higher frequency. In that case, the updates are throttled down, so that they do not exceed a maximum update frequency specified here.

Parameters
hzthe update frequency. By default this is 10Hz.

◆ shutdown()

virtual void tesseract_environment::EnvironmentMonitor::shutdown ( )
pure virtual

Shutdown advertised services.

◆ startMonitoringEnvironment()

virtual void tesseract_environment::EnvironmentMonitor::startMonitoringEnvironment ( const std::string &  monitored_namespace,
MonitoredEnvironmentMode  mode = MonitoredEnvironmentMode::DEFAULT 
)
pure virtual

Start the monitoring of an environment topic.

Parameters
monitored_namespaceThe namespace of the environment to monitor

◆ startPublishingEnvironment()

virtual void tesseract_environment::EnvironmentMonitor::startPublishingEnvironment ( )
pure virtual

Start publishing the maintained environment.

◆ startStateMonitor()

virtual void tesseract_environment::EnvironmentMonitor::startStateMonitor ( const std::string &  joint_states_topic,
bool  publish_tf = true 
)
pure virtual

Start the current state monitor.

Parameters
joint_states_topicthe topic to listen to for joint states
publish_tfIf true, TFs will be published for each joint. Default: true

◆ stopMonitoringEnvironment()

virtual void tesseract_environment::EnvironmentMonitor::stopMonitoringEnvironment ( )
pure virtual

Stop monitoring the external environment.

◆ stopPublishingEnvironment()

virtual void tesseract_environment::EnvironmentMonitor::stopPublishingEnvironment ( )
pure virtual

Stop publishing the maintained environment.

◆ stopStateMonitor()

virtual void tesseract_environment::EnvironmentMonitor::stopStateMonitor ( )
pure virtual

Stop the state monitor.

◆ updateEnvironmentWithCurrentState()

virtual void tesseract_environment::EnvironmentMonitor::updateEnvironmentWithCurrentState ( )
pure virtual

Update the scene using the monitored state. This function is automatically called when an update to the current state is received (if startStateMonitor() has been called). The updates are throttled to a maximum update frequency however, which is set by setStateUpdateFrequency().

◆ waitForConnection()

virtual bool tesseract_environment::EnvironmentMonitor::waitForConnection ( std::chrono::duration< double >  duration = std::chrono::seconds(0)) const
pure virtual

Wait for connection to upstream environment.

Parameters
durationThe time to wait in seconds before returning, if zero it waits indefinitely
Returns
True if it has connected to upstream environment, otherwise false

◆ waitForCurrentState()

virtual bool tesseract_environment::EnvironmentMonitor::waitForCurrentState ( std::chrono::duration< double >  duration = std::chrono::seconds(1))
pure virtual

Wait for robot state to become more recent than time t.

Parameters
durationThe time to wait in seconds

If there is no state monitor active, there will be no scene updates. Hence, you can specify a timeout to wait for those updates. Default is 1s.

Member Data Documentation

◆ env_

tesseract_environment::Environment::Ptr tesseract_environment::EnvironmentMonitor::env_
protected

◆ mode_

MonitoredEnvironmentMode tesseract_environment::EnvironmentMonitor::mode_ { MonitoredEnvironmentMode::DEFAULT }
protected

◆ monitor_namespace_

std::string tesseract_environment::EnvironmentMonitor::monitor_namespace_
protected

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