NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
ff_util::FreeFlyerActionClient< ActionSpec > Class Template Reference

A wrapper class around the simple action client. More...

#include <ff_action.h>

Public Types

typedef std::function< void(FeedbackConstPtr const &) > FeedbackCallbackType
 
typedef std::function< void(FreeFlyerActionState::Enum, ResultConstPtr const &) > ResultCallbackType
 
typedef std::function< void(void) > ConnectedCallbackType
 
typedef std::function< void(void) > ActiveCallbackType
 

Public Member Functions

 ACTION_DEFINITION (ActionSpec)
 
 FreeFlyerActionClient ()
 
 ~FreeFlyerActionClient ()
 
void SetFeedbackCallback (FeedbackCallbackType cb_feedback)
 
void SetResultCallback (ResultCallbackType cb_result)
 
void SetConnectedCallback (ConnectedCallbackType cb_connected)
 
void SetActiveCallback (ActiveCallbackType cb_active)
 
void SetConnectedTimeout (double to_connected)
 
void SetActiveTimeout (double to_active)
 
void SetResponseTimeout (double to_response)
 
void SetDeadlineTimeout (double to_deadline)
 
void SetPollTime (double to_poll)
 
bool Create (ros::NodeHandle *nh, std::string const &topic)
 
bool IsConnected ()
 
bool SendGoal (Goal const &goal)
 
bool CancelGoal ()
 

Protected Member Functions

void StartOptionalTimer (ros::Timer &timer, ros::Duration const &duration)
 
void StopAllTimers ()
 
void Complete (FreeFlyerActionState::Enum state, ResultConstPtr const &result)
 
void ConnectPollCallback (ros::TimerEvent const &event)
 
void ConnectedTimeoutCallback (ros::TimerEvent const &event)
 
void ActiveTimeoutCallback (ros::TimerEvent const &event)
 
void DeadlineTimeoutCallback (ros::TimerEvent const &event)
 
void ResponseTimeoutCallback (ros::TimerEvent const &event)
 
void ActiveCallback ()
 
void FeedbackCallback (FeedbackConstPtr const &feedback)
 
void ResultCallback (actionlib::SimpleClientGoalState const &action_state, ResultConstPtr const &result)
 
void ResultDelayCallback (ros::TimerEvent const &event)
 

Protected Attributes

State state_
 
ros::Duration to_connected_
 
ros::Duration to_active_
 
ros::Duration to_response_
 
ros::Duration to_deadline_
 
ros::Duration to_poll_
 
ros::Duration to_response_delay_
 
std::shared_ptr< actionlib::SimpleActionClient< ActionSpec > > sac_
 
FeedbackCallbackType cb_feedback_
 
ResultCallbackType cb_result_
 
ConnectedCallbackType cb_connected_
 
ActiveCallbackType cb_active_
 
ros::Timer timer_connected_
 
ros::Timer timer_active_
 
ros::Timer timer_response_
 
ros::Timer timer_deadline_
 
ros::Timer timer_poll_
 
ros::Timer timer_response_delay_
 
FreeFlyerActionState::Enum state_response_
 
ResultConstPtr result_
 

Detailed Description

template<class ActionSpec>
class ff_util::FreeFlyerActionClient< ActionSpec >

A wrapper class around the simple action client.

While useful, the simple action client lacks a few features that prove useful in the context of the freeflyer project. Notably, timeouts are not enforced, which leads to the potential situation where the server disappears, and the client remains waiting for a response. To avoid needing to add timers alongside each client, this class internally creates timers to manage the following situations. Zero-values timeouts (default value) are equivalent to no timeout.

  • Connected timeout - server cannot be connected to within some time.
  • Active timeout - server does not accept goal by some time.
  • Response timeout - feedback / result is not received within some time.
  • Deadline timeout - result is not received within some time. Preemption and cancellation of ones own task will never result in a response. This class also allows construction prior to initialization for use within nodelets.

Member Typedef Documentation

◆ ActiveCallbackType

template<class ActionSpec >
typedef std::function< void (void) > ff_util::FreeFlyerActionClient< ActionSpec >::ActiveCallbackType

◆ ConnectedCallbackType

template<class ActionSpec >
typedef std::function< void (void) > ff_util::FreeFlyerActionClient< ActionSpec >::ConnectedCallbackType

◆ FeedbackCallbackType

template<class ActionSpec >
typedef std::function< void (FeedbackConstPtr const&) > ff_util::FreeFlyerActionClient< ActionSpec >::FeedbackCallbackType

◆ ResultCallbackType

template<class ActionSpec >
typedef std::function< void (FreeFlyerActionState::Enum, ResultConstPtr const&) > ff_util::FreeFlyerActionClient< ActionSpec >::ResultCallbackType

Constructor & Destructor Documentation

◆ FreeFlyerActionClient()

template<class ActionSpec >
ff_util::FreeFlyerActionClient< ActionSpec >::FreeFlyerActionClient ( )
inline

◆ ~FreeFlyerActionClient()

template<class ActionSpec >
ff_util::FreeFlyerActionClient< ActionSpec >::~FreeFlyerActionClient ( )
inline

Member Function Documentation

◆ ACTION_DEFINITION()

template<class ActionSpec >
ff_util::FreeFlyerActionClient< ActionSpec >::ACTION_DEFINITION ( ActionSpec  )

◆ ActiveCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ActiveCallback ( )
inlineprotected

◆ ActiveTimeoutCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ActiveTimeoutCallback ( ros::TimerEvent const &  event)
inlineprotected

◆ CancelGoal()

template<class ActionSpec >
bool ff_util::FreeFlyerActionClient< ActionSpec >::CancelGoal ( )
inline

◆ Complete()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::Complete ( FreeFlyerActionState::Enum  state,
ResultConstPtr const &  result 
)
inlineprotected

