FW15 Steering Design

Purpose:

The steering board allows the driver to control important features of the vehicle as listed below:ย ย 

  • Hornย 

  • Lightsย 

  • Cruise controlย 

  • Left/right signalย 

In the car we have a steering stalk. The steering board needs to detect the stalk movement to a certain position and act accordingly (ie. using the left signal).

Steering design:

Here is the steering interface of the previous car Steering Interface: MS 14. MSXV steering will be based on this design.

Necessity:

The steering board is critical because it implements necessary safety features that the car needs such as the horn, signals, and lights. It is also critical to racing comfort by implementing cruise control.

Implementation:

The steering project will consist of three C files. main.c, steering_analog_task.c, steering_digital_task.c.

main.c:

Main.c should initialize all the other tasks. The file should look like the standard main.c for every project. Use scons new --project=steering to make a new project.

Medium Cycle:

  • Runs can_rx_task

  • Runs steering_analog_task, steering_digital_task concurrently

  • Runs can_tx_task

steering_analog_task.c:

This file should provide an init function for main.c to initialize.

The init function should be used to set up the adc readers (with their associated settings) for each of the analog signals.

The steering_analog_task is responsible for three analog signals: control stalk, daytime running light (DRL) on, and DRL off. For each change in signal, the task will send the appropriate CAN message. You will need to edit the steering .yaml file to change the CAN auto generation. After that you can use the setter and getter header files to fill in your CAN messages.

steering_digital_task.c:

This file should provide an init function for main.c to initialize.

The init function should be used to set up the gpio settings to correctly register the digital signals.

The steering_digital_task is responsible for the horn, cruise control (cc) on/off, cc increase speed, cc decrease speed, and regen brake toggle. For each digital signal, the task will send the appropriate CAN message. You will need to edit the steering .yaml file to change the CAN auto generation. After that you can use the setter and getter header files to fill in your CAN messages.

YAML Format

Messages: ย  ย  steering_info: ย  ย  ย  id: 21 ย # or some number ย  ย  ย  target: ย  ย  ย  ย  - power_distribution_front ย  ย  ย  ย  - power_distribution_back ย  ย  ย  ย  - motor_controller ย  ย  ย  signals: ย  ย  ย  ย  digital_input: ย  ย  ย  ย  ย  length: 8 ย  ย  ย  ย  lights: ย  ย  ย  id: 24 ย  ย  ย  target: ย  ย  ย  ย  - lights ย  ย  ย  signals: ย  ย  ย  ย  lights_id: ย  ย  ย  ย  ย  length: 8 ย  ย  ย  ย  state: ย  ย  ย  ย  ย  length: 8

CAN Messages:

Steering will send two different CAN messages.

analog_signal:

The analog_signal CAN message will send four bytes: lights on/off and right/left signal.

From left to right, first two bytes should be the light id byte followed by the state byte for on/off. The next two bytes should be the id and state bytes for right/left signal.

This will only work if there are specified values where state doesnโ€™t change when another event is being processed.

data for analog_signal: 8 bytes (4 empty, 4 filled) (note that these are just example values and may not appear in the car itself)

  • 0x00000000FFEEDDCC

  • 4th byte: example of possible light id

  • 3rd byte: example of possible state for on/off

  • 2nd byte: example of another possible light id

  • 1st byte: example of state for right/left signal

digital_signal:

The digital_signal CAN message will send 1 byte containing: horn, cruise control (toggle on/off, increase speed, decrease speed), regen brake toggle.

From LSB to MSB, the zeroth bit is CC decrease speed, the first bit is CC increase speed, the second bit is CC toggle, the third bit is regen brake, and the fourth bit is horn state.

0b0

0

0

0

0

0

0

0

0b0

0

0

0

0

0

0

0

N/A

N/A

N/A

Horn

Regen brake

CC toggle

CC increase

CC decrease

  • 0b00000000

  • b0: sends 1 when CC decrease is on, 0 when off

  • b1: sends 1 when CC increase is on, 0 when off

  • b2: sends 1 when there is a CC toggle event, 0 otherwise

  • b3: sends 1 when regen brake is on, 0 when off

  • b4: sends 1 when horn state is on, 0 when off

Note *: all gpios are falling edge triggered, except for horn which is rising_falling edge