Skip to content

Better rc override#471

Merged
JMoore5353 merged 6 commits intomainfrom
better_rc_override
Dec 12, 2025
Merged

Better rc override#471
JMoore5353 merged 6 commits intomainfrom
better_rc_override

Conversation

@JMoore5353
Copy link
Contributor

This PR closes #443

  1. Cherry picks the "verbose RC override" functionality from Verbose RC Override #371
  2. Adds some unit tests for the new rc override struct
  3. Regenerated the mavlink files (since we changed the rosflight status message)

@avtoku It looks like a lot of the autogenerated mavlink headers were changed when I regenerated them. I'm not sure why all these differences happened... I wondered if it was an errant git commit in the ROSflight mavlink repo, but there haven't been any changes since May, and we last regenerated the headers in June. Do you have any idea why this could be different? The CRC method has changed, as well as what seems to be a bunch of boilerplate code.
Sorry that is such an open-ended question. I generated the headers on Python 3.8, 2.7, checked out previous commits of the mavlink repo and the rosflight_firmware repo, but I'm not can't find out why the generated files are so different.

It all works (tested in sim), so there's that at least.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the RC override functionality by replacing the simple boolean override status with a detailed bitfield-based system. The change allows the system to report not just whether RC override is active, but specifically which channels are overridden and why (stick deviation, switch activation, or offboard inactive). The implementation includes comprehensive unit tests and updates the MAVLink message structure to support the extended override information.

Key changes:

  • Replaced boolean rc_override_active() with get_rc_override() returning a uint16_t bitfield
  • Added new RCOverrideReason enum with specific override flags for each channel and reason
  • Refactored muxing logic to use the bitfield system consistently
  • Updated MAVLink rosflight_status message to use uint16_t for rc_override field

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/command_manager_test.cpp Added comprehensive tests for RC override bitfield functionality including default state, switch activation, and various muxing scenarios
src/command_manager.cpp Refactored from boolean-based to bitfield-based override tracking with cleaner separation of concerns
src/mixer.cpp Updated to use bitfield-based override checks with bitmask operations
include/command_manager.h Added RCOverrideReason enum, helper constants, and updated data structures for bitfield approach
include/comm_link.h, src/comm_manager.cpp Changed rc_override parameter from bool to uint16_t
comms/mavlink/rosflight.xml Changed rc_override field type from uint8_t to uint16_t
comms/mavlink/v1.0/* Regenerated MAVLink headers (autogenerated, primarily formatting/style changes)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JMoore5353 JMoore5353 mentioned this pull request Dec 9, 2025
@avtoku
Copy link
Contributor

avtoku commented Dec 9, 2025

@JMoore5353, The nature of the autogenerated files occurred in commit 62892a1 where the code generation instructions went from using the https://github.com/rosflight/mavlink.git repository to using https://github.com/mavlink/mavlink.git. You probably generated the mavlink code with the old repository.

@JMoore5353
Copy link
Contributor Author

@avtoku That makes sense. Thanks for pointing that out. Turns out I was following the instructions in the note included in the rosflight.xml file, which referenced the rosflight/mavlink repo. Regenerating with the new mavlink repo worked as expected.

I updated the instructions to fix some issues.

  1. Added --recursive to the git clone command (the new mavlink repo includes pymavlink as a submodule)
  2. Changed the python 2.7 command to python3.8 (I tested this and it worked... It looks like I was previously wrong about needing python2.7. The breaking change in the old rosflight/mavlink repo occurred in Python 3.9)
  3. Removed the duplicate instructions in the note field of the rosflight.xml doc. I think just referencing the generating instructions txt file is better than duplicating the instructions in the note.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 41 out of 41 changed files in this pull request and generated 12 comments.

Comments suppressed due to low confidence (1)

src/mixer.cpp:606

  • The logic for selecting primary vs secondary mixer is inverted. When rc_throttle_override_active == 0 (meaning throttle override is NOT active), the code selects the primary mixer for Q channels. However, when override is active, it should use the secondary mixer.

The condition should be inverted:

  • When rc_throttle_override_active != 0 (override IS active), use secondary mixer
  • When rc_throttle_override_active == 0 (override NOT active), use primary mixer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JMoore5353 JMoore5353 merged commit 85fd44c into main Dec 12, 2025
2 checks passed
@JMoore5353 JMoore5353 deleted the better_rc_override branch December 12, 2025 19:32
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.

Generating v1.0 instructions missing --recursive RC Override messages from the firmware

5 participants