-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShuttle.h
76 lines (60 loc) · 1.46 KB
/
Shuttle.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
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef SHUTTLE_H__
#define SHUTTLE_H__
#include "DriverInput.h"
#include "Hardware.h"
#include "RAGearToothSensor.h"
#include "PIDController.h"
#include "MotionProfile.h"
#include "Timer.h"
class Shuttle
{
static int ShutPos;
public:
//Actual position modes
static void HomingSequence();
static void ManualMode();
//Stuff
static void Init();
static void Process();
static float GetCommandedPosition()
{
if (m_pid != NULL) { return m_pid->GetSetpoint(); }
else { return m_motor->Get(); }
}
static float GetPosition()
{
if (m_gt != NULL) { return m_gt->GetDistance(); }
else { return 0; }
}
static int GetState()
{
return m_state;
}
static bool DoneWithMove() { return GetState() == 4; }
static bool IsHoming();
static void Reset() {
m_pid->Disable();
m_state = 4;
m_motion_timer->Stop();
m_motion_timer->Reset();
/*
if (m_motion_profile != NULL) {
delete m_motion_profile;
} */
}
private:
static CANJaguar * m_motor;
static RAGearToothSensor * m_gt;
static DigitalInput * m_home_sensor;
static PIDController * m_pid;
static Timer * m_motion_timer;
static MotionProfile * m_motion_profile;
static float m_start_position;
static float m_end_position;
static float m_time_to_move;
static int m_state;
static bool m_manual_override_last;
static void ScheduleMovement(float end_position, float time_to_move);
Shuttle() {} ;
};
#endif