Wiselib
Public Types | Public Member Functions
wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS > Class Template Reference

Moves a robot forward until a condition occurs. More...

#include <conditional_motion.h>

List of all members.

Public Types

enum  ErrorCodes { SUCCESS = OsModel::SUCCESS, ERR_UNSPEC = OsModel::ERR_UNSPEC }
enum  Mode { VALUE, NONZERO }
typedef OsModel_P OsModel
typedef Robot_P Robot
typedef Value_P value_t
typedef ConditionalMotion
< OsModel_P, Robot_P, Value_P,
MAX_RECEIVERS > 
self_type
typedef self_typeself_pointer_t
typedef delegate0< value_tcondition_delegate_t
typedef delegate0< void > stop_delegate_t
typedef vector_static< OsModel,
stop_delegate_t, MAX_RECEIVERS > 
stop_delegates_t

Public Member Functions

int init ()
int init (Robot &)
int destruct ()
int move ()
 Move forward until the condition occurs.
int check_condition ()
 Check if the stop condition is fullfilled and stop the robot if so.
void on_state_change (int)
 Supposed to be used as a callback for register_state_callback at a robot.
template<typename T , value_t(T::*)(void) TMethod>
int reg_condition (T *obj, Mode mode, value_t stop_value=value_t())
 Register condition method.
template<typename T , void(T::*)(void) TMethod>
int reg_stop_callback (T *obj)
 The registered method will be called right after check_condition() has stopped the robot.
int unreg_stop_callback (typename OsModel::size_t idx)

Detailed Description

template<typename OsModel_P, typename Robot_P, typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
class wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >

Moves a robot forward until a condition occurs.

Parameters:

Template Parameters:
Robot_Pshould implement TurnWalkMotion_concept.

Member Typedef Documentation

template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef delegate0<value_t> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::condition_delegate_t
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef OsModel_P wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::OsModel
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef Robot_P wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::Robot
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef self_type* wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::self_pointer_t
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef ConditionalMotion<OsModel_P, Robot_P, Value_P, MAX_RECEIVERS> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::self_type
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef delegate0<void> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::stop_delegate_t
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef vector_static<OsModel, stop_delegate_t, MAX_RECEIVERS> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::stop_delegates_t
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
typedef Value_P wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::value_t

Member Enumeration Documentation

template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
enum wiselib::ConditionalMotion::ErrorCodes
Enumerator:
SUCCESS 
ERR_UNSPEC 
template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
enum wiselib::ConditionalMotion::Mode
Enumerator:
VALUE 
NONZERO 

Member Function Documentation

template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::check_condition ( )

Check if the stop condition is fullfilled and stop the robot if so.

See reg_condition() for details.

template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::destruct ( void  )
template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::init ( Robot robot)
template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::init ( void  )
template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::move ( )

Move forward until the condition occurs.

Will return ERR_UNSPEC and not start motion when called before a condition has been set.

template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
void wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::on_state_change ( int  state)

Supposed to be used as a callback for register_state_callback at a robot.

Will call check_condition() if the state indicates there is new data available.

template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
template<typename T , Value_P(T::*)(void) TMethod>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::reg_condition ( T *  obj,
Mode  mode,
value_t  stop_value = value_t() 
)

Register condition method.

When check_condition() is invoked and TMethod() returns the value stop_value, motion will be stopped. TMethod may be 0 in which case the condition will be assumed to hold true as soon as check_condition() is being called.

template<typename OsModel_P , typename Robot_P , typename Value_P , typename OsModel_P::size_t MAX_RECEIVERS>
template<typename T , void(T::*)(void) TMethod>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::reg_stop_callback ( T *  obj)

The registered method will be called right after check_condition() has stopped the robot.

template<typename OsModel_P , typename Robot_P , typename Value_P = int, typename OsModel_P::size_t MAX_RECEIVERS = 16>
int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::unreg_stop_callback ( typename OsModel::size_t  idx)

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines