source: pacpussensors/trunk/CanGateway/structureCanCarmen.h@ 17

Last change on this file since 17 was 4, checked in by guyardro, 11 years ago

add igep can driver for CanGateway and add support for igep compilation

File size: 6.7 KB
Line 
1// *********************************************************************
2// created: 2008/2/28 - 16:24
3// filename: structureCanCarmen.h
4//
5// author: Gerald Dherbomez
6// Copyright Heudiasyc UMR UTC/CNRS 6599
7//
8// version: $Id: $
9//
10// purpose: Description of the CAN structures for Carmen
11//
12// to add:
13// 094 - comodos
14// 612 - eclairage
15// 208 - couple
16// 349 - couple boite vitesse
17// 552 - heure
18//
19// to verify:
20// 350 and 319 not present in real time acquisition
21// *********************************************************************
22
23#ifndef STRUCTURECANCARMEN_H
24#define STRUCTURECANCARMEN_H
25
26#include <cstddef>
27
28#include "kernel/cstdint.h"
29#include "kernel/road_time.h"
30
31/// Basic structure of a CAN frame
32struct CanFrame
33{
34 static const std::size_t MAX_CAN_MSG_LENGTH = 8;
35
36 uint32_t id;
37 uint8_t dlc;
38 uint8_t data [MAX_CAN_MSG_LENGTH];
39};
40
41/// CAN structure with timestamping
42struct TimestampedCanFrame
43{
44 CanFrame frame;
45 road_time_t time;
46 road_timerange_t timerange;
47};
48
49/// Wheel speed CAN frame
50/// corresponding CAN frame = 0x44D
51typedef struct
52{
53 float frontWheelsSpeed; // mean speed of the front wheels (in km/h)
54 float rearLeftWheelSpeed; // speed of the rear left wheel (in km/h)
55 float rearRightWheelSpeed; // speed of the rear right wheel (in km/h)
56 float rpmFrontWheels; // mean rpm of the front wheels (in tr/min)
57} StructWheelSpeed;
58
59typedef struct
60{
61 road_time_t time;
62 road_timerange_t timerange;
63 StructWheelSpeed d;
64} TimestampedStructWheelSpeed;
65
66/// Suspension CAN frame
67/// corresponding CAN frame = 0x350
68typedef struct
69{
70 float frontLeftSuspension; // suspension clearance front left in mm
71 float frontRightSuspension; // suspension clearance front right in mm
72 float rearLeftSuspension; // suspension clearance rear left in mm
73 float rearRightSuspension; // suspension clearance rear right in mm
74 float trim; // the trim in degree
75} StructSuspension;
76
77typedef struct
78{
79 road_time_t time;
80 road_timerange_t timerange;
81 StructSuspension d;
82} TimestampedStructSuspension;
83
84/// Vehicle Speed CAN frame
85/// corresponding CAN frame = 0x38D
86typedef struct
87{
88 /// vehicle speed in km/h (referenced to the wheels)
89 float vehicleSpeed;
90 /// odometer in m (referenced to the wheels). Internally coded as integer 16 bits. Roll over to 0 when value reachs FFFFh (6553.5m to be verified experimentally).
91 float distance;
92 /// longitudinal acceleration in m/s2 (referenced to the wheels)
93 float longitudinalAcc;
94} StructVehicleSpeed;
95
96typedef struct
97{
98 road_time_t time;
99 road_timerange_t timerange;
100 StructVehicleSpeed d;
101} TimestampedStructVehicleSpeed;
102
103/// corresponding CAN frame = 0x319
104typedef struct
105{
106 int8_t yawAccFailSt; // ?
107 bool latAccCal; // calibration?
108 bool latAccValid; // flag use/don't use
109 bool yawRateCal; // calibration?
110 bool yawRateValid; // flag use/don't use
111 float yawRate; // yaw rate in deg/s
112 float latAcc; // lateral acceleration in m/s2
113 float yawSensorOscFreq; // in Hz
114 uint32_t yawSensorSN; // ?
115} StructRawLateralDynamics;
116
117typedef struct
118{
119 road_time_t time;
120 road_timerange_t timerange;
121 StructRawLateralDynamics d;
122} TimestampedStructRawLateralDynamics;
123
124/// Steering wheel CAN frame
125/// corresponding CAN frame = 0x305
126typedef struct
127{
128 float angle; // in deg - >0 in trigonometric direction (to the left)
129 int32_t rate; // in deg/s
130 int32_t optRate; // in deg/s optimized rotation rate of the steering wheel
131 int8_t errorCode; // error code - 4 bits
132 bool trim; // trim must be at 1, if 0 don't use angle and rate
133 bool calibration; // calibration
134 bool sensorState; // sensor state
135 int8_t checksum; // checksum - 4 bits
136} StructSteeringWheel;
137
138typedef struct
139{
140 road_time_t time;
141 road_timerange_t timerange;
142 StructSteeringWheel d;
143} TimestampedStructSteeringWheel;
144
145/// Lateral dynamics CAN frame
146/// corresponding CAN frame = 0x3CD
147typedef struct
148{
149 float yawRate; // >0 in trigonometric direction in deg/s
150 float latAcc; // >0 to the right in m/s2
151 float brakePressure; // master cylinder pressure in bar
152 int8_t braking; // 2 bits
153 bool perfLatAccSens; // ?
154 bool perfYawRateSens; // ?
155 bool latAccUncert; // ?
156 bool yawRateUncert; // ?
157 bool brakeContactHS; // ?
158 bool brakeContact; // ?
159 bool muSplitSituation; // ?
160 bool stopEmissionBicapReq; // ?
161} StructLateralDynamics;
162
163typedef struct
164{
165 road_time_t time;
166 road_timerange_t timerange;
167 StructLateralDynamics d;
168} TimestampedStructLateralDynamics;
169
170/// corresponding CAN frame = 0x550
171typedef struct
172{
173 float vehicleSpeed; // > 0 only when driving forward, in km/h
174 float yawRate; // >0 to the right, <0 for left turns, in deg/s
175 char highBeamStatus; // High beams (2 bits) 1=ON, 0=OFF, 2=11b=invalid
176 char wipersStatus; // Wipers(2 bits) 1=ON, 0=OFF, 2=11b=invalid
177 char brakeStatus; // is braking (2 bits) 1=ON, 0=OFF, 2=11b=invalid
178 char leftSignalStatus; // left signal(2 bits) 1=ON, 0=OFF, 2=11b=invalid
179 char rightSignalStatus; // right signal (2 bits) 1=ON, 0=OFF, 2=11b=invalid
180} StructCanMobileye;
181
182typedef struct
183{
184 road_time_t time;
185 road_timerange_t timerange;
186 StructCanMobileye d;
187} TimestampedStructCanMobileye;
188
189/// corresponding CAN frame = 0x094
190typedef struct
191{
192 char lightsButtonStatus; //
193 char indicators; // 0:none, 1:left, 2:right, 3:invalid
194 char wipers; // 0:pos_0, 1:pos_1, 2:pos_2, 4:pos_3
195 bool highBeamsCall; //
196} StructComodos;
197
198typedef struct
199{
200 road_time_t time;
201 road_timerange_t timerange;
202 StructComodos d;
203} TimestampedStructComodos;
204
205/// corresponding CAN frame = 0x612
206typedef struct
207{
208 bool sidelights; // feux de position
209 bool headlights; // feux de croisement
210 bool highBeams; // feux de route
211 bool rightIndicator; //
212 bool leftIndicator; //
213} StructLighting;
214
215typedef struct
216{
217 road_time_t time;
218 road_timerange_t timerange;
219 StructLighting d;
220} TimestampedStructLighting;
221
222#endif // STRUCTURECANCARMEN_H
Note: See TracBrowser for help on using the repository browser.