|
HoloLib
High-performance holonomic (X-Drive) control library for VEX V5
|
This class exists to simplify the cancellation logic in a motion function. More...
#include <motion_cancel_helper.hpp>
Public Member Functions | |
| MotionCancelHelper (uint32_t period) | |
| Construct a new Motion Cancel Helper object. | |
| bool | wait () |
| wait a certain amount of time | |
| uint32_t | getDelta () |
| Get the amount of time between the current iteration and the last iteration. | |
This class exists to simplify the cancellation logic in a motion function.
Definition at line 10 of file motion_cancel_helper.hpp.
| hololib::MotionCancelHelper::MotionCancelHelper | ( | uint32_t | period | ) |
Construct a new Motion Cancel Helper object.
| period | how often to update (in millis) |
Example:
| bool hololib::MotionCancelHelper::wait | ( | ) |
wait a certain amount of time
This function will return true normally. However, if the task has been notified (the motion handler requests the motion to end), or if the competition state changes, the task will return false, indicating that the motion should end.
This function is meant to be used within the while loop of a motion function. While waiting, other tasks can execute. The amount of time it waits is dependent on how long each iteration of the while loop its in takes. See example below.
Example:
| uint32_t hololib::MotionCancelHelper::getDelta | ( | ) |
Get the amount of time between the current iteration and the last iteration.
Example: