Skip to content

UAVCAN: use uavcan_esc_index + 1 for motor 2 on dual motor hardware - #991

Merged
vedderb merged 1 commit into
vedderb:masterfrom
Jfriesen222:uavcan-dual-motor-esc-index
Dec 3, 2026
Merged

vedderb merged 1 commit into
vedderb:masterfrom
Jfriesen222:uavcan-dual-motor-esc-index

Conversation

@Jfriesen222

@Jfriesen222 Jfriesen222 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

UAVCAN support for dual motor hardware (Duet, Duet XS, Stormcore 60D/100D etc.). Motor 1 uses uavcan_esc_index and motor 2 uses uavcan_esc_index + 1.

  • RawCommand and RPMCommand drive motor 2 from data[esc_index + 1] when the array is long enough
  • An ESC Status message is sent for each motor with its own esc_index
  • The motor selection of the calling thread is restored afterwards, since the handlers can run on the comm_can thread in VESC_UAVCAN mode
  • Single motor and dual parallel hardware are unchanged

Note that motor 2 was not driven over UAVCAN before, so existing dual setups where esc_index + 1 belongs to another ESC need a new index.

Builds for duet and 60_mk6. Tested the handlers on the host with and without HW_HAS_DUAL_MOTORS, not on hardware.

On HW_HAS_DUAL_MOTORS hardware motor 1 takes the ESC RawCommand and
RPMCommand entry at uavcan_esc_index and motor 2 the entry at
uavcan_esc_index + 1. An ESC Status message is sent for each motor with
the matching esc_index. The motor selected by the calling thread is
restored afterwards. Single motor hardware is unchanged.
@Jfriesen222
Jfriesen222 force-pushed the uavcan-dual-motor-esc-index branch from 30bddc4 to 3d0c595 Compare December 3, 2026 04:09
@vedderb
vedderb merged commit 184e59a into vedderb:master Dec 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants