Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cras::FilterChainNodelet< F > Class Template Reference

A versatile nodelet that can load and run a filter chain. More...

#include <filter_chain_nodelet.hpp>

Inheritance diagram for cras::FilterChainNodelet< F >:
Inheritance graph
[legend]

Public Types

typedef F DataType
 Type of the filtered data. More...
 
typedef ::ros::message_traits::DataType< F > MsgDataType
 Accessor to DataType field of the filtered message type. More...
 

Public Member Functions

void disableFilterPublishers ()
 Disable publishers of single filter results. More...
 
void enableFilterPublishers ()
 Enable publishers of single filter results. More...
 
 FilterChainNodelet (const ::std::string &configNamespace)
 Read ROS parameters, initialize publishers/subscribers, initialize other class members. ROS::init() is assumed to have been called before. Topic "in" is subscribed and "out" is published. More...
 
 FilterChainNodelet (const ::std::string &dataType, const ::std::string &topicIn, const ::std::string &topicFiltered, const ::std::string &configNamespace)
 Read ROS parameters, initialize publishers/subscribers, initialize other class members. ROS::init() is assumed to have been called before. More...
 
 FilterChainNodelet (const ::std::string &topicIn, const ::std::string &topicFiltered, const ::std::string &configNamespace)
 Read ROS parameters, initialize publishers/subscribers, initialize other class members. ROS::init() is assumed to have been called before. More...
 
void setDisabledFilters (::std::unordered_set<::std::string > filters)
 Set which filters are temporarily disabled. More...
 
void setMaxAge (const ::ros::Duration &maxAge)
 Set the maximum age of messages that are accepted and filtered. More...
 
 ~FilterChainNodelet () override
 
- Public Member Functions inherited from cras::Nodelet
 ~Nodelet () override=default
 
- Public Member Functions inherited from cras::NodeletBase<::nodelet::Nodelet >
 ~NodeletBase () override=default
 
- Public Member Functions inherited from nodelet::Nodelet
void init (const std::string &name, const M_string &remapping_args, const V_string &my_argv, ros::CallbackQueueInterface *st_queue=NULL, ros::CallbackQueueInterface *mt_queue=NULL)
 
 Nodelet ()
 
- Public Member Functions inherited from cras::NodeletWithDiagnostics< ::nodelet::Nodelet >
 NodeletWithDiagnostics ()
 
virtual ~NodeletWithDiagnostics ()
 
- Public Member Functions inherited from cras::NodeletWithSharedTfBuffer< ::nodelet::Nodelet >
::cras::NodeletAwareTFBuffergetBuffer () const override
 Get the TF buffer used by the nodelet. If none has been set by setBuffer(), a buffer is automatically created. More...
 
 NodeletWithSharedTfBuffer ()
 
void reset () override
 Reset the TF buffer. If a shared buffer is used, it is not reset by this call and its owner is responsible. More...
 
void setBuffer (const ::std::shared_ptr<::tf2_ros::Buffer > &buffer) override
 Set the TF buffer to be used by the nodelet. If this method is not called, a standalone buffer is created. More...
 
bool usesSharedBuffer () const override
 Whether the buffer set using setBuffer() is used or a standalone buffer has been automatically created. More...
 
virtual ~NodeletWithSharedTfBuffer ()
 
- Public Member Functions inherited from cras::NodeletWithSharedTfBufferInterface
virtual ::cras::NodeletAwareTFBuffergetBuffer () const =0
 Get the TF buffer used by the nodelet. If none has been set by setBuffer(), a buffer is automatically created. More...
 
virtual bool usesSharedBuffer () const =0
 Whether the buffer set using setBuffer() is used or a standalone buffer has been automatically created. More...
 
- Public Member Functions inherited from cras::ThreadNameUpdatingNodelet< ::nodelet::Nodelet >
 ~ThreadNameUpdatingNodelet () override
 
- Public Member Functions inherited from cras::NodeletParamHelper< ::nodelet::Nodelet >
 NodeletParamHelper ()
 
 ~NodeletParamHelper () override
 
- Public Member Functions inherited from cras::ParamHelper
::cras::LogHelperPtr getLogger () const
 Return the log helper used for logging. More...
 
inline ::std::string getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< const char * > &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::std::string getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
ResultType getParam (const ::cras::GetParamAdapter &param, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< const char * > &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
template<typename ResultType , typename ParamServerType = typename ::cras::DefaultParamServerType<ResultType>::type, ::cras::check_get_param_types< ResultType, ParamServerType > * = nullptr>
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::cras::GetParamAdapter &param, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={}) const
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
 ParamHelper (const ::cras::LogHelperPtr &log)
 
void setLogger (const ::cras::LogHelperPtr &logger)
 Set the log helper used for logging. More...
 
virtual ~ParamHelper ()=default
 
- Public Member Functions inherited from cras::HasLogger
::cras::LogHelperConstPtr getCrasLogger () const
 This is the function picked up by CRAS_* logging macros. More...
 
 HasLogger (const ::cras::LogHelperPtr &log)
 Associate the logger with this interface. More...
 
void setCrasLogger (const ::cras::LogHelperPtr &log)
 Set the logger to be used for logging. More...
 
- Public Member Functions inherited from cras::StatefulNodelet< ::nodelet::Nodelet >
bool ok () const override
 Whether it is OK to continue sleeping. If false, a pending sleep() should stop as soon as possible. More...
 
void requestStop () override
 Call this function to request stopping this nodelet. ok() should return false after calling this. It terminates all ongoing sleeps called by this->sleep(). More...
 
void shutdown ()
 
virtual ~StatefulNodelet ()
 
- Public Member Functions inherited from cras::InterruptibleSleepInterface
 InterruptibleSleepInterface ()
 
virtual bool ok () const
 Whether it is OK to continue sleeping. If false, a pending sleep() should stop as soon as possible. More...
 
virtual bool sleep (const ::ros::Duration &duration) const
 Sleep for the given duration or until ok() returns false. More...
 
virtual ~InterruptibleSleepInterface ()
 Destroy the object waiting for a pending sleep() call to finish. More...
 

Protected Member Functions

virtual void connectCb (const ::ros::SingleSubscriberPublisher &)
 Callback called when a new subscriber of the output topic appears. More...
 
virtual void dataCallback (const typename F::ConstPtr &data)
 Callback called when a new message arrives on the input topic. More...
 
virtual void disconnectCb (const ::ros::SingleSubscriberPublisher &)
 Callback called when a subscriber of the output topic disappears. More...
 
void dynreconfCallback (::cras_cpp_common::FilterChainConfig &config, uint32_t)
 Dynamic reconfiguration of parameters. More...
 
virtual void filterFinishedCallback (const F &data, size_t filterNum, const ::std::string &name, const ::std::string &type, bool success)
 Callback called after each filter finishes working on a message. More...
 
virtual void filterStartCallback (const F &data, size_t filterNum, const ::std::string &name, const ::std::string &type)
 Callback called before each filter starts working on a message. More...
 
template<typename T , ::std::enable_if_t<::ros::message_traits::HasHeader< T >::value, bool > = true>
::ros::Time getStamp (const typename T::ConstPtr &data)
 Get timestamp from a message with header. More...
 
template<typename T , ::std::enable_if_t<!::ros::message_traits::HasHeader< T >::value, bool > = true>
::ros::Time getStamp (const typename T::ConstPtr &data)
 Get current time as timestamp of the given message without header. More...
 
void onInit () override
 
void subscribe ()
 Subscribe to the input topic. More...
 
void updateDynamicParams () const
 Update dynamic parameters on the server to correspond to current settings of this nodelet. More...
 
- Protected Member Functions inherited from cras::NodeletBase<::nodelet::Nodelet >
void onInit () override
 
- Protected Member Functions inherited from nodelet::Nodelet
ros::CallbackQueueInterfacegetMTCallbackQueue () const
 
ros::NodeHandlegetMTNodeHandle () const
 
ros::NodeHandlegetMTPrivateNodeHandle () const
 
const V_stringgetMyArgv () const
 
const std::string & getName () const
 
ros::NodeHandlegetNodeHandle () const
 
ros::NodeHandlegetPrivateNodeHandle () const
 
const M_stringgetRemappingArgs () const
 
ros::CallbackQueueInterfacegetSTCallbackQueue () const
 