◆ ConnectedTimeoutCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ConnectedTimeoutCallback ( ros::TimerEvent const &  event)
inlineprotected

◆ ConnectPollCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ConnectPollCallback ( ros::TimerEvent const &  event)
inlineprotected

◆ Create()

template<class ActionSpec >
bool ff_util::FreeFlyerActionClient< ActionSpec >::Create ( ros::NodeHandle *  nh,
std::string const &  topic 
)
inline

◆ DeadlineTimeoutCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::DeadlineTimeoutCallback ( ros::TimerEvent const &  event)
inlineprotected

◆ FeedbackCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::FeedbackCallback ( FeedbackConstPtr const &  feedback)
inlineprotected

◆ IsConnected()

template<class ActionSpec >
bool ff_util::FreeFlyerActionClient< ActionSpec >::IsConnected ( )
inline

◆ ResponseTimeoutCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ResponseTimeoutCallback ( ros::TimerEvent const &  event)
inlineprotected

◆ ResultCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ResultCallback ( actionlib::SimpleClientGoalState const &  action_state,
ResultConstPtr const &  result 
)
inlineprotected

◆ ResultDelayCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::ResultDelayCallback ( ros::TimerEvent const &  event)
inlineprotected

◆ SendGoal()

template<class ActionSpec >
bool ff_util::FreeFlyerActionClient< ActionSpec >::SendGoal ( Goal const &  goal)
inline

◆ SetActiveCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetActiveCallback ( ActiveCallbackType  cb_active)
inline

◆ SetActiveTimeout()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetActiveTimeout ( double  to_active)
inline

◆ SetConnectedCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetConnectedCallback ( ConnectedCallbackType  cb_connected)
inline

◆ SetConnectedTimeout()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetConnectedTimeout ( double  to_connected)
inline

◆ SetDeadlineTimeout()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetDeadlineTimeout ( double  to_deadline)
inline

◆ SetFeedbackCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetFeedbackCallback ( FeedbackCallbackType  cb_feedback)
inline

◆ SetPollTime()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetPollTime ( double  to_poll)
inline

◆ SetResponseTimeout()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetResponseTimeout ( double  to_response)
inline

◆ SetResultCallback()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::SetResultCallback ( ResultCallbackType  cb_result)
inline

◆ StartOptionalTimer()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::StartOptionalTimer ( ros::Timer &  timer,
ros::Duration const &  duration 
)
inlineprotected

◆ StopAllTimers()

template<class ActionSpec >
void ff_util::FreeFlyerActionClient< ActionSpec >::StopAllTimers ( )
inlineprotected

Member Data Documentation

◆ cb_active_

template<class ActionSpec >
ActiveCallbackType ff_util::FreeFlyerActionClient< ActionSpec >::cb_active_
protected

◆ cb_connected_

template<class ActionSpec >
ConnectedCallbackType ff_util::FreeFlyerActionClient< ActionSpec >::cb_connected_
protected

◆ cb_feedback_

template<class ActionSpec >
FeedbackCallbackType ff_util::FreeFlyerActionClient< ActionSpec >::cb_feedback_
protected

◆ cb_result_

template<class ActionSpec >
ResultCallbackType ff_util::FreeFlyerActionClient< ActionSpec >::cb_result_
protected

◆ result_

template<class ActionSpec >
ResultConstPtr ff_util::FreeFlyerActionClient< ActionSpec >::result_
protected

◆ sac_

template<class ActionSpec >
std::shared_ptr< actionlib::SimpleActionClient < ActionSpec > > ff_util::FreeFlyerActionClient< ActionSpec >::sac_
protected

◆ state_

template<class ActionSpec >
State ff_util::FreeFlyerActionClient< ActionSpec >::state_
protected

◆ state_response_

template<class ActionSpec >
FreeFlyerActionState::Enum ff_util::FreeFlyerActionClient< ActionSpec >::state_response_
protected

◆ timer_active_

template<class ActionSpec >
ros::Timer ff_util::FreeFlyerActionClient< ActionSpec >::timer_active_
protected

◆ timer_connected_

template<class ActionSpec >
ros::Timer ff_util::FreeFlyerActionClient< ActionSpec >::timer_connected_
protected

◆ timer_deadline_

template<class ActionSpec >
ros::Timer ff_util::FreeFlyerActionClient< ActionSpec >::timer_deadline_
protected

◆ timer_poll_

template<class ActionSpec >
ros::Timer ff_util::FreeFlyerActionClient< ActionSpec >::timer_poll_
protected

◆ timer_response_

template<class ActionSpec >
ros::Timer ff_util::FreeFlyerActionClient< ActionSpec >::timer_response_
protected

◆ timer_response_delay_

template<class ActionSpec >
ros::Timer ff_util::FreeFlyerActionClient< ActionSpec >::timer_response_delay_
protected

◆ to_active_

template<class ActionSpec >
ros::Duration ff_util::FreeFlyerActionClient< ActionSpec >::to_active_
protected

◆ to_connected_

template<class ActionSpec >
ros::Duration ff_util::FreeFlyerActionClient< ActionSpec >::to_connected_
protected

◆ to_deadline_

template<class ActionSpec >
ros::Duration ff_util::FreeFlyerActionClient< ActionSpec >::to_deadline_
protected

◆ to_poll_

template<class ActionSpec >
ros::Duration ff_util::FreeFlyerActionClient< ActionSpec >::to_poll_
protected

◆ to_response_

template<class ActionSpec >
ros::Duration ff_util::FreeFlyerActionClient< ActionSpec >::to_response_
protected

◆ to_response_delay_

template<class ActionSpec >
ros::Duration ff_util::FreeFlyerActionClient< ActionSpec >::to_response_delay_
protected

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