13#define HEADER 0xFF812345
14#define TERMINATOR 0xFF8CABDE
15#define DEBUG_SAMPLING_FAC 10
16#define MAX_MISSING_READS 50
45 hostPort.attachTx((uint8_t*) &
ctrl.controlModel_U,
sizeof(ControlClass::ExtU_controlModel_T));
46 hostPort.attachTx((uint8_t*) &
ctrl.controlModel_Y,
sizeof(ControlClass::ExtY_controlModel_T));
49 hostPort.attachRx((uint8_t*) &rx_packet,
sizeof(rx_packet));
52 rx_packet.refin0 = *((
float*) &
nanVal);
53 rx_packet.refin1 = *((
float*) &
nanVal);
63 if (*((uint32_t*)&rx_packet.refin0) !=
nanVal) {
64 ctrl.controlModel_U.ref_inputs[0] = rx_packet.refin0;
68 if (*((uint32_t*)&rx_packet.refin1) !=
nanVal) {
69 ctrl.controlModel_U.ref_inputs[1] = rx_packet.refin1;
93 uint32_t streamStartTime = micros();
95 if (hostPort.read()) missing_reads = 0;
97 timing.dt_debug = micros() - streamStartTime;
108 ControlClass::ExtU_controlModel_T
u;
109 ControlClass::ExtY_controlModel_T
y;
120 "Acc x",
"Acc y",
"Acc z",
121 "Gyro x",
"Gyro y",
"Gyro z",
122 "Mag x",
"Mag y",
"Mag z",
123 "Latitude",
"Longitude",
"GPS Speed",
124 "Steer angle",
"Steer rate",
128 "CPU temp",
"Voltage",
129 "Ref input 1",
"Ref input 2",
131 "Curr ref",
"Throttle",
132 "Roll est",
"Yaw est",
133 "Pos est x",
"Pos est y",
134 "Dist est",
"Speed est",
135 "Steer angle est",
"Steer rate est",
137 "User data 1",
"User data 2",
"User data 3",
"User data 4"
147 while (Serial.available()) {
163 {
float current_time = ((float) micros()) / 1000000.0F;
164 Serial.write((uint8_t*) ¤t_time,
sizeof(current_time));}
167 for (
int i = 0; i <
NUMSIGS; ++i) {
A class for communication with PC via USB/serial.
Definition HostPort.h:60
String signames[NUMSIGS]
Names of the signals.
Definition debug.h:118
const int NUMSIGS
Number of signals.
Definition debug.h:116
struct TxData txdata
Data to transmit via Serial.
const char SPLIT_CHAR
Char to split strings.
Definition debug.h:117
serialAction
Definition debug.h:111
@ TX_DATA
Definition debug.h:112
@ TX_SIGNAMES
Definition debug.h:114
@ TX_TIME
Definition debug.h:113
#define DEBUG_SAMPLING_FAC
Sampling factor of data streaming (expressed in units of SAMPLING_TIME).
Definition debug.h:15
#define MAX_MISSING_READS
Maximum consecutive missing readings.
Definition debug.h:16
void start_debug(void)
Initialize the debug.
Definition debug.h:140
#define TERMINATOR
4-bytes terminator of data packet.
Definition debug.h:14
#define HEADER
4-bytes header of data packet.
Definition debug.h:13
void do_debug(void)
Stream and receive signals.
Definition debug.h:144
#define USB_CONNECTED
Macro for checking the USB connection status-.
Definition config.h:309
Timing timing
Timing of functions.
Definition objects.h:222
ControlClass ctrl
Control object.
Definition objects.h:241
Counter counters
Counters for lower sampling rate.
Definition objects.h:223
uint32_t nanVal
NaN variable.
Definition objects.h:219
ControlClass::ExtU_controlModel_T u
Definition debug.h:108
ControlClass::ExtY_controlModel_T y
Definition debug.h:109