Autonomous Project electrical stack code
- ID =
0x100- Control commands (RX)- Byte 0-1: throttle ERPM (uint16_t, little endian), 0-AUTONOMOUS_ERPM_MAX (0 = full stop, AUTONOMOUS_ERPM_MAX = max speed)
- Byte 2-3: steering representation (uint16_t, little endian), 0-1000, where 500 = straight, 0 = full left, 1000 = full right
- Byte 4-7: reserved / future use
- ID =
0x101- Status update (TX)- Byte 0: state machine mode + rc mode
- Bits0-3 = state machine mode (see logic.h::logic_mode_t)
- Bit4-5 = Mode (0 = RC, 1 = autonomous, 2 = idle)
- Bits6-7 = reserved
- Byte 1-2: throttle PWM (uint16_t, little endian), the actual PWM value being sent to the ESC for throttle (1000-2000)
- Byte 3-4: steering PWM (uint16_t, little endian), the actual PWM value being sent to the servo for steering (1000-2000)
- Byte 5-7: reserved / future use
- Byte 0: state machine mode + rc mode
- ID =
0x102- E_Comms heartbeat (RX)- Byte 0: E_Comms heartbeat counter (uint8_t)
- Byte 1-7: reserved / future use
- ID =
CAN_VESC_MSG_NUM_TO_EXT_ID(3 = CAN_VESC_SET_RPM_MSG_NUM)(ext id) - VESC set (E)RPM (TX)- Byte 0-3: desired VESC ERPM (BE)
- Byte 4-7: reserved
- ID =
CAN_VESC_MSG_NUM_TO_EXT_ID(9 = CAN_VESC_STATUS_1_MSG_NUM)(ext id) - VESC status 1 (RX)- Byte 0-3: VESC ERPM (BE)
- Byte 4-5: VESC current (in 0.1A, so 100 = 10A) (BE)
- Byte 6-7: VESC duty cycle (in 0.001, so 1000 = 100%) (BE)
Note: CAN_VESC_ID is set to 7.
- Throttle
- Channel: 2 (index 1)
- At idle (center position): 1500 microseconds pulse width
- At full throttle forward: 2000 microseconds pulse width
- At full throttle reverse: 1000 microseconds pulse width
- Steering
- Channel: 4 (index 3)
- At center position: 1500 microseconds pulse width
- At full right: 2000 microseconds pulse width
- At full left: 1000 microseconds pulse width
- Mode switch (3 position switch)
- Channel: 5 (index 4)
- In RC mode: 1000 microseconds pulse width (not activated posistion)
- In autonomous mode: 1500 microseconds pulse width (middle position)
- In IDLE mode: 2000 microseconds pulse width (activated position)
- E-Stop switch
- Channel: 6 (index 5)
- Not pressed: 1000 microseconds pulse width (not activated position)
- Pressed: 2000 microseconds pulse width (activated position)
-
CAN Bus (CAN2):
- RX:
PB5 - TX:
PB6 - CAN_S (Silent):
PB7- LOW to enable transmitter
- HIGH to disable transmitter
- RX:
-
VESC COMMS (UART5):
- RX:
PD2 - TX:
PC12
- RX:
-
RC Reciever (USART3)
- RX:
PB11 - TX:
PB10
- RX:
-
USB (Bootloader):
- DM:
PA11 - DP:
PA12
- DM:
-
STEERING OUT (PWM):
- TIM1 (CH1/CH1N):
PE9
- TIM1 (CH1/CH1N):
-
THROTTLE OUT (PWM):
- TIM11 (CH1):
PB9
- TIM11 (CH1):
-
GPIOs:
- CAN_S:
PB7 - Main Coil EN:
PE5 - Precharge EN:
PE6 - LED OUT:
PE8
- CAN_S:
-
System / Debug:
- SWDIO:
PA13 - SWCLK:
PA14 - OSC_IN/OUT:
PH0/PH1(8MHz HSE)
- SWDIO:

