Communication
Contents
- 1 Elcano CAN Commands
- 1.1 Introduction
- 1.2 Command 0x100 and 0x200 (status change)
- 1.3 Waypoint Reached (CANID 0x101)
- 1.4 Set Time (CANID 0x250)
- 1.5 Set Origin (CANID 0x251)
- 1.6 DRIVE (CANID 0x350)
- 1.7 ACTUAL (CANID 0x400)
- 1.8 Obstacle Data (0x420, 0x440, 0x460)
- 1.9 Vehicle Ahead Position (0x480)
- 1.10 Road Edge (0x4A0, 0x4A1)
- 1.11 Waypoint Positions (0x4C0 - 0x4DF)
- 1.12 Log Header (0x700)
- 1.13 Log Time (0x701)
- 1.14 Log RC (0x702)
- 1.15 Log Op (0x703)
- 1.16 Log Auto (0x704)
- 1.17 Log Desired (0x705)
- 1.18 Log Throttle (0x706)
- 1.19 Log Brakes (0x707)
- 1.20 Log Steer (0x708)
- 1.21 Log Position (0x709)
- 1.22 Finalize Log (0x70A)
Elcano CAN Commands
Introduction
Controller Area Network (CAN) is a standard introduced by Bosch in the 1980s. It is widely used to link automotive microprocessors and is required on all cars sold in North America and Europe. Physically there are four wires: Ground, 12V, CanHi and CanLo. A dominant bit means a significant difference between CanHi and CanLo; for a recessive bit the two lines are essentially the same. The interesting parts of a CAN packet are given in the table. The message ID is 11 bits, with low numbers getting priority. A CAN packet contains 0 to 8 bytes of data. The size of a CAN packet is larger, since CAN has significant error detection capability. CAN is a host-less network with most of the work done in hardware.
There are several nodes. One is Drive-by-Wire (DBW aka Low Level). A second is the Navigation computer (Nav). It was originally an Arduino and called High Level or Sensor Hub. In current design it is a Jetson Nano that works with a Pixhawk to find GPS and send motion instructions to DBW. Sensors such as camera and lidar will form another node, perhaps using a second Jetson Nano.
| CAN ID | Origin | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Function |
| 0x100 | Nav | 0x80 | E-stop request | |||||||
| 0x100 | Nav | 0x40 | Manual/Auto | |||||||
| 0x100 | Nav | 0x0X | Forward/Reverse | |||||||
| 0x101 | Nav | xx | Goal reached | |||||||
| 0x200 | DBW | 0x80 | E-stop active | |||||||
| 0x200 | DBW | 0x40 | Manual/Auto | |||||||
| 0x200 | DBW | 0x0X | Forward/Reverse | |||||||
| 0x250 | Nav | hh | mm | ss | ss | DD | MM | YY | YY | Set time |
| 0x251 | Nav | ww | xx | xx | xx | yy | zz | zz | zz | Set Origin |
| 0x350 | Nav | xx | xx | Drive Speed mm/s | ||||||
| 0x350 | Nav | xx | xx | Brake | ||||||
| 0x350 | Nav | xx | xx | Drive angle (10 times degrees) | ||||||
| 0x400 | DBW | xx | xx | Actual Speed mm/s | ||||||
| 0x400 | DBW | xx | xx | Actual angle (10 times degrees) | ||||||
| 0x420 | Lidar | rr | rr | bb | bb | ww | ss | ss | Obstacle Data | |
| 0x440 | Sonar | rr | rr | bb | bb | ww | ss | ss | Obstacle Data | |
| 0x460 | Camera | rr | rr | bb | bb | ww | ss | ss | Obstacle Data | |
| 0x480 | Camera | rr | rr | bb | bb | ww | Cone Position | |||
| 0x4A0 | Camera | xx | xx | yy | yy | zz | zz | Right road edge | ||
| 0x4A1 | Camera | xx | xx | yy | yy | zz | zz | Left road edge | ||
| 0x4C0-0x4DF | Nav | xx | xx | xx | xx | yy | yy | yy | yy | Waypoint Position |
| 0x700 | DBW | xx | xx | Log Header | ||||||
| 0x701-70A | DBW | xx | xx | Log Data |
** Please be aware of the initial CAN-Bus baud rate. If you use MCP2515 module for testing, the baud rate needs to be set to twice the due CAN baud rate
Not all commands will be implemented. All data are given in integer; floating point is not used.
Command 0x100 and 0x200 (status change)
use Byte 1.
If bit 0x80 is set, emergency stop is active.
Bit 0x40 when set puts the trike in autonomous mode; reset puts it in manual mode.
If bit 0x04 is zero, the trike is going forward. When the receiver, operator or Nav computer requests reverse, DBW responds with a 0x200 message with bit 0x04 set meaning that reverse is active, bit 0x02 set meaning that reverse is pending or bit 0x01 set meaning that reverse is not available. The Nav computer uses message 0x100 to request reverse or other status changes.
Waypoint Reached (CANID 0x101)
One byte
If 0x80 is set, all waypoints have been reached and the vehicle should stop.
Bit 0x01, 0x02: CAN ID for next waypoint (0x4C1 - 0x4DF).
Set Time (CANID 0x250)
Eight bytes. When GNNS is established, this command will be sent once. It will be used to set the real-time clock (RTC) to coordinated time. Local time will be used.
Byte 1: Hour (0-23).
Byte 2: Minute (0-59).
Byte 3-4: Millisecond (0-59999).
Byte 5: Day (1-31).
Byte 6: Month (1-12).
Byte 7-8 CE Year (e.g. 2026).
Set Origin (CANID 0x251)
Eight bytes. This gives Latitude and Longitude of the origin. All GPS reedings are translated to cm from the origin and sent in CAN messages 0x4C0 to 0x4DF. The Set Origin command will normally be sent once at startup.
Byte 1 first 7 bits: Latitude (0-90) 8th bit: 0 for N, 1 for S
Bytes 2,3,4: Fraction of latitude (0-9,999,999)
Byte 5: Longitude (0-180)
First bit of byte 6: 0 for E, 1 for W
Rest of byte 6 and bytes 7-8: Fraction of longitude (0-999,999)
DRIVE (CANID 0x350)
0x350 ComandedSpeed, Brake, ComandedSteerAngle
ID350 gives the command drive speed, brake and angle.
This utilizes 6 of the 8 data bytes
ComandedSpeed is a 16-bit signed integer giving the speed for the rear wheel in centimeters per second. It occupies data bytes 1 and 2. The value is the speed, in centimeters / second. Maximum value is 0x7FFF = 32767 cm/s = 730 mph.
Brake is a 16-bit signed integer giving signal to brake. Currently brake is only on or off, but could have pulses added later to be different levels of braking.
ComandedSteerAngle is a16-bit signed integer that specifies the steer angle (in degrees times 10) of the vehicle. Negative value indicates left; positive value indicates right; 0 is straight. It occupies data bytes 5 and 6. Maximum value is 1800; Minimum value is -1800. The trikes are not capable of turning more than ±30°, but other vehicles could be holomorphic.
e.g. commanding 1.5 m/s with a 2.1° left turn gives
| 288 | 1500 | -21 | decimal |
| 120 | 05 DC | FF EB | hex |
ACTUAL (CANID 0x400)
0x400 ActualSpeed, ActualAngle
ID400 gives the reports the actual speed and angle from the low-level board to the high-level.
This utilizes 4 of the 8 data bytes
ActualSpeed is a 16-bit signed integer giving the speed for the rear wheel in centimeters per second. It occupies data bytes 1 and 2, formatted identically to ComandedSpeed in DRIVE(0x350) above.
ActualAngle is a16-bit signed integer that specifies the steer angle (in degrees times 10) of the vehicle. It occupies data bytes 5 and 6, formatted identically to ComandedSteerAngle in DRIVE(0x350) above.
Obstacle Data (0x420, 0x440, 0x460)
Uses 6 or 8 bytes
Bytes 1,2: Range to obstacle centroid in cm.
Bytes 3,4: Bearing to obstacle centroid in degrees times 10. Negative is left; positive is right.
Byte 5: Obstacle half-width in degrees times 10. If bearing is b and half-width is w, obstacle extends from b-w to b+w. For sensors with limited resolution, byte 5 gives the resolution. For example, a sonar that covers 30 degrees would set byte 5 to 150.
Byte 6: Quality of the signal/data. 0 = no data; 255 = highest quality
Bytes 7,8: Obstacle slant in degrees times 10 (optional). If omitted or 0, the obstacle is perpendicular to the bearing. Otherwise a negative angle indicates that the left side of the obstacle is closer, and a positive angle means the left side is farther than the centroid.
Vehicle Ahead Position (0x480)
Position of the vehicle ahead, using 6 bytes in the same format as obstacle data.
Road Edge (0x4A0, 0x4A1)
Estimated distance from vehicle edge to road edge in cm based on present trajectory.
Bytes 1,2: At present vehicle position
Bytes 3,4: At a near future position (to be defined)
Bytes 5,6: At a farther future position (to be defined)
Waypoint Positions (0x4C0 - 0x4DF)
0x4C0: Position of vehicle
0x4C1-0x4DF: Positions of waypoints. Input to Jetson Nano from user interface. They can be hard coded for now.
Bytes 1-4: East position in cm
Bytes 5-8 North position in cm.
Log Header (0x700)
Write Header lines at start of log file
The log file may be written to an SD card, to serial, or to CAN. If it is written to CAN, any node can write the log file.
If CAN logging is used, 0x700 will be sent once to initialize the log. .
Log Time (0x701)
Write the relative time in milliseconds.
Log RC (0x702)
Write channels from the RC unit's channels as the pulse width in microseconds. Also write how these channels are interpreted.
Log Op (0x703)
Write channels from the operator controls. These include voltages from the two-axis joystick, and four switches for forward/reverse, auto/manual, gate disconnect and estop. Show commanded throttle or brake and steering angle.
Log Auto (0x704)
Write commanded speed, steer angle, forward/reverse, auto/manual, gate disconnect and estop that DBW received from the Nav computer.
Log Desired (0x705)
Depending on whether control comes from RC, operator or Nav computer, write the desired speed, steer angle, forward/reverse, auto/manual, gate disconnect and estop.
Log Throttle (0x706)
Log the actual throttle position, speed and drive mode.
Log Brakes (0x707)
Log brakes on/off and voltage to brakes.
Log Steer (0x708)
Log the actual steer angle and the values from the steer sensors on the right and left steering columns.
Log Position (0x709)
Log the vehicle position received from the Nav computer as 0x4C0.
Finalize Log (0x70A)
Finalize a line of the log file, including the per cent machine utilization.