-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjetson.h
More file actions
93 lines (80 loc) · 1.99 KB
/
Copy pathjetson.h
File metadata and controls
93 lines (80 loc) · 1.99 KB
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
#ifndef JETSON_H_
#define JETSON_H_
#include "hal.h"
#include "ch.h"
#include "leds.h"
#include "lines.h"
#include "config.h"
/**
* @defgroup Jetcom Jetson communication
* @brief
* All functions, variables, threads and macros used to communicate
* with Jetson.
* @details
* 3 threads communicating with Nvidia Jetson tx2 via serial
* communication (USART). Sends commands to other parts of program
* to next processing.
* @{
*/
#define JETSON_SERIAL &SD6
#define LOAD_JETSON_VALUES 1
#define SAVE_JETSON_VALUES 2
#define JETSON_MOVE_COMMAND 255
#define KICK_COMMAND 254
#define START_COMMAND 251
#define LINE_CALIBRATION_COMMAND 250
#define INIT_COMMAND 249
#define RESET_COMMAND 248
#define DRIBLER_COMMAND 247
#define LINE_DETECTED_COMMAND 246
#define STOP_COMMAND 245
#define START_ULTRASONIC_COMMAND 244
#define STOP_ULTRASONIC_COMMAND 243
#define LEFT_TRUE 242
#define LEFT_FALSE 241
#define RIGHT_TRUE 240
#define RIGHT_FALSE 239
#define LEFT_CLOSE 238
#define RIGHT_CLOSE 237
#define START 3
#define STOP 5
#define START_STOP 6
#define DRIBLER_ON_OFF 4
#define KICK 2
extern uint16_t ball_degree;
extern int16_t robot_speed;
extern int16_t robot_azimuth;
/**
* @brief
* Send message to [Jetson write thread]
* (@ref THD_FUNCTION(JetsonSaveThread, arg)).
* @param command
* @returns chMsgSend(jetson_write_thread, command);
*
*
*/
msg_t send_jetson(msg_t command);
/**
* @brief
* Send message to [Jetson save thread]
* (@ref THD_FUNCTION(JetsonSaveThread, arg)) which load movement
* values from jetson to main variables.
* @returns chMsgSend(jetson_save_thread, LOAD_JETSON_VALUES);
* @warning
* movement values load to main variables
*
*/
msg_t get_jetson_values(void);
/**
* @brief
* ## Init of all 3 Jetson processing threads:
* + [Jetson write thread](@ref THD_FUNCTION(JetsonWriteThread, arg))
* + [Jetson save thread](@ref THD_FUNCTION(JetsonSaveThread, arg))
* + [Jetson read thread](@ref THD_FUNCTION(JetsonReadThread, arg))
*
*/
void jetson_init(void);
/**
* @}
*/
#endif