Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
vesc_driver
datatypes.h
Go to the documentation of this file.
1
// Copyright 2020 F1TENTH Foundation
2
//
3
// Redistribution and use in source and binary forms, with or without modification, are permitted
4
// provided that the following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions
7
// and the following disclaimer.
8
//
9
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
10
// of conditions and the following disclaimer in the documentation and/or other materials
11
// provided with the distribution.
12
//
13
// 3. Neither the name of the copyright holder nor the names of its contributors may be used
14
// to endorse or promote products derived from this software without specific prior
15
// written permission.
16
//
17
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
24
// WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
/*
27
Copyright 2016 - 2017 Benjamin Vedder benjamin@vedder.se
28
29
This file is part of VESC Tool.
30
31
VESC Tool is free software: you can redistribute it and/or modify
32
it under the terms of the GNU General Public License as published by
33
the Free Software Foundation, either version 3 of the License, or
34
(at your option) any later version.
35
36
VESC Tool is distributed in the hope that it will be useful,
37
but WITHOUT ANY WARRANTY; without even the implied warranty of
38
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39
GNU General Public License for more details.
40
41
You should have received a copy of the GNU General Public License
42
along with this program. If not, see <http://www.gnu.org/licenses/>.
43
*/
44
45
#ifndef VESC_DRIVER_DATATYPES_H
46
#define VESC_DRIVER_DATATYPES_H
47
48
#include <cstdint>
49
50
typedef
struct
51
{
52
bool
isVesc
;
53
}
54
VSerialInfo_t
;
55
56
typedef
enum
57
{
58
CFG_T_UNDEFINED
= 0,
59
CFG_T_DOUBLE
,
60
CFG_T_INT
,
61
CFG_T_QSTRING
,
62
CFG_T_ENUM
,
63
CFG_T_BOOL
64
}
65
CFG_T
;
66
67
typedef
enum
68
{
69
VESC_TX_UNDEFINED
= 0,
70
VESC_TX_UINT8
,
71
VESC_TX_INT8
,
72
VESC_TX_UINT16
,
73
VESC_TX_INT16
,
74
VESC_TX_UINT32
,
75
VESC_TX_INT32
,
76
VESC_TX_DOUBLE16
,
77
VESC_TX_DOUBLE32
,
78
VESC_TX_DOUBLE32_AUTO
79
}
80
VESC_TX_T
;
81
82
typedef
enum
83
{
84
FAULT_CODE_NONE
= 0,
85
FAULT_CODE_OVER_VOLTAGE
,
86
FAULT_CODE_UNDER_VOLTAGE
,
87
FAULT_CODE_DRV
,
88
FAULT_CODE_ABS_OVER_CURRENT
,
89
FAULT_CODE_OVER_TEMP_FET
,
90
FAULT_CODE_OVER_TEMP_MOTOR
91
}
92
mc_fault_code
;
93
94
typedef
enum
95
{
96
DISP_POS_MODE_NONE
= 0,
97
DISP_POS_MODE_INDUCTANCE
,
98
DISP_POS_MODE_OBSERVER
,
99
DISP_POS_MODE_ENCODER
,
100
DISP_POS_MODE_PID_POS
,
101
DISP_POS_MODE_PID_POS_ERROR
,
102
DISP_POS_MODE_ENCODER_OBSERVER_ERROR
103
}
104
disp_pos_mode
;
105
106
struct
MC_VALUES
107
{
108
public
:
109
double
v_in
;
110
double
temp_mos
;
111
double
temp_motor
;
112
double
current_motor
;
113
double
current_in
;
114
double
id
;
115
double
iq
;
116
double
rpm
;
117
double
duty_now
;
118
double
amp_hours
;
119
double
amp_hours_charged
;
120
double
watt_hours
;
121
double
watt_hours_charged
;
122
int
tachometer
;
123
int
tachometer_abs
;
124
double
position
;
125
mc_fault_code
fault_code
;
126
};
127
128
typedef
enum
129
{
130
DEBUG_SAMPLING_OFF
= 0,
131
DEBUG_SAMPLING_NOW
,
132
DEBUG_SAMPLING_START
,
133
DEBUG_SAMPLING_TRIGGER_START
,
134
DEBUG_SAMPLING_TRIGGER_FAULT
,
135
DEBUG_SAMPLING_TRIGGER_START_NOSEND
,
136
DEBUG_SAMPLING_TRIGGER_FAULT_NOSEND
,
137
DEBUG_SAMPLING_SEND_LAST_SAMPLES
138
}
139
debug_sampling_mode
;
140
141
typedef
enum
142
{
143
COMM_FW_VERSION
= 0,
144
COMM_JUMP_TO_BOOTLOADER
,
145
COMM_ERASE_NEW_APP
,
146
COMM_WRITE_NEW_APP_DATA
,
147
COMM_GET_VALUES
,
148
COMM_SET_DUTY
,
149
COMM_SET_CURRENT
,
150
COMM_SET_CURRENT_BRAKE
,
151
COMM_SET_RPM
,
152
COMM_SET_POS
,
153
COMM_SET_HANDBRAKE
,
154
COMM_SET_DETECT
,
155
COMM_SET_SERVO_POS
,
156
COMM_SET_MCCONF
,
157
COMM_GET_MCCONF
,
158
COMM_GET_MCCONF_DEFAULT
,
159
COMM_SET_APPCONF
,
160
COMM_GET_APPCONF
,
161
COMM_GET_APPCONF_DEFAULT
,
162
COMM_SAMPLE_PRINT
,
163
COMM_TERMINAL_CMD
,
164
COMM_PRINT
,
165
COMM_ROTOR_POSITION
,
166
COMM_EXPERIMENT_SAMPLE
,
167
COMM_DETECT_MOTOR_PARAM
,
168
COMM_DETECT_MOTOR_R_L
,
169
COMM_DETECT_MOTOR_FLUX_LINKAGE
,
170
COMM_DETECT_ENCODER
,
171
COMM_DETECT_HALL_FOC
,
172
COMM_REBOOT
,
173
COMM_ALIVE
,
174
COMM_GET_DECODED_PPM
,
175
COMM_GET_DECODED_ADC
,
176
COMM_GET_DECODED_CHUK
,
177
COMM_FORWARD_CAN
,
178
COMM_SET_CHUCK_DATA
,
179
COMM_CUSTOM_APP_DATA
,
180
COMM_NRF_START_PAIRING
181
}
182
COMM_PACKET_ID
;
183
184
typedef
struct
185
{
186
int
js_x
;
187
int
js_y
;
188
int
acc_x
;
189
int
acc_y
;
190
int
acc_z
;
191
bool
bt_c
;
192
bool
bt_z
;
193
}
194
chuck_data
;
195
196
struct
bldc_detect
197
{
198
public
:
199
double
cycle_int_limit
;
200
double
bemf_coupling_k
;
201
int
hall_res
;
202
};
203
204
typedef
enum
205
{
206
NRF_PAIR_STARTED
= 0,
207
NRF_PAIR_OK
,
208
NRF_PAIR_FAIL
209
}
210
NRF_PAIR_RES
;
211
212
#endif // VESC_DRIVER_DATATYPES_H
DEBUG_SAMPLING_OFF
Definition:
datatypes.h:130
COMM_SET_RPM
Definition:
datatypes.h:151
COMM_EXPERIMENT_SAMPLE
Definition:
datatypes.h:166
COMM_SET_DUTY
Definition:
datatypes.h:148
VESC_TX_DOUBLE16
Definition:
datatypes.h:76
COMM_REBOOT
Definition:
datatypes.h:172
COMM_NRF_START_PAIRING
Definition:
datatypes.h:180
MC_VALUES::temp_mos
double temp_mos
Definition:
datatypes.h:110
chuck_data::acc_y
int acc_y
Definition:
datatypes.h:189
COMM_GET_VALUES
Definition:
datatypes.h:147
CFG_T
CFG_T
Definition:
datatypes.h:56
COMM_GET_MCCONF_DEFAULT
Definition:
datatypes.h:158
bldc_detect
Definition:
datatypes.h:196
COMM_JUMP_TO_BOOTLOADER
Definition:
datatypes.h:144
DEBUG_SAMPLING_TRIGGER_FAULT_NOSEND
Definition:
datatypes.h:136
MC_VALUES::tachometer_abs
int tachometer_abs
Definition:
datatypes.h:123
COMM_DETECT_MOTOR_R_L
Definition:
datatypes.h:168
COMM_PRINT
Definition:
datatypes.h:164
DEBUG_SAMPLING_NOW
Definition:
datatypes.h:131
COMM_SET_CURRENT
Definition:
datatypes.h:149
COMM_SAMPLE_PRINT
Definition:
datatypes.h:162
VESC_TX_DOUBLE32
Definition:
datatypes.h:77
NRF_PAIR_RES
NRF_PAIR_RES
Definition:
datatypes.h:204
DEBUG_SAMPLING_TRIGGER_FAULT
Definition:
datatypes.h:134
FAULT_CODE_OVER_TEMP_MOTOR
Definition:
datatypes.h:90
NRF_PAIR_FAIL
Definition:
datatypes.h:208
bldc_detect::bemf_coupling_k
double bemf_coupling_k
Definition:
datatypes.h:200
MC_VALUES::fault_code
mc_fault_code fault_code
Definition:
datatypes.h:125
FAULT_CODE_UNDER_VOLTAGE
Definition:
datatypes.h:86
VESC_TX_INT8
Definition:
datatypes.h:71
DISP_POS_MODE_PID_POS_ERROR
Definition:
datatypes.h:101
DEBUG_SAMPLING_START
Definition:
datatypes.h:132
COMM_PACKET_ID
COMM_PACKET_ID
Definition:
datatypes.h:141
COMM_FW_VERSION
Definition:
datatypes.h:143
COMM_DETECT_MOTOR_PARAM
Definition:
datatypes.h:167
NRF_PAIR_OK
Definition:
datatypes.h:207
CFG_T_INT
Definition:
datatypes.h:60
MC_VALUES::watt_hours
double watt_hours
Definition:
datatypes.h:120
chuck_data::bt_z
bool bt_z
Definition:
datatypes.h:192
MC_VALUES::v_in
double v_in
Definition:
datatypes.h:109
VESC_TX_UINT8
Definition:
datatypes.h:70
VSerialInfo_t
Definition:
datatypes.h:50
bldc_detect::hall_res
int hall_res
Definition:
datatypes.h:201
CFG_T_ENUM
Definition:
datatypes.h:62
MC_VALUES::watt_hours_charged
double watt_hours_charged
Definition:
datatypes.h:121
VESC_TX_UINT32
Definition:
datatypes.h:74
VESC_TX_UINT16
Definition:
datatypes.h:72
chuck_data::js_x
int js_x
Definition:
datatypes.h:186
MC_VALUES
Definition:
datatypes.h:106
DEBUG_SAMPLING_TRIGGER_START_NOSEND
Definition:
datatypes.h:135
MC_VALUES::position
double position
Definition:
datatypes.h:124
VESC_TX_UNDEFINED
Definition:
datatypes.h:69
MC_VALUES::amp_hours
double amp_hours
Definition:
datatypes.h:118
disp_pos_mode
disp_pos_mode
Definition:
datatypes.h:94
COMM_SET_POS
Definition:
datatypes.h:152
COMM_DETECT_HALL_FOC
Definition:
datatypes.h:171
MC_VALUES::duty_now
double duty_now
Definition:
datatypes.h:117
MC_VALUES::current_in
double current_in
Definition:
datatypes.h:113
COMM_SET_DETECT
Definition:
datatypes.h:154
bldc_detect::cycle_int_limit
double cycle_int_limit
Definition:
datatypes.h:199
DISP_POS_MODE_OBSERVER
Definition:
datatypes.h:98
MC_VALUES::iq
double iq
Definition:
datatypes.h:115
COMM_GET_DECODED_PPM
Definition:
datatypes.h:174
COMM_DETECT_ENCODER
Definition:
datatypes.h:170
COMM_SET_CURRENT_BRAKE
Definition:
datatypes.h:150
DISP_POS_MODE_PID_POS
Definition:
datatypes.h:100
COMM_GET_DECODED_CHUK
Definition:
datatypes.h:176
COMM_SET_APPCONF
Definition:
datatypes.h:159
DEBUG_SAMPLING_SEND_LAST_SAMPLES
Definition:
datatypes.h:137
CFG_T_DOUBLE
Definition:
datatypes.h:59
DISP_POS_MODE_NONE
Definition:
datatypes.h:96
FAULT_CODE_OVER_VOLTAGE
Definition:
datatypes.h:85
COMM_ROTOR_POSITION
Definition:
datatypes.h:165
NRF_PAIR_STARTED
Definition:
datatypes.h:206
FAULT_CODE_DRV
Definition:
datatypes.h:87
MC_VALUES::temp_motor
double temp_motor
Definition:
datatypes.h:111
DEBUG_SAMPLING_TRIGGER_START
Definition:
datatypes.h:133
DISP_POS_MODE_INDUCTANCE
Definition:
datatypes.h:97
chuck_data::bt_c
bool bt_c
Definition:
datatypes.h:191
MC_VALUES::id
double id
Definition:
datatypes.h:114
VESC_TX_INT32
Definition:
datatypes.h:75
CFG_T_QSTRING
Definition:
datatypes.h:61
VSerialInfo_t::isVesc
bool isVesc
Definition:
datatypes.h:52
COMM_GET_DECODED_ADC
Definition:
datatypes.h:175
COMM_ERASE_NEW_APP
Definition:
datatypes.h:145
mc_fault_code
mc_fault_code
Definition:
datatypes.h:82
COMM_DETECT_MOTOR_FLUX_LINKAGE
Definition:
datatypes.h:169
VESC_TX_INT16
Definition:
datatypes.h:73
COMM_GET_APPCONF
Definition:
datatypes.h:160
VESC_TX_DOUBLE32_AUTO
Definition:
datatypes.h:78
chuck_data::js_y
int js_y
Definition:
datatypes.h:187
MC_VALUES::amp_hours_charged
double amp_hours_charged
Definition:
datatypes.h:119
MC_VALUES::rpm
double rpm
Definition:
datatypes.h:116
CFG_T_BOOL
Definition:
datatypes.h:63
chuck_data::acc_z
int acc_z
Definition:
datatypes.h:190
COMM_TERMINAL_CMD
Definition:
datatypes.h:163
debug_sampling_mode
debug_sampling_mode
Definition:
datatypes.h:128
DISP_POS_MODE_ENCODER
Definition:
datatypes.h:99
FAULT_CODE_NONE
Definition:
datatypes.h:84
FAULT_CODE_ABS_OVER_CURRENT
Definition:
datatypes.h:88
CFG_T_UNDEFINED
Definition:
datatypes.h:58
COMM_SET_CHUCK_DATA
Definition:
datatypes.h:178
DISP_POS_MODE_ENCODER_OBSERVER_ERROR
Definition:
datatypes.h:102
MC_VALUES::tachometer
int tachometer
Definition:
datatypes.h:122
COMM_CUSTOM_APP_DATA
Definition:
datatypes.h:179
COMM_SET_MCCONF
Definition:
datatypes.h:156
COMM_SET_SERVO_POS
Definition:
datatypes.h:155
COMM_SET_HANDBRAKE
Definition:
datatypes.h:153
COMM_GET_APPCONF_DEFAULT
Definition:
datatypes.h:161
chuck_data::acc_x
int acc_x
Definition:
datatypes.h:188
MC_VALUES::current_motor
double current_motor
Definition:
datatypes.h:112
chuck_data
Definition:
datatypes.h:184
VESC_TX_T
VESC_TX_T
Definition:
datatypes.h:67
FAULT_CODE_OVER_TEMP_FET
Definition:
datatypes.h:89
COMM_ALIVE
Definition:
datatypes.h:173
COMM_GET_MCCONF
Definition:
datatypes.h:157
COMM_FORWARD_CAN
Definition:
datatypes.h:177
COMM_WRITE_NEW_APP_DATA
Definition:
datatypes.h:146
vesc_driver
Author(s): Michael T. Boulet
, Joshua Whitley
autogenerated on Sun Apr 18 2021 02:48:01