-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPSCS_NAV.h
64 lines (52 loc) · 1.38 KB
/
PSCS_NAV.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* @file PSCS_NAV.h
* @author SeungMin Shin, Haneulbit Kim, Chan Lee
* @license This project is released under the MIT License (MIT)
* @copyright Copyright (c) 2018 Asgardia
* @date June 2018
* @brief ...
*/
#ifndef PSCS_NAV_h
#define PSCS_NAV_h
#include "Arduino.h"
#include<Servo.h>
#include<SimpleTimer.h>
class MngNavigation
{
public:
MngNavigation();
void attach(int pin);
void turnWinch(uint16_t microsec);
uint16_t angleToMicrosec(float angle);
private:
int _winch_servo_pin;
Servo _winch_servo;
};
class TskNavigation
{
public:
TskNavigation();
void begin(int pin,void (*winchCallback)());
void updateNavigationParamers(float dist,float bearing, float course,float d_alt);
void updateControlAngle();
void printNavigationInfo();
void setNavigationMode(bool mode);
bool getNavigationMode();
void winchControl(float angle);
void winchNeutral();
float getControlAngle();
void timerRun();
MngNavigation _manager_winch;
private:
float _distance_from_destination;
float _bearing_angle_wrap180;
float _course_angle_wrap180;
float _control_angle;
float _diff_altitude;
uint32_t _winch_angle;
bool _mode; // false: automode, true: manual mode
SimpleTimer _winchTimer;
int _timerId;
void (*_pCallback)(void);
};
#endif