This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathHunterTruckAPI.h
122 lines (107 loc) · 3.38 KB
/
HunterTruckAPI.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* File: HunterTruckAPI.h
* Author: Chris Hajduk
*
* Created on August 26, 2014, 2:48 PM
*/
#ifndef HUNTERTRUCKAPI_H
#define HUNTERTRUCKAPI_H
#ifdef __cplusplus
extern "C" {
#endif
//Includes
#include "OutputCompare.h"
#include "PWM.h"
//Definitions
#define HUNTER_TRUCK_STEERING_SCALE_FACTOR ((float)(UPPER_PWM - MIDDLE_PWM)/MAX_PWM * 0.8)
#define HUNTER_TRUCK_STEERING_OFFSET MIDDLE_PWM
#define HUNTER_TRUCK_THROTTLE_SCALE_FACTOR ((float)(UPPER_PWM - MIDDLE_PWM)/MAX_PWM * 0.8)
#define HUNTER_TRUCK_THROTTLE_OFFSET MIDDLE_PWM + 0//72//18
//Function Prototypes
/*****************************************************************************
* Function: void initTruck();
*
* Preconditions: None.
*
* Overview: Initializes all necessary components for this project.
*
* Input: None.
*
* Output: None.
*
****************************************************************************/
void initTruck();
/*****************************************************************************
* Function: void setSteering(int percent);
*
* Preconditions: The required PWM channel must be initialized (channel 1).
*
* Overview: Controls the steering of the car as a percentage. 100 is full right,
* -100 is full left. 0 is the middle.
*
* Input: int percent -> The percentage representing the direction the front
* (steering) wheels are pointing.
*
* Output: None.
*
****************************************************************************/
void setSteering(int percent);
/*****************************************************************************
* Function: void setThrottle(int percent);
*
* Preconditions: The required PWM channel must be initialized (channel 2).
*
* Overview: Controls the throttle of the car as a percentage. 100 is full throttle.
* 0 is no throttle.
*
* Input: int percent -> The percentage to throttle the motor.
*
* Output: None.
*
****************************************************************************/
void setThrottle(int percent);
/*****************************************************************************
* Function: void background();
*
* Preconditions: None.
*
* Overview: A series of preconfigured background functions needed to be
* completed each program cycle.
*
* Input: None.
*
* Output: None.
*
****************************************************************************/
void background();
/*****************************************************************************
* Function: void readDatalink(void);
*
* Preconditions: The datalink must have been initialized.
*
* Overview: Reads any commands recieved from the ground station, and executes
* the corresponding functions.
*
* Input: None.
*
* Output: None.
*
****************************************************************************/
void readDatalink(void);
/*****************************************************************************
* Function: int writeDatalink(long frequency);
*
* Preconditions: The datalink must have been initialized.
*
* Overview: Writes predetermined data to the datalink at a defined frequency.
*
* Input: long frequency -> The rate at which the datalink should send data in seconds.
*
* Output: None.
*
****************************************************************************/
int writeDatalink(long frequency);
#ifdef __cplusplus
}
#endif
#endif /* HUNTERTRUCKAPI_H */