VESC CAN driver: SocketCAN dual-motor control for VESC IDs 61 and 79 #644

Closed
opened 2026-03-17 09:45:41 -04:00 by sl-jetson · 0 comments
Collaborator

Goal

Rewrite saltybot_vesc_driver to use SocketCAN (python-can) instead of pyvesc UART, controlling two VESCs over CAN bus via CANable 2.0.

Requirements

  • Use python-can library with SocketCAN interface (can0)
  • VESC CAN protocol: CAN_PACKET_SET_DUTY (0x00), CAN_PACKET_SET_RPM (0x03), CAN_PACKET_SET_CURRENT (0x01) with extended CAN IDs encoding VESC ID
  • Two motors: left=ID 61, right=ID 79
  • Differential drive: subscribe to /cmd_vel (Twist), split into left/right motor commands
    • linear.x → both motors forward/reverse
    • angular.z → differential steering (left/right speed difference)
  • Configurable wheel_separation and wheel_radius parameters
  • Command timeout: zero motors if no cmd_vel for 1.0s
  • Replace existing UART-based vesc_driver_node.py
  • Update vesc_params.yaml with CAN config (interface, bitrate, motor IDs)
  • Update launch file

Hardware

  • CANable 2.0 on can0 at 500 kbps
  • VESC left motor: CAN ID 61
  • VESC right motor: CAN ID 79

Notes

  • Depends on Issue for CANable bringup (can0 must be up)
  • VESC CAN protocol: extended frame ID = (CAN_PACKET_ID << 8) | VESC_ID
## Goal Rewrite saltybot_vesc_driver to use SocketCAN (python-can) instead of pyvesc UART, controlling two VESCs over CAN bus via CANable 2.0. ## Requirements - Use `python-can` library with SocketCAN interface (`can0`) - VESC CAN protocol: CAN_PACKET_SET_DUTY (0x00), CAN_PACKET_SET_RPM (0x03), CAN_PACKET_SET_CURRENT (0x01) with extended CAN IDs encoding VESC ID - Two motors: left=ID 61, right=ID 79 - Differential drive: subscribe to /cmd_vel (Twist), split into left/right motor commands - linear.x → both motors forward/reverse - angular.z → differential steering (left/right speed difference) - Configurable wheel_separation and wheel_radius parameters - Command timeout: zero motors if no cmd_vel for 1.0s - Replace existing UART-based vesc_driver_node.py - Update vesc_params.yaml with CAN config (interface, bitrate, motor IDs) - Update launch file ## Hardware - CANable 2.0 on can0 at 500 kbps - VESC left motor: CAN ID 61 - VESC right motor: CAN ID 79 ## Notes - Depends on Issue for CANable bringup (can0 must be up) - VESC CAN protocol: extended frame ID = (CAN_PACKET_ID << 8) | VESC_ID
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#644
No description provided.