ASMESDC2018
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
/home/swerve/Github/sdc_2018/omni_robot/RCController6CH.h
Go to the documentation of this file.
1
8
#include <IntervalTimer.h>
9
10
#ifndef RC_CONTROLLER_6CH_H_
11
#define RC_CONTROLLER_6CH_H_
12
13
#define CH_VALUE_MIN 1200 // min PPM signal in microseconds
14
#define CH_VALUE_MAX 1800 // max PPM signal in microseconds
15
16
#define CH_VALUE_MAP_MIN -100 // minimum value to map the RC controller input to
17
#define CH_VALUE_MAP_MAX 100 // maximum value to map the RC controller input to
18
19
#define CH_MAP_TYPE_BINARY 1 // maps channel values to 0 to 1
20
#define CH_MAP_TYPE_UNIDIRECTIONAL 2 // maps channel values to 0 to 100
21
#define CH_MAP_TYPE_BIDIRECTIONAL 3 // maps channel values to -100 to 100
22
23
#define MAX_CHANNELS 6 // max channels of the RC controller
24
25
#define CHANNEL_UPDATE_RATE 100000 // update rate in microseconds
26
#define PULSE_IN_TIMEOUT 100000 // timeout for pulse function in microseconds
27
28
struct
RCController6CHState
{
29
volatile
long
int
timestamp
;
// time of last update
30
volatile
int
value_ch_1
;
31
volatile
int
value_ch_2
;
32
volatile
int
value_ch_3
;
33
volatile
int
value_ch_4
;
34
volatile
int
value_ch_5
;
35
volatile
int
value_ch_6
;
36
volatile
int
*
values
[6] = {&
value_ch_1
, &
value_ch_2
, &
value_ch_3
,
37
&
value_ch_4
, &
value_ch_5
, &value_ch_6};
// iterate through channel values
38
};
39
struct
RCController6CHPins
{
40
int
PIN_CH_1
;
41
int
PIN_CH_2
;
42
int
PIN_CH_3
;
43
int
PIN_CH_4
;
44
int
PIN_CH_5
;
45
int
PIN_CH_6
;
46
int
*PINS[6] = {&
PIN_CH_1
, &PIN_CH_2, &PIN_CH_3, &PIN_CH_4,
47
&PIN_CH_5, &PIN_CH_6};
// iterate through pins
48
};
49
50
class
RCController6CH
{
51
public
:
52
53
/* Constructor Funcitons */
54
RCController6CH
(
int
,
void
(*)());
61
RCController6CH
(
int
,
int
,
int
,
int
,
int
,
int
,
void
(*)());
68
/* Public Funcitons */
69
void
setupController(
void
(*)());
76
void
updateChannels(
void
);
83
void
displayChannels(
void
);
90
protected
:
91
92
RCController6CHState
state
;
93
RCController6CHPins
pins
;
94
95
int
CH_UPDATE_RATE =
CHANNEL_UPDATE_RATE
;
// frequency at which the controller input model is executed
96
97
friend
class
OmniRobot
;
// allow omni robot to access protected variables
98
friend
class
OffenseRobot
;
// allow offense robot to access protected variables
99
100
private
:
101
102
IntervalTimer _interval_timer;
103
104
};
105
106
#endif
/* RC_CONTROLLER_6CH_H_ */
107
108
RCController6CHPins::PIN_CH_5
int PIN_CH_5
Definition:
RCController6CH.h:44
RCController6CHPins::PIN_CH_4
int PIN_CH_4
Definition:
RCController6CH.h:43
RCController6CHPins::PIN_CH_1
int PIN_CH_1
Definition:
RCController6CH.h:40
CHANNEL_UPDATE_RATE
#define CHANNEL_UPDATE_RATE
Definition:
RCController6CH.h:25
RCController6CH
Definition:
RCController6CH.h:50
PIN_CH_1
#define PIN_CH_1
Definition:
OmniRobot.h:27
RCController6CH::state
RCController6CHState state
Definition:
RCController6CH.h:92
RCController6CH::pins
RCController6CHPins pins
Definition:
RCController6CH.h:93
RCController6CHState::value_ch_3
volatile int value_ch_3
Definition:
RCController6CH.h:32
RCController6CHState::value_ch_5
volatile int value_ch_5
Definition:
RCController6CH.h:34
RCController6CHPins::PIN_CH_2
int PIN_CH_2
Definition:
RCController6CH.h:41
RCController6CHState::timestamp
volatile long int timestamp
Definition:
RCController6CH.h:29
RCController6CHState::values
volatile int * values[6]
Definition:
RCController6CH.h:36
RCController6CHState::value_ch_2
volatile int value_ch_2
Definition:
RCController6CH.h:31
OffenseRobot
Definition:
OffenseRobot.h:36
RCController6CHPins::PIN_CH_3
int PIN_CH_3
Definition:
RCController6CH.h:42
RCController6CHState::value_ch_6
volatile int value_ch_6
Definition:
RCController6CH.h:35
RCController6CHState::value_ch_1
volatile int value_ch_1
Definition:
RCController6CH.h:30
RCController6CHState::value_ch_4
volatile int value_ch_4
Definition:
RCController6CH.h:33
RCController6CHPins::PIN_CH_6
int PIN_CH_6
Definition:
RCController6CH.h:45
OmniRobot
Definition:
OmniRobot.h:53
RCController6CHPins
Definition:
RCController6CH.h:39
RCController6CHState
Definition:
RCController6CH.h:28
Generated on Mon Apr 16 2018 09:42:37 for ASMESDC2018 by
1.8.11