Skip to content

Commit

Permalink
ELEC-620: Add CAN messages for Driver Controls (#38)
Browse files Browse the repository at this point in the history
Add the CAN messages for the Distributed Driver Controls, consisting of
a Pedal, Steering, and Center Console board. The Pedal board is chosen
to be the Master, and other boards will raise events over CAN.

Also, update Python packaging tools and Python versions used in CI,
as 3.3 and 3.4 are now EOL.
  • Loading branch information
karlding authored Jun 2, 2019
1 parent ffeab94 commit 4ca8fef
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 40 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dist: trusty
language: python
python:
- '2.7'
- '3.3'
- '3.4'
- '3.5'
- '3.6'

branches:
only:
Expand All @@ -16,6 +16,9 @@ branches:
before_install:
- sudo apt-get -qq update
- sudo apt-get install golang
# Upgrade Python packaging tools
- pip install --upgrade pip
- pip install --upgrade setuptools

install:
- pip install -r requirements.txt
Expand Down
86 changes: 54 additions & 32 deletions can_messages.asciipb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ msg {

msg {
id: 7
source: DRIVER_CONTROLS
source: DRIVER_CONTROLS_PEDAL
# target: CHAOS
msg_name: "power state"
is_critical: true
Expand All @@ -115,7 +115,7 @@ msg {
msg {
id: 8
source: CHAOS
# target: PLUTUS, MOTOR_CONTROLLER, DRIVER_CONTROLS
# target: PLUTUS, MOTOR_CONTROLLER, DRIVER_CONTROLS_PEDAL
msg_name: "powertrain heartbeat"
is_critical: true
can_data {
Expand All @@ -124,23 +124,12 @@ msg {
}
}

# IDs: 9-14 Reserved
msg {
id: 15
source: DRIVER_CONTROLS
# target: MOTOR_INTERFACE
msg_name: "motor controller reset"
can_data {
empty {
}
}
}

# IDs: 9-15 Reserved

msg {
id: 16
source: CHAOS
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "ovuv dcdc aux"
msg_readable_name: "ov uv dcdc and aux bat"
can_data {
Expand Down Expand Up @@ -169,7 +158,7 @@ msg {

msg {
id: 18
source: DRIVER_CONTROLS
source: DRIVER_CONTROLS_PEDAL
# target: MOTOR_INTERFACE
msg_name: "drive output"
can_data {
Expand All @@ -184,7 +173,7 @@ msg {

msg {
id: 19
source: DRIVER_CONTROLS
source: DRIVER_CONTROLS_PEDAL
# target: DRIVER_DISPLAY
msg_name: "cruise_target"
can_data {
Expand Down Expand Up @@ -243,7 +232,7 @@ msg {

msg {
id: 24
source: DRIVER_CONTROLS
source: DRIVER_CONTROLS_PEDAL
# target: LIGHTS
msg_name: "lights state"
can_data {
Expand All @@ -256,7 +245,7 @@ msg {

msg {
id: 25
source: DRIVER_CONTROLS
source: DRIVER_CONTROLS_PEDAL
# target: LIGHTS
msg_name: "horn"
can_data {
Expand Down Expand Up @@ -293,22 +282,55 @@ msg {

msg {
id: 28
source: DRIVER_CONTROLS
# target: TELEMETRY
msg_name: "steering angle"
source: DRIVER_CONTROLS_STEERING
# target: DRIVER_CONTROLS_PEDAL
msg_name: "steering event"
can_data {
u16 {
field_name_1: "event_id"
field_name_2: "data"
}
}
}

msg {
id: 29
source: DRIVER_CONTROLS_CENTER_CONSOLE
# target: DRIVER_CONTROLS_PEDAL
msg_name: "center console event"
# Buttons:
# * low beam
# * daytime running lights
# * hazards
# * power
# * drive
# * neutral
# * reverse
# 5V Monitor
can_data {
u16 {
field_name_1: "steering_angle"
field_name_1: "event_id"
field_name_2: "data"
}
}
}

# IDs: 29-30 Reserved
msg {
id: 30
source: DRIVER_CONTROLS_PEDAL
# target: MOTOR_INTERFACE
msg_name: "motor controller reset"
can_data {
u8 {
field_name_1: "motor_controller_index"
}
}
}

msg {
id: 31
source: PLUTUS
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "battery soc"
can_data {
empty {
Expand All @@ -319,7 +341,7 @@ msg {
msg {
id: 32
source: PLUTUS
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "battery vt"
msg_readable_name: "battery voltage temperature"
can_data {
Expand All @@ -334,7 +356,7 @@ msg {
msg {
id: 33
source: PLUTUS
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "battery aggregate vc"
msg_readable_name: "battery aggregate voltage and current"
can_data {
Expand All @@ -350,7 +372,7 @@ msg {
msg {
id: 35
source: MOTOR_CONTROLLER
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "motor controller vc"
msg_readable_name: "motor controller voltage current"
can_data {
Expand All @@ -366,7 +388,7 @@ msg {
msg {
id: 36
source: MOTOR_CONTROLLER
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "motor velocity"
can_data {
u16 {
Expand Down Expand Up @@ -417,7 +439,7 @@ msg {
msg {
id: 40
source: MOTOR_CONTROLLER
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "odometer"
can_data {
u32 {
Expand Down Expand Up @@ -460,7 +482,7 @@ msg {
msg {
id: 45
source: SOLAR_MASTER_FRONT
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "solar data front"
can_data {
u16 {
Expand All @@ -475,7 +497,7 @@ msg {
msg {
id: 46
source: SOLAR_MASTER_REAR
# target: DRIVER_DISPLAY, TELEMETRY
# target: TELEMETRY
msg_name: "solar data rear"
can_data {
u16 {
Expand Down
6 changes: 3 additions & 3 deletions codegen/build_dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
'CHAOS',
'LIGHTS_FRONT',
'PLUTUS_SLAVE',
'DRIVER_CONTROLS'
'DRIVER_CONTROLS_PEDAL'
],
1: [
'DRIVER_CONTROLS'
'DRIVER_CONTROLS_PEDAL'
],
2: [
'PLUTUS'
Expand All @@ -70,7 +70,7 @@
8: [
'PLUTUS',
'MOTOR_CONTROLLER',
'DRIVER_CONTROLS'
'DRIVER_CONTROLS_PEDAL'
],
}

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ isort==4.2.15
pylint==1.7.2
nose==1.3.7
parameterized==0.6.1
cantools==32.11.2
cantools==32.19.0
5 changes: 3 additions & 2 deletions schema/can.proto
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ message CanMsg {
LIGHTS_FRONT = 5;
LIGHTS_REAR = 6;
MOTOR_CONTROLLER = 7;
DRIVER_CONTROLS = 8;
DRIVER_DISPLAY = 9;
DRIVER_CONTROLS_PEDAL = 8;
DRIVER_CONTROLS_CENTER_CONSOLE = 9;
SOLAR_MASTER_FRONT = 10;
SOLAR_MASTER_REAR = 11;
SENSOR_BOARD = 12;
CHARGER = 13;
DRIVER_CONTROLS_STEERING = 14;
}

uint32 raw_id = 1; // 0-2047 only
Expand Down

0 comments on commit 4ca8fef

Please sign in to comment.