Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
TaskMoveTo.h@1:08ca9b208045, 2017-03-31 (annotated)
- Committer:
- solcager
- Date:
- Fri Mar 31 11:00:19 2017 +0000
- Revision:
- 1:08ca9b208045
P3
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| solcager | 1:08ca9b208045 | 1 | /* |
| solcager | 1:08ca9b208045 | 2 | * TaskMoveTo.h |
| solcager | 1:08ca9b208045 | 3 | * Copyright (c) 2017, ZHAW |
| solcager | 1:08ca9b208045 | 4 | * All rights reserved. |
| solcager | 1:08ca9b208045 | 5 | */ |
| solcager | 1:08ca9b208045 | 6 | |
| solcager | 1:08ca9b208045 | 7 | #ifndef TASK_MOVE_TO_H_ |
| solcager | 1:08ca9b208045 | 8 | #define TASK_MOVE_TO_H_ |
| solcager | 1:08ca9b208045 | 9 | |
| solcager | 1:08ca9b208045 | 10 | #include <cstdlib> |
| solcager | 1:08ca9b208045 | 11 | #include "Task.h" |
| solcager | 1:08ca9b208045 | 12 | #include "Controller.h" |
| solcager | 1:08ca9b208045 | 13 | |
| solcager | 1:08ca9b208045 | 14 | /** |
| solcager | 1:08ca9b208045 | 15 | * This is a specific implementation of a task class that moves the robot to a given pose. |
| solcager | 1:08ca9b208045 | 16 | */ |
| solcager | 1:08ca9b208045 | 17 | class TaskMoveTo : public Task { |
| solcager | 1:08ca9b208045 | 18 | |
| solcager | 1:08ca9b208045 | 19 | public: |
| solcager | 1:08ca9b208045 | 20 | |
| solcager | 1:08ca9b208045 | 21 | static const float DEFAULT_VELOCITY; /**< Default velocity value, given in [m/s]. */ |
| solcager | 1:08ca9b208045 | 22 | static const float DEFAULT_ZONE; /**< Default zone value, given in [m]. */ |
| solcager | 1:08ca9b208045 | 23 | |
| solcager | 1:08ca9b208045 | 24 | TaskMoveTo(Controller& controller, float x, float y, float alpha); |
| solcager | 1:08ca9b208045 | 25 | TaskMoveTo(Controller& controller, float x, float y, float alpha, float velocity); |
| solcager | 1:08ca9b208045 | 26 | TaskMoveTo(Controller& controller, float x, float y, float alpha, float velocity, float zone); |
| solcager | 1:08ca9b208045 | 27 | virtual ~TaskMoveTo(); |
| solcager | 1:08ca9b208045 | 28 | virtual int run(float period); |
| solcager | 1:08ca9b208045 | 29 | |
| solcager | 1:08ca9b208045 | 30 | private: |
| solcager | 1:08ca9b208045 | 31 | |
| solcager | 1:08ca9b208045 | 32 | static const float PI; |
| solcager | 1:08ca9b208045 | 33 | static const float K1; |
| solcager | 1:08ca9b208045 | 34 | static const float K2; |
| solcager | 1:08ca9b208045 | 35 | static const float K3; |
| solcager | 1:08ca9b208045 | 36 | |
| solcager | 1:08ca9b208045 | 37 | Controller& controller; // reference to the controller object to use |
| solcager | 1:08ca9b208045 | 38 | float x; // x coordinate of target position, given in [m] |
| solcager | 1:08ca9b208045 | 39 | float y; // y coordinate of target position, given in [m] |
| solcager | 1:08ca9b208045 | 40 | float alpha; // target orientation, given in [rad] |
| solcager | 1:08ca9b208045 | 41 | float velocity; // maximum translational velocity, given in [m/s] |
| solcager | 1:08ca9b208045 | 42 | float zone; // zone threshold around target position, given in [m] |
| solcager | 1:08ca9b208045 | 43 | }; |
| solcager | 1:08ca9b208045 | 44 | |
| solcager | 1:08ca9b208045 | 45 | #endif /* TASK_MOVE_TO_H_ */ |
| solcager | 1:08ca9b208045 | 46 |