Skip to content

CAN Updates for CAN26#382

Open
kvn147 wants to merge 29 commits intomasterfrom
CAN-updates
Open

CAN Updates for CAN26#382
kvn147 wants to merge 29 commits intomasterfrom
CAN-updates

Conversation

@kvn147
Copy link
Copy Markdown

@kvn147 kvn147 commented Feb 16, 2026

Initial PR to update CAN layer of software with critical restructuring of CAN from CAN26 (most changes under /CAN repo). I kept functions that rely on HindsightCAN to allow backward compatibility, but will remove after we are able to achieve full functionality with updates. Changes also include change type name motorid_t -> boardid_t and removal of motor abstraction layers (base_motor, real_motor, sim_motor) and re-implement their functionality into their respective files (real_world_interface, FakeCANBoard, sim_interface).

Notion Doc

Copilot Summary:
"This pull request refactors the CAN interface to support the new CAN26 protocol, replacing legacy HindsightCAN types and packet handling with updated definitions and handlers. The changes modernize the codebase to work with CAN26's device UUIDs, command-based packet parsing, and new telemetry handling, while maintaining backward compatibility for some legacy functions.

Migration to CAN26 protocol:

  • Replaced legacy deviceid_t types and HindsightCAN packet structures with CAN26's CANDeviceUUID_t, CANDevice_t, and CANPacket_t types throughout the codebase, including telemetry maps, callback signatures, and function parameters. [1] [2] [3]
  • Updated packet parsing logic in receivePacket to extract CAN26 fields (priority, device UUID, command, sender UUID, contents) and dispatch packets based on command IDs instead of legacy packet types. [1] [2] [3]

Command-specific telemetry handling:

  • Added new handlers for CAN26 commands such as BLDC_ENCODER_ESTIMATE and LIMIT_SWITCH_ALERT, storing telemetry using device UUID and firing callbacks with updated types.
  • Refactored telemetry scheduling, pulling, and callback registration/removal to use device UUIDs and CAN26 packet formats. [1] [2] [3] [4] [5] [6] [7]

CAN socket and packet transmission:

  • Updated CAN socket creation and filtering to use CAN26's packet header format and UUID-based filtering; added debug output for filter configuration.
  • Added new sendCANPacket and printCANPacket functions for CAN26 packets, including packet formatting and debug output; legacy versions retained for compatibility. [1] [2] [3]

Header and include updates:

  • Replaced HindsightCAN includes with CAN26 header files for device, packet, and command definitions. [1] [2]

Backward compatibility and cleanup:

  • Maintained legacy packet handling functions for compatibility, but marked them as deprecated or commented out where replaced by CAN26 logic. [1] [2]

These changes collectively enable the CAN interface to operate with the CAN26 protocol and device addressing, while providing a clear migration path from legacy packet handling."

…rrent maps. real_world_interface.cpp: Refactored for CAN26 and the removal of base_motor abstraction.
Copy link
Copy Markdown
Collaborator

@imisaacwu imisaacwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far!

kvn147 and others added 9 commits February 21, 2026 01:38
…tTread/rightTread to frontTireLeft/frontTireRight/rearTireLeft/rearTireRight. Updated motormode pwm/pid to vel/pos for clarity. Add JETSON_DEVICE and MILLIDEGREES_PER_REV to constants.
…as a peripheral board. Skip non-motor boards when adding boards to motor map in real_world_interface.
…ut. Uses map to track device and its timer, resets timer (feed) if it gets heartbeat.
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