std::string getSuffixedName (const std::string &suffix) const
 
- Protected Member Functions inherited from cras::NodeletWithDiagnostics< ::nodelet::Nodelet >
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, ::ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ::ros::NodeHandle diagNh, const ::std::string &diagNamespace, ::ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ::ros::NodeHandle diagNh, const ::std::string &diagNamespace, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ::ros::NodeHandle diagNh, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ::ros::NodeHandle diagNh, ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, ::ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, const ::std::string &diagNamespace, ::ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, const ::std::string &diagNamespace, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (::ros::NodeHandle publisherNh, ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, ::ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (const ::std::string &diagNamespace, ::ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (const ::std::string &diagNamespace, const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (const ::std::string &topic, size_t queueSize, bool latch=false)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< Message > > advertiseDiagnosed (ros::AdvertiseOptions &options)
 Advertise a topic and setup up an automatic topic diagnostic task for it. More...
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(), CRAS_SINGLE_ARG(this->getNodeHandle(),), CRAS_SINGLE_ARG(), CRAS_SINGLE_ARG("",))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(), CRAS_SINGLE_ARG(this->getNodeHandle(),), CRAS_SINGLE_ARG(const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace,), CRAS_SINGLE_ARG(defaultDiagParams, diagNamespace,))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(), CRAS_SINGLE_ARG(this->getNodeHandle(),), CRAS_SINGLE_ARG(const ::std::string &diagNamespace,), CRAS_SINGLE_ARG(::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >>(), diagNamespace,))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh,), CRAS_SINGLE_ARG(subscriberNh, diagNh,), CRAS_SINGLE_ARG(), CRAS_SINGLE_ARG("",))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh,), CRAS_SINGLE_ARG(subscriberNh, diagNh,), CRAS_SINGLE_ARG(const ::std::string &diagNamespace,), CRAS_SINGLE_ARG(::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >>(), diagNamespace,))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(::ros::NodeHandle subscriberNh,), CRAS_SINGLE_ARG(subscriberNh, this->getDefaultDiagNh(subscriberNh, ""),), CRAS_SINGLE_ARG(), CRAS_SINGLE_ARG("",))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(::ros::NodeHandle subscriberNh,), CRAS_SINGLE_ARG(subscriberNh, this->getDefaultDiagNh(subscriberNh, diagNamespace),), CRAS_SINGLE_ARG(const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace,), CRAS_SINGLE_ARG(defaultDiagParams, diagNamespace,))
 
 CRAS_NODELET_DIAG_GENERATE_OVERLOADS (CRAS_SINGLE_ARG(::ros::NodeHandle subscriberNh,), CRAS_SINGLE_ARG(subscriberNh, this->getDefaultDiagNh(subscriberNh, diagNamespace),), CRAS_SINGLE_ARG(const ::std::string &diagNamespace,), CRAS_SINGLE_ARG(::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >>(), diagNamespace,))
 
::std::unique_ptr<::cras::DiagnosedPublisher< T > > createDiagnosedPublisher (::ros::NodeHandle nh, const ::std::string &topic, size_t queueSize, const ::std::string &paramNamespace)
 Create a diagnosed publisher for a message type with header. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< T > > createDiagnosedPublisher (::ros::NodeHandle nh, const ::std::string &topic, size_t queueSize, const ::std::string &paramNamespace, const ::ros::Rate &defaultRate)
 Create a diagnosed publisher for a message type with header. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< T > > createDiagnosedPublisher (::ros::NodeHandle nh, const ::std::string &topic, size_t queueSize, const ::std::string &paramNamespace, const ::ros::Rate &defaultRate, const ::ros::Rate &defaultMinRate, const ::ros::Rate &defaultMaxRate)
 Create a diagnosed publisher for a message type without header. More...
 
::ros::NodeHandle getDefaultDiagNh (const ::ros::NodeHandle &pubSubNh, const ::std::string &diagNamespace)
 Get the default node handle for reading diagnostic task configuration. More...
 
::cras::BoundParamHelperPtr getDiagParams (const ::ros::NodeHandle &nh, const ::std::string &diagNamespace, const ::std::string &topic)
 Get the parameters configuring a diagnosed publisher or subscriber. More...
 
::cras::DiagnosticUpdatergetDiagUpdater (bool forceNew=false) const
 Get a diagnostic updater to be used with this nodelet. More...
 
void startDiagTimer () const
 Start periodic updates of the diagnostics updater. More...
 
void startDiagTimer (const ::ros::NodeHandle &nh) const
 Start periodic updates of the diagnostics updater. More...
 
void stopDiagTimer () const
 Stop the automatic updates of the diagnostic updater. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber< Message > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, ::ros::SubscribeOptions &options)
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber< Message > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam< Message > &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, const ::boost::function< void(const ::boost::shared_ptr< Message > &)> &cb, ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber<::cras::BaseMessage< C > > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< C >> &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, const ::boost::function< void(C)> &cb, ::ros::VoidConstPtr obj={}, ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber<::cras::BaseMessage< M > > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, void(*cb)(M), ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber<::cras::BaseMessage< M > > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, void(T::*cb)(M) const, const ::boost::shared_ptr< T > &obj, ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber<::cras::BaseMessage< M > > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, void(T::*cb)(M) const, T *obj, ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber<::cras::BaseMessage< M > > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, void(T::*cb)(M), const ::boost::shared_ptr< T > &obj, ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber<::cras::BaseMessage< M > > > subscribeDiagnosed (::ros::NodeHandle subscriberNh, ::ros::NodeHandle diagNh, const ::cras::SimpleTopicStatusParam<::cras::BaseMessage< M >> &defaultDiagParams, const ::std::string &diagNamespace, const ::std::string &topic, uint32_t queue_size, void(T::*cb)(M), T *obj, ::ros::TransportHints hints={})
 Subscribe to the given topic, automatically updating the diagnostic task every time a message is received. More...
 
- Protected Member Functions inherited from cras::TimeJumpResettable
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
 
- Protected Member Functions inherited from cras::Resettable
 Resettable (const ::cras::LogHelperPtr &log)
 Create the resettable interface. To also wire up to the reset topics, call initRos(). More...
 
virtual ~Resettable ()
 
- Protected Member Functions inherited from cras::ThreadNameUpdatingNodelet< ::nodelet::Nodelet >
void updateThreadName () const
 Set custom name of the current thread to this nodelet's name. More...
 
- Protected Member Functions inherited from cras::NodeletParamHelper< ::nodelet::Nodelet >
inline ::std::string getParam (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< const char * > &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
ResultType getParam (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::std::string getParam (const ::ros::NodeHandle &node, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
ResultType getParam (const ::ros::NodeHandle &node, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< const char * > &defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ::cras::optional< ResultType > &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value (if not nullopt), and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult<::std::string > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const char *defaultValue, const ::std::string &unit="", const ::cras::GetParamOptions<::std::string > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
inline ::cras::GetParamResult< ResultType > getParamVerbose (const ::ros::NodeHandle &node, const ::std::string &name, const ResultType &defaultValue=ResultType(), const ::std::string &unit="", const ::cras::GetParamOptions< ResultType, ParamServerType > &options={})
 Get the value of the given ROS parameter, falling back to the specified default value, and print out a ROS log message with the loaded values (if specified). More...
 
::cras::BoundParamHelperPtr params (const ::ros::NodeHandle &node, const ::std::string &ns="") const
 Creates a version of this param helper "bound" to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 
::cras::BoundParamHelperPtr paramsForNodeHandle (const ::ros::NodeHandle &node) const
 Creates a version of this param helper "bound" to the given node handle, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 
::cras::BoundParamHelperPtr privateParams (const ::std::string &ns="") const
 Creates a version of this param helper "bound" to the private nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 
::cras::BoundParamHelperPtr publicParams (const ::std::string &ns="") const
 Creates a version of this param helper "bound" to the public nodelet parameters, so that it is not needed to specify the node handle in the subsequent getParam() calls. More...
 

Protected Attributes

::std::unique_ptr<::cras::DurationStatuscallbackDurationDiag
 Diagnostic task for overall callback duration. More...
 
::std::unique_ptr<::cras::FilterChainDiagnostics< F > > chainDiag
 Diagnostic task for overall chain performance. More...
 
mutable ::boost::recursive_mutex configMutex
 Mutex protecting the dynamic reconfigure options, maxAge and publishFilters. More...
 
::std::string configNamespace
 ROS parameter namespace from which filter configuration will be read. More...
 
::std::mutex connectMutex
 Mutex that protects subscriber, subscriberDiag. More...
 
::std::unique_ptr<::dynamic_reconfigure::Server<::cras_cpp_common::FilterChainConfig > > dynreconfServer
 Dynamic reconfigure server. More...
 
::std::unordered_map<::std::string, ::std::unique_ptr<::cras::DurationStatus > > filterCallbackDurationDiags
 Diagnostic tasks for duration of each filter callback. More...
 
::cras::FilterChain< F > filterChain
 The chain of filters to apply to the incoming messages. More...
 
::ros::Publisher filteredPublisher
 Publisher for the filtered data. More...
 
::std::unordered_map<::std::string, ::ros::PublisherfilterPublishers
 Publishers for individual filter results. More...
 
::std::mutex filterPublishersMutex
 Mutex that protects filterPublishers. More...
 
bool lazySubscription {true}
 Whether to use the lazy subscription model (subscribe to input only when someone subscribes to output). More...
 
::ros::Duration maxAge
 Maximum age of a message for it to be considered. Older messages are thrown away when received. More...
 
::ros::NodeHandle nodeHandle
 Public NodeHandle. More...
 
::ros::NodeHandle privateNodeHandle
 Private NodeHandle. More...
 
bool publishChainDiagnostics {false}
 Whether overall chain diagnostics should be published to diagnostics. More...
 
bool publishDurationDiagnostics {false}
 Whether callback duration statistics should be published to diagnostics. More...
 
::std::unique_ptr<::cras::DiagnosedPublisher< F > > publisherDiag
 Publisher diagnostics. More...
 
size_t publisherQueueSize {15_sz}
 Queue size for publishers. More...
 
bool publishFilters {false}
 Whether to create a publisher for each filter. Can be changed during runtime via enableFilterPublishers() More...
 
bool publishTopicDiagnostics {false}
 Whether topic frequency/delay statistics should be published to diagnostics. More...
 
::ros::Subscriber subscriber
 Subscriber to data. More...
 
::std::unique_ptr<::cras::DiagnosedSubscriber< F > > subscriberDiag
 Subscriber diagnostics. More...
 
size_t subscriberQueueSize {15_sz}
 Queue size for subscriber. More...
 
::std::string topicFiltered
 Topic for outgoing (filtered) messages. More...
 
::std::string topicIn
 Topic for incoming messages. More...
 
- Protected Attributes inherited from cras::HasLogger
::cras::LogHelperPtr log
 Log helper. More...
 
- Protected Attributes inherited from cras::InterruptibleSleepInterface
::ros::WallDuration pollDuration {0, 1000000}
 How long to wait between querying the ok() status and other conditions. More...
 

Detailed Description

template<class F>
class cras::FilterChainNodelet< F >

A versatile nodelet that can load and run a filter chain.

Template Parameters
FType of the filtered data.

The following ROS parameters are read:

Subscribed topics:

Published topics:

The following options can be set at runtime via dynamic reconfigure:

Definition at line 99 of file filter_utils/filter_chain_nodelet.hpp.

Member Typedef Documentation

◆ DataType

template<class F >
typedef F cras::FilterChainNodelet< F >::DataType

Type of the filtered data.

Definition at line 103 of file filter_utils/filter_chain_nodelet.hpp.

◆ MsgDataType

Accessor to DataType field of the filtered message type.

Definition at line 106 of file filter_utils/filter_chain_nodelet.hpp.

Constructor & Destructor Documentation

◆ FilterChainNodelet() [1/3]

template<class F >
cras::FilterChainNodelet< F >::FilterChainNodelet ( const ::std::string &  dataType,
const ::std::string &  topicIn,
const ::std::string &  topicFiltered,
const ::std::string &  configNamespace 
)

Read ROS parameters, initialize publishers/subscribers, initialize other class members. ROS::init() is assumed to have been called before.

Parameters
[in]dataTypeType of the filtered messages.
[in]topicInInput topic.
[in]topicFilteredOutput topic.
[in]configNamespaceROS parameter namespace from which configuration should be read.

◆ FilterChainNodelet() [2/3]

template<class F >
cras::FilterChainNodelet< F >::FilterChainNodelet ( const ::std::string &  topicIn,
const ::std::string &  topicFiltered,
const ::std::string &  configNamespace 
)

Read ROS parameters, initialize publishers/subscribers, initialize other class members. ROS::init() is assumed to have been called before.

Parameters
[in]topicInInput topic.
[in]topicFilteredOutput topic.
[in]configNamespaceROS parameter namespace from which configuration should be read.

◆ FilterChainNodelet() [3/3]

template<class F >
cras::FilterChainNodelet< F >::FilterChainNodelet ( const ::std::string &  configNamespace)
explicit

Read ROS parameters, initialize publishers/subscribers, initialize other class members. ROS::init() is assumed to have been called before. Topic "in" is subscribed and "out" is published.

Parameters
[in]configNamespaceROS parameter namespace from which configuration should be read.

◆ ~FilterChainNodelet()

template<class F >
cras::FilterChainNodelet< F >::~FilterChainNodelet ( )
override

Member Function Documentation

◆ connectCb()

template<class F >
virtual void cras::FilterChainNodelet< F >::connectCb ( const ::ros::SingleSubscriberPublisher )
protectedvirtual

Callback called when a new subscriber of the output topic appears.

◆ dataCallback()

template<class F >
virtual void cras::FilterChainNodelet< F >::dataCallback ( const typename F::ConstPtr &  data)
protectedvirtual

Callback called when a new message arrives on the input topic.

Parameters
[in]dataThe received message.
Note
This is the function that calls FilterChain.update(). If a child class overrides this method, it is responsible for calling the update function.

◆ disableFilterPublishers()

template<class F >
void cras::FilterChainNodelet< F >::disableFilterPublishers ( )

Disable publishers of single filter results.

◆ disconnectCb()

template<class F >
virtual void cras::FilterChainNodelet< F >::disconnectCb ( const ::ros::SingleSubscriberPublisher )
protectedvirtual

Callback called when a subscriber of the output topic disappears.

◆ dynreconfCallback()

template<class F >
void cras::FilterChainNodelet< F >::dynreconfCallback ( ::cras_cpp_common::FilterChainConfig &  config,
uint32_t   
)
protected

Dynamic reconfiguration of parameters.

Parameters
[in,out]configThe configuration to apply.

◆ enableFilterPublishers()

template<class F >
void cras::FilterChainNodelet< F >::enableFilterPublishers ( )

Enable publishers of single filter results.

◆ filterFinishedCallback()

template<class F >
virtual void cras::FilterChainNodelet< F >::filterFinishedCallback ( const F &  data,
size_t  filterNum,
const ::std::string &  name,
const ::std::string &  type,
bool  success 
)
protectedvirtual

Callback called after each filter finishes working on a message.

Parameters
[in]dataThe filtered message (after filter application).
[in]filterNumOrder of the applied filter in the chain.
[in]nameName of the applied filter.
[in]typeType of the applied filter.
[in]successWhether the filter succeeded (its update() function returned true).

◆ filterStartCallback()

template<class F >
virtual void cras::FilterChainNodelet< F >::filterStartCallback ( const F &  data,
size_t  filterNum,
const ::std::string &  name,
const ::std::string &  type 
)
protectedvirtual

Callback called before each filter starts working on a message.

Parameters
[in]dataThe filtered message (before filter application).
[in]filterNumOrder of the applied filter in the chain.
[in]nameName of the applied filter.
[in]typeType of the applied filter.

◆ getStamp() [1/2]

template<class F >
template<typename T , ::std::enable_if_t<::ros::message_traits::HasHeader< T >::value, bool > = true>
::ros::Time cras::FilterChainNodelet< F >::getStamp ( const typename T::ConstPtr &  data)
protected

Get timestamp from a message with header.

Template Parameters
TType of the message.
Parameters
[in]dataThe input message.
Returns
message.header.stamp field.

◆ getStamp() [2/2]

template<class F >
template<typename T , ::std::enable_if_t<!::ros::message_traits::HasHeader< T >::value, bool > = true>
::ros::Time cras::FilterChainNodelet< F >::getStamp ( const typename T::ConstPtr &  data)
protected

Get current time as timestamp of the given message without header.

Template Parameters
TType of the message.
Parameters
[in]dataThe input message.
Returns
ros::Time::now() .

◆ onInit()

template<class F >
void cras::FilterChainNodelet< F >::onInit ( )
overrideprotectedvirtual

Implements nodelet::Nodelet.

◆ setDisabledFilters()

template<class F >
void cras::FilterChainNodelet< F >::setDisabledFilters ( ::std::unordered_set<::std::string >  filters)

Set which filters are temporarily disabled.

Parameters
[in]filtersThe filters to disable.

◆ setMaxAge()

template<class F >
void cras::FilterChainNodelet< F >::setMaxAge ( const ::ros::Duration maxAge)

Set the maximum age of messages that are accepted and filtered.

Parameters
[in]maxAgeThe maximum age.

◆ subscribe()

template<class F >
void cras::FilterChainNodelet< F >::subscribe ( )
protected

Subscribe to the input topic.

Note
This method is called either directly from onInit() (if non-lazy subscription is set), or dynamically on output topic (un)subscription (when lazy subscription is set).

◆ updateDynamicParams()

template<class F >
void cras::FilterChainNodelet< F >::updateDynamicParams ( ) const
protected

Update dynamic parameters on the server to correspond to current settings of this nodelet.

Member Data Documentation

◆ callbackDurationDiag

template<class F >
::std::unique_ptr<::cras::DurationStatus> cras::FilterChainNodelet< F >::callbackDurationDiag
protected

Diagnostic task for overall callback duration.

Definition at line 308 of file filter_utils/filter_chain_nodelet.hpp.

◆ chainDiag

template<class F >
::std::unique_ptr<::cras::FilterChainDiagnostics<F> > cras::FilterChainNodelet< F >::chainDiag
protected

Diagnostic task for overall chain performance.

Definition at line 314 of file filter_utils/filter_chain_nodelet.hpp.

◆ configMutex

template<class F >
mutable ::boost::recursive_mutex cras::FilterChainNodelet< F >::configMutex
protected

Mutex protecting the dynamic reconfigure options, maxAge and publishFilters.

Definition at line 302 of file filter_utils/filter_chain_nodelet.hpp.

◆ configNamespace

template<class F >
::std::string cras::FilterChainNodelet< F >::configNamespace
protected

ROS parameter namespace from which filter configuration will be read.

Definition at line 266 of file filter_utils/filter_chain_nodelet.hpp.

◆ connectMutex

template<class F >
::std::mutex cras::FilterChainNodelet< F >::connectMutex
protected

Mutex that protects subscriber, subscriberDiag.

Definition at line 281 of file filter_utils/filter_chain_nodelet.hpp.

◆ dynreconfServer

template<class F >
::std::unique_ptr<::dynamic_reconfigure::Server<::cras_cpp_common::FilterChainConfig> > cras::FilterChainNodelet< F >::dynreconfServer
protected

Dynamic reconfigure server.

Definition at line 305 of file filter_utils/filter_chain_nodelet.hpp.

◆ filterCallbackDurationDiags

template<class F >
::std::unordered_map<::std::string, ::std::unique_ptr<::cras::DurationStatus> > cras::FilterChainNodelet< F >::filterCallbackDurationDiags
protected

Diagnostic tasks for duration of each filter callback.

Definition at line 311 of file filter_utils/filter_chain_nodelet.hpp.

◆ filterChain

template<class F >
::cras::FilterChain<F> cras::FilterChainNodelet< F >::filterChain
protected

The chain of filters to apply to the incoming messages.

Definition at line 251 of file filter_utils/filter_chain_nodelet.hpp.

◆ filteredPublisher

template<class F >
::ros::Publisher cras::FilterChainNodelet< F >::filteredPublisher
protected

Publisher for the filtered data.

Definition at line 254 of file filter_utils/filter_chain_nodelet.hpp.

◆ filterPublishers

template<class F >
::std::unordered_map<::std::string, ::ros::Publisher> cras::FilterChainNodelet< F >::filterPublishers
protected

Publishers for individual filter results.

Definition at line 275 of file filter_utils/filter_chain_nodelet.hpp.

◆ filterPublishersMutex

template<class F >
::std::mutex cras::FilterChainNodelet< F >::filterPublishersMutex
protected

Mutex that protects filterPublishers.

Definition at line 278 of file filter_utils/filter_chain_nodelet.hpp.

◆ lazySubscription

template<class F >
bool cras::FilterChainNodelet< F >::lazySubscription {true}
protected

Whether to use the lazy subscription model (subscribe to input only when someone subscribes to output).

Definition at line 284 of file filter_utils/filter_chain_nodelet.hpp.

◆ maxAge

template<class F >
::ros::Duration cras::FilterChainNodelet< F >::maxAge
protected

Maximum age of a message for it to be considered. Older messages are thrown away when received.

Definition at line 299 of file filter_utils/filter_chain_nodelet.hpp.

◆ nodeHandle

template<class F >
::ros::NodeHandle cras::FilterChainNodelet< F >::nodeHandle
protected

Public NodeHandle.

Definition at line 239 of file filter_utils/filter_chain_nodelet.hpp.

◆ privateNodeHandle

template<class F >
::ros::NodeHandle cras::FilterChainNodelet< F >::privateNodeHandle
protected

Private NodeHandle.

Definition at line 242 of file filter_utils/filter_chain_nodelet.hpp.

◆ publishChainDiagnostics

template<class F >
bool cras::FilterChainNodelet< F >::publishChainDiagnostics {false}
protected

Whether overall chain diagnostics should be published to diagnostics.

Definition at line 296 of file filter_utils/filter_chain_nodelet.hpp.

◆ publishDurationDiagnostics

template<class F >
bool cras::FilterChainNodelet< F >::publishDurationDiagnostics {false}
protected

Whether callback duration statistics should be published to diagnostics.

Definition at line 293 of file filter_utils/filter_chain_nodelet.hpp.

◆ publisherDiag

template<class F >
::std::unique_ptr<::cras::DiagnosedPublisher<F> > cras::FilterChainNodelet< F >::publisherDiag
protected

Publisher diagnostics.

Definition at line 257 of file filter_utils/filter_chain_nodelet.hpp.

◆ publisherQueueSize

template<class F >
size_t cras::FilterChainNodelet< F >::publisherQueueSize {15_sz}
protected

Queue size for publishers.

Definition at line 272 of file filter_utils/filter_chain_nodelet.hpp.

◆ publishFilters

template<class F >
bool cras::FilterChainNodelet< F >::publishFilters {false}
protected

Whether to create a publisher for each filter. Can be changed during runtime via enableFilterPublishers()

Definition at line 269 of file filter_utils/filter_chain_nodelet.hpp.

◆ publishTopicDiagnostics

template<class F >
bool cras::FilterChainNodelet< F >::publishTopicDiagnostics {false}
protected

Whether topic frequency/delay statistics should be published to diagnostics.

Definition at line 290 of file filter_utils/filter_chain_nodelet.hpp.

◆ subscriber

template<class F >
::ros::Subscriber cras::FilterChainNodelet< F >::subscriber
protected

Subscriber to data.

Definition at line 245 of file filter_utils/filter_chain_nodelet.hpp.

◆ subscriberDiag

template<class F >
::std::unique_ptr<::cras::DiagnosedSubscriber<F> > cras::FilterChainNodelet< F >::subscriberDiag
protected

Subscriber diagnostics.

Definition at line 248 of file filter_utils/filter_chain_nodelet.hpp.

◆ subscriberQueueSize

template<class F >
size_t cras::FilterChainNodelet< F >::subscriberQueueSize {15_sz}
protected

Queue size for subscriber.

Definition at line 287 of file filter_utils/filter_chain_nodelet.hpp.

◆ topicFiltered

template<class F >
::std::string cras::FilterChainNodelet< F >::topicFiltered
protected

Topic for outgoing (filtered) messages.

Definition at line 263 of file filter_utils/filter_chain_nodelet.hpp.

◆ topicIn

template<class F >
::std::string cras::FilterChainNodelet< F >::topicIn
protected

Topic for incoming messages.

Definition at line 260 of file filter_utils/filter_chain_nodelet.hpp.


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


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sun Jan 14 2024 03:48:14