dispatch.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Dataspeed Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Dataspeed Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef _DATASPEED_ULC_CAN_DISPATCH_H
36 #define _DATASPEED_ULC_CAN_DISPATCH_H
37 #include <stdint.h>
38 
40 {
41 
42 typedef struct {
43  int16_t linear_velocity :16; // 0.0025 m/s, -81.920 to 81.915 m/s, +-183 mph
44  int16_t yaw_command :16; // yaw rate mode: 0.00025 rad/s, -8.1920 to 8.1915 rad/s
45  // curvature mode: 0.0000061 1/m, -0.1999 1/m to 0.1999 1/m
46 
47  uint8_t steering_mode :1; // 0 = yaw rate mode, 1 = curvature mode
48  uint8_t shift_from_park :1;
49  uint8_t enable_shifting :1;
50  uint8_t enable_steering :1;
51  uint8_t enable_pedals :1;
52  uint8_t clear :1;
53  uint8_t :2;
54 
55  uint8_t :8;
56  uint8_t :8;
57  uint8_t wdc;
58 } MsgUlcCmd;
59 
60 typedef struct {
61  uint8_t linear_accel; // 0.025 m/s^2, 0 to 6.375 m/s^2
62  uint8_t linear_decel; // 0.025 m/s^2, 0 to 6.375 m/s^2
63  uint8_t lateral_accel; // 0.05 m/s^2, 0 to 12.75 m/s^2
64  uint8_t angular_accel; // 0.02 rad/s^2, 0 to 5.1 rad/s^2
65  uint8_t :8;
66  uint8_t :8;
67  uint8_t :8;
68  uint8_t wdc;
69 } MsgUlcCfg;
70 
71 typedef struct {
72  int16_t speed_ref :13; // 0.02 m/s,
73  uint16_t timeout :1;
74  uint16_t pedals_enabled :1;
75  uint16_t tracking_mode :1;
76  int16_t speed_meas :13; // 0.02 m/s
77  uint16_t override :1;
78  uint16_t steering_enabled :1;
79  uint16_t steering_mode: 1;
80  int8_t accel_ref; // 0.05 m/s^2
81  int8_t accel_meas; // 0.05 m/s^2
82  uint8_t max_steering_angle: 7; // 5 deg
83  uint8_t:1;
84  uint8_t max_steering_vel :6; // 8 deg/s
85  uint8_t steering_preempted: 1;
86  uint8_t speed_preempted: 1;
87 } MsgUlcReport;
88 
89 #define BUILD_ASSERT(cond) do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
90 static void dispatchAssertSizes() {
91  BUILD_ASSERT(8 == sizeof(MsgUlcCmd));
92  BUILD_ASSERT(8 == sizeof(MsgUlcCfg));
93  BUILD_ASSERT(8 == sizeof(MsgUlcReport));
94 }
95 #undef BUILD_ASSERT
96 
97 enum {
98  ID_ULC_CMD = 0x076,
99  ID_ULC_CONFIG = 0x077,
100  ID_ULC_REPORT = 0x078,
101 };
102 
103 } // namespace dataspeed_ulc_can
104 
105 #endif // _DATASPEED_ULC_CAN_DISPATCH_H
106 
#define BUILD_ASSERT(cond)
Definition: dispatch.h:89
static void dispatchAssertSizes()
Definition: dispatch.h:90


dataspeed_ulc_can
Author(s): Micho Radovnikovich
autogenerated on Thu Jul 9 2020 03:45:43