pacmod_core.h
Go to the documentation of this file.
1 // Copyright (c) 2019 AutonomouStuff, LLC
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to deal
5 // in the Software without restriction, including without limitation the rights
6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 // copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 // THE SOFTWARE.
20 
21 #ifndef PACMOD_PACMOD_CORE_H
22 #define PACMOD_PACMOD_CORE_H
23 
24 #include <sstream>
25 #include <cstdint>
26 #include <memory>
27 #include <string>
28 #include <vector>
29 
30 namespace AS
31 {
32 namespace Drivers
33 {
34 namespace PACMod
35 {
37 {
42 };
43 
45 {
46 public:
47  static std::shared_ptr<PacmodTxMsg> make_message(const int64_t& can_id);
48  virtual void parse(uint8_t *in) = 0;
49 };
50 
51 // TX Messages
52 class GlobalRptMsg :
53  public PacmodTxMsg
54 {
55 public:
56  static const int64_t CAN_ID;
57 
58  bool enabled;
65 
66  void parse(uint8_t *in);
67 };
68 
69 class VinRptMsg :
70  public PacmodTxMsg
71 {
72 public:
73  static const int64_t CAN_ID;
74 
75  std::string mfg_code;
76  std::string mfg;
78  uint32_t model_year;
79  uint32_t serial;
80 
81  void parse(uint8_t *in);
82 };
83 
85  public PacmodTxMsg
86 {
87 public:
88  uint32_t manual_input;
89  uint32_t command;
90  uint32_t output;
91 
92  void parse(uint8_t *in);
93 };
94 
96  public SystemRptIntMsg
97 {
98 public:
99  static const int64_t CAN_ID;
100 };
101 
103  public SystemRptIntMsg
104 {
105 public:
106  static const int64_t CAN_ID;
107 };
108 
109 class HornRptMsg :
110  public SystemRptIntMsg
111 {
112 public:
113  static const int64_t CAN_ID;
114 };
115 
116 class WiperRptMsg :
117  public SystemRptIntMsg
118 {
119 public:
120  static const int64_t CAN_ID;
121 };
122 
123 class ShiftRptMsg :
124  public SystemRptIntMsg
125 {
126 public:
127  static const int64_t CAN_ID;
128 };
129 
131  public PacmodTxMsg
132 {
133 public:
134  double manual_input;
135  double command;
136  double output;
137 
138  void parse(uint8_t *in);
139 };
140 
141 class AccelRptMsg :
142  public SystemRptFloatMsg
143 {
144 public:
145  static const int64_t CAN_ID;
146 };
147 
148 class SteerRptMsg :
149  public SystemRptFloatMsg
150 {
151 public:
152  static const int64_t CAN_ID;
153 };
154 
156  public SystemRptFloatMsg
157 {
158 public:
159  static const int64_t CAN_ID;
160 };
161 
163  public SystemRptFloatMsg
164 {
165 public:
166  static const int64_t CAN_ID;
167 };
168 
169 class BrakeRptMsg :
170  public SystemRptFloatMsg
171 {
172 public:
173  static const int64_t CAN_ID;
174 };
175 
177  public PacmodTxMsg
178 {
179 public:
180  static const int64_t CAN_ID;
181 
184  uint8_t vehicle_speed_raw[2];
185 
186  void parse(uint8_t *in);
187 };
188 
190  public PacmodTxMsg
191 {
192 public:
193  double current;
194  double position;
195 
196  void parse(uint8_t *in);
197 };
198 
200  public MotorRpt1Msg
201 {
202 public:
203  static const int64_t CAN_ID;
204 };
205 
207  public MotorRpt1Msg
208 {
209 public:
210  static const int64_t CAN_ID;
211 };
212 
214  public PacmodTxMsg
215 {
216 public:
217  double encoder_temp;
218  double motor_temp;
219  double velocity;
220 
221  void parse(uint8_t *in);
222 };
223 
225  public MotorRpt2Msg
226 {
227 public:
228  static const int64_t CAN_ID;
229 };
230 
232  public MotorRpt2Msg
233 {
234 public:
235  static const int64_t CAN_ID;
236 };
237 
239  public PacmodTxMsg
240 {
241 public:
243  double torque_input;
244 
245  void parse(uint8_t *in);
246 };
247 
249  public MotorRpt3Msg
250 {
251 public:
252  static const int64_t CAN_ID;
253 };
254 
256  public MotorRpt3Msg
257 {
258 public:
259  static const int64_t CAN_ID;
260 };
261 
263  public PacmodTxMsg
264 {
265 public:
266  static const int64_t CAN_ID;
267 
268  double yaw_rate;
269 
270  void parse(uint8_t *in);
271 };
272 
274  public PacmodTxMsg
275 {
276 public:
277  static const int64_t CAN_ID;
278 
285  double heading;
286 
287  void parse(uint8_t *in);
288 };
289 
291  public PacmodTxMsg
292 {
293 public:
294  static const int64_t CAN_ID;
295 
296  uint32_t year;
297  uint8_t month;
298  uint8_t day;
299  uint8_t hour;
300  uint8_t minute;
301  uint8_t second;
302 
303  void parse(uint8_t *in);
304 };
305 
307  public PacmodTxMsg
308 {
309 public:
310  static const int64_t CAN_ID;
311 
316 
317  void parse(uint8_t *in);
318 };
319 
321  public PacmodTxMsg
322 {
323 public:
324  static const int64_t CAN_ID;
325 
326  double dt;
327  double kp;
328  double ki;
329  double kd;
330 
331  void parse(uint8_t *in);
332 };
333 
335  public PacmodTxMsg
336 {
337 public:
338  static const int64_t CAN_ID;
339 
340  double p_term;
341  double i_term;
342  double d_term;
343  double all_terms;
344 
345  void parse(uint8_t *in);
346 };
347 
349  public PacmodTxMsg
350 {
351 public:
352  static const int64_t CAN_ID;
353 
354  double new_torque;
357  double error;
358 
359  void parse(uint8_t *in);
360 };
361 
363  public PacmodTxMsg
364 {
365 public:
366  static const int64_t CAN_ID;
367 
370 
371  void parse(uint8_t *in);
372 };
373 
375  public PacmodTxMsg
376 {
377 public:
378  static const int64_t CAN_ID;
379 
381 
382  void parse(uint8_t *in);
383 };
384 
385 // RX Messages
387 {
388 public:
389  std::vector<uint8_t> data;
390 };
391 
393  public PacmodRxMsg
394 {
395 public:
396  static const int64_t CAN_ID;
397 
398  void encode(bool enable, bool clear_override, bool ignore_overide);
399 };
400 
402  public PacmodRxMsg
403 {
404 public:
405  static const int64_t CAN_ID;
406 
407  void encode(uint8_t turn_signal_cmd);
408 };
409 
411  public PacmodRxMsg
412 {
413 public:
414  static const int64_t CAN_ID;
415 
416  void encode(uint8_t headlight_cmd);
417 };
418 
419 class HornCmdMsg :
420  public PacmodRxMsg
421 {
422 public:
423  static const int64_t CAN_ID;
424 
425  void encode(uint8_t horn_cmd);
426 };
427 
428 class WiperCmdMsg :
429  public PacmodRxMsg
430 {
431 public:
432  static const int64_t CAN_ID;
433 
434  void encode(uint8_t wiper_cmd);
435 };
436 
437 class ShiftCmdMsg :
438  public PacmodRxMsg
439 {
440 public:
441  static const int64_t CAN_ID;
442 
443  void encode(uint8_t shift_cmd);
444 };
445 
446 class AccelCmdMsg :
447  public PacmodRxMsg
448 {
449 public:
450  static const int64_t CAN_ID;
451 
452  void encode(double accel_cmd);
453 };
454 
455 class SteerCmdMsg :
456  public PacmodRxMsg
457 {
458 public:
459  static const int64_t CAN_ID;
460 
461  void encode(double steer_pos, double steer_spd);
462 };
463 
464 class BrakeCmdMsg :
465  public PacmodRxMsg
466 {
467 public:
468  static const int64_t CAN_ID;
469 
470  void encode(double brake_cmd);
471 };
472 } // namespace PACMod
473 } // namespace Drivers
474 } // namespace AS
475 
476 #endif // PACMOD_PACMOD_CORE_H
static const int64_t CAN_ID
Definition: pacmod_core.h:468
static const int64_t CAN_ID
Definition: pacmod_core.h:127
static const int64_t CAN_ID
Definition: pacmod_core.h:423
static const int64_t CAN_ID
Definition: pacmod_core.h:450
Definition: pacmod_core.h:30
static const int64_t CAN_ID
Definition: pacmod_core.h:166
static const int64_t CAN_ID
Definition: pacmod_core.h:396
static const int64_t CAN_ID
Definition: pacmod_core.h:120
static std::shared_ptr< PacmodTxMsg > make_message(const int64_t &can_id)
Definition: pacmod_core.cpp:70
static const int64_t CAN_ID
Definition: pacmod_core.h:73
static const int64_t CAN_ID
Definition: pacmod_core.h:159
std::vector< uint8_t > data
Definition: pacmod_core.h:389
static const int64_t CAN_ID
Definition: pacmod_core.h:432
static const int64_t CAN_ID
Definition: pacmod_core.h:113
static const int64_t CAN_ID
Definition: pacmod_core.h:441
static const int64_t CAN_ID
Definition: pacmod_core.h:56
static const int64_t CAN_ID
Definition: pacmod_core.h:145
static const int64_t CAN_ID
Definition: pacmod_core.h:173
static const int64_t CAN_ID
Definition: pacmod_core.h:152
virtual void parse(uint8_t *in)=0
static const int64_t CAN_ID
Definition: pacmod_core.h:459


pacmod
Author(s): Joe Driscoll , Josh Whitley
autogenerated on Mon Feb 28 2022 23:03:08