LocalGuidance
A library that generates velocity references to follow a path.
any_node::Node Class Referenceabstract

#include <Node.hpp>

Inheritance diagram for any_node::Node:
Inheritance graph

Public Types

using NodeHandlePtr = std::shared_ptr< ros::NodeHandle >
 

Public Member Functions

 Node ()=delete
 
 Node (NodeHandlePtr nh)
 
virtual ~Node ()=default
 
virtual bool init ()=0
 
virtual void preCleanup ()
 
virtual void cleanup ()=0
 
void shutdown ()
 
template<class T >
bool addWorker (const std::string &name, const double timestep, bool(T::*fp)(const any_worker::WorkerEvent &), T *obj, const int priority=0)
 
bool addWorker (const any_worker::WorkerOptions &options)
 
bool hasWorker (const std::string &name)
 
void cancelWorker (const std::string &name, const bool wait=true)
 
void stopAllWorkers ()
 
ros::NodeHandle & getNodeHandle () const
 
template<typename msg >
ros::Publisher advertise (const std::string &name, const std::string &defaultTopic, uint32_t queue_size, bool latch=false)
 
template<typename msg >
ThreadedPublisherPtr< msg > threadedAdvertise (const std::string &name, const std::string &defaultTopic, uint32_t queue_size, bool latch=false, unsigned int maxMessageBufferSize=10)
 
template<class M , class T >
ros::Subscriber subscribe (const std::string &name, const std::string &defaultTopic, uint32_t queue_size, void(T::*fp)(const boost::shared_ptr< M const > &), T *obj, const ros::TransportHints &transport_hints=ros::TransportHints())
 
template<class M , class T >
ThrottledSubscriberPtr< M, T > throttledSubscribe (double timeStep, const std::string &name, const std::string &defaultTopic, uint32_t queue_size, void(T::*fp)(const boost::shared_ptr< M const > &), T *obj, const ros::TransportHints &transport_hints=ros::TransportHints())
 
template<class T , class MReq , class MRes >
ros::ServiceServer advertiseService (const std::string &name, const std::string &defaultService, bool(T::*srv_func)(MReq &, MRes &), T *obj)
 
template<class MReq , class MRes >
ros::ServiceClient serviceClient (const std::string &name, const std::string &defaultService, const ros::M_string &header_values=ros::M_string())
 
template<class Service >
ros::ServiceClient serviceClient (const std::string &name, const std::string &defaultService, const ros::M_string &header_values=ros::M_string())
 
template<typename ParamT >
bool getParam (const std::string &key, ParamT &param_val)
 
template<typename ParamT >
ParamT param (const std::string &key, const ParamT &defaultValue)
 
template<typename ParamT >
void setParam (const std::string &key, const ParamT &param)
 

Protected Attributes

NodeHandlePtr nh_
 

Private Attributes

any_worker::WorkerManager workerManager_
 

Member Typedef Documentation

using any_node::Node::NodeHandlePtr = std::shared_ptr<ros::NodeHandle>

Constructor & Destructor Documentation

any_node::Node::Node ( )
delete
any_node::Node::Node ( NodeHandlePtr  nh)
virtual any_node::Node::~Node ( )
virtualdefault

Member Function Documentation

template<class T >
bool any_node::Node::addWorker ( const std::string &  name,
const double  timestep,
bool(T::*)(const any_worker::WorkerEvent &)  fp,
T *  obj,
const int  priority = 0 
)
inline

Helper functions to add Workers to the WorkerManager

bool any_node::Node::addWorker ( const any_worker::WorkerOptions options)
inline
template<typename msg >
ros::Publisher any_node::Node::advertise ( const std::string &  name,
const std::string &  defaultTopic,
uint32_t  queue_size,
bool  latch = false 
)
inline
template<class T , class MReq , class MRes >
ros::ServiceServer any_node::Node::advertiseService ( const std::string &  name,
const std::string &  defaultService,
bool(T::*)(MReq &, MRes &)  srv_func,
T *  obj 
)
inline
void any_node::Node::cancelWorker ( const std::string &  name,
const bool  wait = true 
)
inline

Stop a worker managed by the WorkerManager

Parameters
nameName of the worker
waitWhether to wait until the worker has finished or return immediately
virtual void any_node::Node::cleanup ( )
pure virtual

Cleanup function, called by Nodewrap after stopping workers. This function is called even if init() returned false.

Implemented in local_guidance_path_follower::LocalGuidancePathFollower, and local_guidance_path_manager::LocalGuidancePathManager.

ros::NodeHandle& any_node::Node::getNodeHandle ( ) const
inline
template<typename ParamT >
bool any_node::Node::getParam ( const std::string &  key,
ParamT &  param_val 
)
inline
bool any_node::Node::hasWorker ( const std::string &  name)
inline

Check if WorkerManager is managing a Worker with given name

Parameters
nameName of the worker
Returns
True if worker was found
virtual bool any_node::Node::init ( )
pure virtual

Init function, used to initialize all members and starting workers (if any).

Returns
True if successful. Returning false indicates that the node shall shut down.

Implemented in local_guidance_path_follower::LocalGuidancePathFollower, and local_guidance_path_manager::LocalGuidancePathManager.

template<typename ParamT >
ParamT any_node::Node::param ( const std::string &  key,
const ParamT &  defaultValue 
)
inline
virtual void any_node::Node::preCleanup ( )
inlinevirtual

Pre-Cleanup function, which is called by Nodewrap before stopping workers. (Thread safety up to the user!). This function is called even if init() returned false.

template<class MReq , class MRes >
ros::ServiceClient any_node::Node::serviceClient ( const std::string &  name,
const std::string &  defaultService,
const ros::M_string &  header_values = ros::M_string() 
)
inline
template<class Service >
ros::ServiceClient any_node::Node::serviceClient ( const std::string &  name,
const std::string &  defaultService,
const ros::M_string &  header_values = ros::M_string() 
)
inline
template<typename ParamT >
void any_node::Node::setParam ( const std::string &  key,
const ParamT &  param 
)
inline
void any_node::Node::shutdown ( )

Method to signal nodewrap to shutdown the node.

void any_node::Node::stopAllWorkers ( )
inline

Method to stop all workers managed by the WorkerManager

template<class M , class T >
ros::Subscriber any_node::Node::subscribe ( const std::string &  name,
const std::string &  defaultTopic,
uint32_t  queue_size,
void(T::*)(const boost::shared_ptr< M const > &)  fp,
T *  obj,
const ros::TransportHints &  transport_hints = ros::TransportHints() 
)
inline
template<typename msg >
ThreadedPublisherPtr<msg> any_node::Node::threadedAdvertise ( const std::string &  name,
const std::string &  defaultTopic,
uint32_t  queue_size,
bool  latch = false,
unsigned int  maxMessageBufferSize = 10 
)
inline
template<class M , class T >
ThrottledSubscriberPtr<M, T> any_node::Node::throttledSubscribe ( double  timeStep,
const std::string &  name,
const std::string &  defaultTopic,
uint32_t  queue_size,
void(T::*)(const boost::shared_ptr< M const > &)  fp,
T *  obj,
const ros::TransportHints &  transport_hints = ros::TransportHints() 
)
inline

Member Data Documentation

NodeHandlePtr any_node::Node::nh_
protected
any_worker::WorkerManager any_node::Node::workerManager_
private

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