Skip to content

add esc detection and arming/disarming features - #4

Open
tnmyhere wants to merge 3 commits into
ArduPilot:mainfrom
tnmyhere:feat-esc-arm-disarm
Open

add esc detection and arming/disarming features#4
tnmyhere wants to merge 3 commits into
ArduPilot:mainfrom
tnmyhere:feat-esc-arm-disarm

Conversation

@tnmyhere

Copy link
Copy Markdown
Contributor

Features Added

  1. Marks ESCs in the connected nodes list by recognising Node IDs seen publishing esc.Status once operational, and then remembers that after the node is reset, which is helpful when restarting the ESCs connected to the bus.
  2. Adds button to arm ESCs out of MAINTENANCE into OPERATIONAL directly instead of opening the ESC Panel, by sending a RawCommand 0 signal to initialise the ESC nodes connected to the bus. Same button toggles to disarm ESCs by restarting them (reboot them back into MAINTENANCE mode).

@Huibean Huibean added the enhancement New feature or request label Jul 11, 2026
@Huibean
Huibean requested a review from Copilot July 11, 2026 21:52

Copilot AI left a comment

Copy link
Copy Markdown

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 adds ESC-oriented UX to the main toolbar by tracking which nodes behave like ESCs (via uavcan.equipment.esc.Status) and exposing a one-click arm/disarm workflow (arm via broadcast RawCommand/safety messages; disarm via restarting detected ESC nodes).

Changes:

  • Track ESC node IDs by listening for uavcan.equipment.esc.Status transfers and derive an “armed” state from node modes.
  • Add a toolbar button to arm ESCs (streaming commands until ESCs leave MAINTENANCE or a timeout) and to disarm by restarting detected ESC nodes.
  • Minor window handling adjustments (subwindow focus behavior) and new UI icon.

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

Comment thread src/App.js Outdated
Comment on lines 64 to 67
if (subWindowRef[windowPath]) {
subWindowRef[windowPath].focus();
return;
}
Comment thread src/App.js Outdated
});
} else {
console.error(`Main: Failed to open ${windowPath}`);
console.error(`Main: Failed to open ${windowName}`);
Comment thread src/App.js Outdated
Comment on lines +91 to +115
const anyInMaintenance = () =>
Object.values(localNode.nodeMonitors || {}).some(n => n?.status?.mode === MODE_MAINTENANCE);

if (!anyInMaintenance()) {
showMessage('ESC already armed — restart to drop back into maintenance mode', 'info');
return;
}
if (armBurstRef.current) return; // already arming

showMessage('Arming in progress — REMOVE PROPELLERS!', 'warning');
setArming(true);

let count = 0;
armBurstRef.current = setInterval(() => {
try {
localNode.sendUavcanEquipmentEscRawCommand(0, Array(8).fill(0));
localNode.sendArdupilotIndicationSafetyState(0, 255); // SAFETY_OFF
localNode.sendUavcanEquipmentSafetyArmingStatus(0, 255); // FULLY_ARMED
} catch (error) {
console.error('Arm: error sending arm command:', error);
}
count++;

// Keep streaming through the whole arm sequence. Stop once no ESC is left in MAINTENANCE.
if (!anyInMaintenance()) {

@Huibean Huibean Jul 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is ture, the arming is message sent from autopilot or the dronecan tool, not esc status, the text statement should be clear, otherwise chould be misleanding

Comment thread src/App.js Outdated
Comment on lines +156 to +163
useEffect(() => {
return () => {
if (armBurstRef.current) {
clearInterval(armBurstRef.current);
armBurstRef.current = null;
}
};
}, []);
Comment thread src/App.js Outdated
const [dnaServerActive, setDnaServerActive] = useState(false);
const [arming, setArming] = useState(false);
const armBurstRef = useRef(null);
const [escNodeIds, setEscNodeIds] = useState([]);
@Huibean

Huibean commented Jul 11, 2026

Copy link
Copy Markdown
Member

I think the arming feature should keep in the ESC panel

@tnmyhere

Copy link
Copy Markdown
Contributor Author

The reason for trying to implement these changes was as mentioned:

  1. To avoid the need to open the panel each time to initialise an ESC node from maintenance mode.
  2. This way the user would also get to know if the ESCs on the bus are armed or not, which currently is not visibly specified anywhere (except no signal message which is a bit arbitrary).
  3. The ability to toggle between arming and disarming is useful while debugging, as right now you cannot disarm all ESCs together and need to restart each node.

Let me know your thoughts on this, and if any edits need to be made with the previous changes so that the points listed above can be solved. We can close this otherwise. Thanks!

@Huibean

Huibean commented Jul 13, 2026

Copy link
Copy Markdown
Member

The reason for trying to implement these changes was as mentioned:

  1. To avoid the need to open the panel each time to initialise an ESC node from maintenance mode.
  2. This way the user would also get to know if the ESCs on the bus are armed or not, which currently is not visibly specified anywhere (except no signal message which is a bit arbitrary).
  3. The ability to toggle between arming and disarming is useful while debugging, as right now you cannot disarm all ESCs together and need to restart each node.

Let me know your thoughts on this, and if any edits need to be made with the previous changes so that the points listed above can be solved. We can close this otherwise. Thanks!

Hi, sure is convenient to show some important indicator status on the home page instead of see it in the panel. the webtool primary role is considered as monitor, I will try to make it not sending any control command by default, normally autopilot is the main role to control the periph at the bus. to the third point, I think the "stop all" is the button is disarm all esc if you control them via the esc pannel
now there is one issue on the "esc pannel" also the python gui tool, it only toogle send arming or not send, there is no oprion to send disarm

@tnmyhere

Copy link
Copy Markdown
Contributor Author

Is it okay if I look into modifying this solution to add indicator status and make the disarm/arm buttons clearly evident in ESC panel? Let me know how I should proceed with this

@Huibean

Huibean commented Jul 13, 2026

Copy link
Copy Markdown
Member

Is it okay if I look into modifying this solution to add indicator status and make the disarm/arm buttons clearly evident in ESC panel? Let me know how I should proceed with this

that would be nice, thanks for that

tnmyhere added 2 commits July 14, 2026 18:33
arm/disarm toggle and channel-wise ESC info
@tnmyhere

Copy link
Copy Markdown
Contributor Author

updated the following:

  1. added disarm functionality as a single arm/disarm toggle button by broadcasting safety and arming status constantly at 2khz, as well as sending rawcommand(0) (replaces safety/arming signal checkboxes)
  2. per-channel chips reflect ESC arming status
  3. single chip in status bar reflecting number of ESCs live and connected to the bus
  4. arming/safety values use DSDL based constants, changed from static values

@tnmyhere
tnmyhere requested a review from Huibean July 14, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants