Mit TaskWait ;-)
TaskMoveTo.h@0:92d57d5d9305, 2018-03-23 (annotated)
- Committer:
- wannesim
- Date:
- Fri Mar 23 15:44:15 2018 +0000
- Revision:
- 0:92d57d5d9305
Mit TaskWait ;-)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wannesim | 0:92d57d5d9305 | 1 | /* |
wannesim | 0:92d57d5d9305 | 2 | * TaskMoveTo.h |
wannesim | 0:92d57d5d9305 | 3 | * Copyright (c) 2018, ZHAW |
wannesim | 0:92d57d5d9305 | 4 | * All rights reserved. |
wannesim | 0:92d57d5d9305 | 5 | */ |
wannesim | 0:92d57d5d9305 | 6 | |
wannesim | 0:92d57d5d9305 | 7 | #ifndef TASK_MOVE_TO_H_ |
wannesim | 0:92d57d5d9305 | 8 | #define TASK_MOVE_TO_H_ |
wannesim | 0:92d57d5d9305 | 9 | |
wannesim | 0:92d57d5d9305 | 10 | #include <cstdlib> |
wannesim | 0:92d57d5d9305 | 11 | #include "Controller.h" |
wannesim | 0:92d57d5d9305 | 12 | #include "Task.h" |
wannesim | 0:92d57d5d9305 | 13 | |
wannesim | 0:92d57d5d9305 | 14 | /** |
wannesim | 0:92d57d5d9305 | 15 | * This is a specific implementation of a task class that moves the robot to a given pose. |
wannesim | 0:92d57d5d9305 | 16 | */ |
wannesim | 0:92d57d5d9305 | 17 | class TaskMoveTo : public Task { |
wannesim | 0:92d57d5d9305 | 18 | |
wannesim | 0:92d57d5d9305 | 19 | public: |
wannesim | 0:92d57d5d9305 | 20 | |
wannesim | 0:92d57d5d9305 | 21 | static const float DEFAULT_VELOCITY; /**< Default velocity value, given in [m/s]. */ |
wannesim | 0:92d57d5d9305 | 22 | static const float DEFAULT_ZONE; /**< Default zone value, given in [m]. */ |
wannesim | 0:92d57d5d9305 | 23 | |
wannesim | 0:92d57d5d9305 | 24 | TaskMoveTo(Controller& controller, float x, float y, float alpha); |
wannesim | 0:92d57d5d9305 | 25 | TaskMoveTo(Controller& controller, float x, float y, float alpha, float velocity); |
wannesim | 0:92d57d5d9305 | 26 | TaskMoveTo(Controller& controller, float x, float y, float alpha, float velocity, float zone); |
wannesim | 0:92d57d5d9305 | 27 | virtual ~TaskMoveTo(); |
wannesim | 0:92d57d5d9305 | 28 | virtual int run(float period); |
wannesim | 0:92d57d5d9305 | 29 | |
wannesim | 0:92d57d5d9305 | 30 | private: |
wannesim | 0:92d57d5d9305 | 31 | |
wannesim | 0:92d57d5d9305 | 32 | static const float PI; |
wannesim | 0:92d57d5d9305 | 33 | static const float K1; |
wannesim | 0:92d57d5d9305 | 34 | static const float K2; |
wannesim | 0:92d57d5d9305 | 35 | static const float K3; |
wannesim | 0:92d57d5d9305 | 36 | |
wannesim | 0:92d57d5d9305 | 37 | Controller& controller; // reference to the controller object to use |
wannesim | 0:92d57d5d9305 | 38 | float x; // x coordinate of target position, given in [m] |
wannesim | 0:92d57d5d9305 | 39 | float y; // y coordinate of target position, given in [m] |
wannesim | 0:92d57d5d9305 | 40 | float alpha; // target orientation, given in [rad] |
wannesim | 0:92d57d5d9305 | 41 | float velocity; // maximum translational velocity, given in [m/s] |
wannesim | 0:92d57d5d9305 | 42 | float zone; // zone threshold around target position, given in [m] |
wannesim | 0:92d57d5d9305 | 43 | }; |
wannesim | 0:92d57d5d9305 | 44 | |
wannesim | 0:92d57d5d9305 | 45 | #endif /* TASK_MOVE_TO_H_ */ |