[21] | 1 | // created: 2011/05/01
|
---|
| 2 | // filename: CircleFollower.h
|
---|
| 3 | //
|
---|
| 4 | // author: Guillaume Sanahuja
|
---|
| 5 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 6 | //
|
---|
| 7 | // version: $Id: $
|
---|
| 8 | //
|
---|
| 9 | // purpose: demo cercle avec optitrack
|
---|
| 10 | //
|
---|
| 11 | //
|
---|
| 12 | /*********************************************************************/
|
---|
| 13 |
|
---|
| 14 | #ifndef CIRCLEFOLLOWER_H
|
---|
| 15 | #define CIRCLEFOLLOWER_H
|
---|
| 16 |
|
---|
| 17 | #include <UavStateMachine.h>
|
---|
| 18 |
|
---|
| 19 | namespace framework {
|
---|
| 20 | namespace gui {
|
---|
| 21 | class PushButton;
|
---|
| 22 | }
|
---|
| 23 | namespace filter {
|
---|
| 24 | class TrajectoryGenerator2DCircle;
|
---|
| 25 | }
|
---|
| 26 | namespace meta {
|
---|
| 27 | class MetaVrpnObject;
|
---|
| 28 | }
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | class CircleFollower : public framework::meta::UavStateMachine {
|
---|
| 32 | public:
|
---|
| 33 | CircleFollower(framework::meta::Uav* uav);
|
---|
| 34 | ~CircleFollower();
|
---|
| 35 |
|
---|
| 36 | private:
|
---|
| 37 | enum class BehaviourMode_t {
|
---|
| 38 | Default,
|
---|
| 39 | PositionHold,
|
---|
| 40 | Circle
|
---|
| 41 | };
|
---|
| 42 |
|
---|
| 43 | BehaviourMode_t behaviourMode;
|
---|
| 44 | bool vrpnLost;
|
---|
| 45 |
|
---|
| 46 | void VrpnPositionHold(void);//flight mode
|
---|
| 47 | void StartCircle(void);
|
---|
| 48 | void StopCircle(void);
|
---|
| 49 | void ExtraSecurityCheck(void);
|
---|
| 50 | void ExtraCheckPushButton(void);
|
---|
| 51 | void ExtraCheckJoystick(void);
|
---|
| 52 | const framework::core::AhrsData *GetOrientation(void) const;
|
---|
| 53 | void AltitudeValues(float &z,float &dz);
|
---|
| 54 | void PositionValues(framework::core::Vector2D &pos_error,framework::core::Vector2D &vel_error,float &yaw_ref);
|
---|
| 55 | framework::core::AhrsData *GetReferenceOrientation(void);
|
---|
| 56 | void SignalEvent(Event_t event);
|
---|
| 57 |
|
---|
| 58 | framework::filter::Pid *uX, *uY;
|
---|
| 59 |
|
---|
| 60 | framework::core::Vector2D posHold;
|
---|
| 61 | float yawHold;
|
---|
| 62 |
|
---|
| 63 | framework::gui::PushButton *startCircle,*stopCircle;
|
---|
| 64 | framework::meta::MetaVrpnObject *targetVrpn;
|
---|
| 65 | framework::filter::TrajectoryGenerator2DCircle *circle;
|
---|
| 66 | framework::core::AhrsData *customReferenceOrientation,*customOrientation;
|
---|
| 67 | };
|
---|
| 68 |
|
---|
| 69 | #endif // CIRCLEFOLLOWER_H
|
---|