|
Wiselib
|
Moves a robot forward until a condition occurs. More...
#include <conditional_motion.h>
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_type * | self_pointer_t |
| typedef delegate0< value_t > | condition_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) |
Moves a robot forward until a condition occurs.
Parameters:
| Robot_P | should implement TurnWalkMotion_concept. |
| typedef delegate0<value_t> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::condition_delegate_t |
| typedef OsModel_P wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::OsModel |
| typedef Robot_P wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::Robot |
| typedef self_type* wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::self_pointer_t |
| typedef ConditionalMotion<OsModel_P, Robot_P, Value_P, MAX_RECEIVERS> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::self_type |
| typedef delegate0<void> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::stop_delegate_t |
| typedef vector_static<OsModel, stop_delegate_t, MAX_RECEIVERS> wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::stop_delegates_t |
| typedef Value_P wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::value_t |
| enum wiselib::ConditionalMotion::ErrorCodes |
| enum wiselib::ConditionalMotion::Mode |
| 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.
| int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::destruct | ( | void | ) |
| int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::init | ( | Robot & | robot | ) |
| int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::init | ( | void | ) |
| 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.
| 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.
| 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.
| 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.
| int wiselib::ConditionalMotion< OsModel_P, Robot_P, Value_P, MAX_RECEIVERS >::unreg_stop_callback | ( | typename OsModel::size_t | idx | ) |
1.7.4