tools: Add CircuitStatus and Hardpoint Panels - #137
Conversation
|
I have a handful of questions:
|
|
Thank you for reviewing and directions
Yes, it is a smart PDU with a switched outputs and three DC-DC power rails, here is a product link
PDU outputs switches are accepting hard point commands, that simplify missions in ardupilot for example, when for a some part of the mission one can turn off equipment which isn't required or use some switched channel(s) as a real hard point - turn off electromagnet release for example
Of course, grouped on one panel just because it is grouped In one particular device and it is convincing to monitor rails manipulating with hardpoints.
I split panels to separate HardPoints from CircuitStatus, also made CircuitStatus dynamic – received updates will be added to scrollable table and sorted by id, so it should handle more than 10
Kept last message as one line for hardpoints, found this useful during debugging. |
joshanne
left a comment
There was a problem hiding this comment.
Functionally happy with the changes, but the flag processing appears broken.
The scrolling table works nicely, thanks for implementing that.
| # Parse error flags | ||
| errs = [] | ||
| flags = msg.error_flags | ||
| if flags & dronecan.uavcan.equipment.power.CircuitStatus.ERROR_FLAG_OVERVOLTAGE: |
There was a problem hiding this comment.
These flag checks return an issue for me.
I get the following error:
Traceback (most recent call last):
...
File "~/dev/dronecan_gui_tool/panels/circuit_status_panel.py", line 116, in _on_circuit_status
if flags & dronecan.uavcan.equipment.power.CircuitStatus.ERROR_FLAG_OVERVOLTAGE:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CompoundType' object has no attribute 'ERROR_FLAG_OVERVOLTAGE'I can either fix the issue by replacing dronecan.uavcan.equipment.power.CircuitStatus with msg as it is extracted at the start of the message handler, or instantiate the object with dronecan.uavcan.equipment.power.CircuitStatus().
This is because the constants are attached to the instances of the messages, rather than the type of the definition itself.
Just cursory look at the gui_tool project, the preferred method would be to use msg.ERROR_FLAG_xxx format.
if flags & msg.ERROR_FLAG_OVERVOLTAGE:
errs.append('OVER_V')
if flags & msg.ERROR_FLAG_UNDERVOLTAGE:
errs.append('UNDER_V')
if flags & msg.ERROR_FLAG_OVERCURRENT:
errs.append('OVER_C')
if flags & msg.ERROR_FLAG_UNDERCURRENT:
errs.append('UNDER_C')If you open the interactive console, you should be able to do the following and see the different behaviour:
print(dronecan.uavcan.equipment.power.CircuitStatus.ERROR_FLAG_OVERVOLTAGE)
print(dronecan.uavcan.equipment.power.CircuitStatus().ERROR_FLAG_OVERVOLTAGE)There was a problem hiding this comment.
Fixed flags and squashed commits, thank you
|
Also, could we squash the commits, or at the very least clean up the merge commit? |
|
Thanks @makcuk merged. |



Adds a new integration and debugging panel for smart PDUs. It allows sending DroneCAN hardpoint commands to toggle switched power rails and monitors real-time circuit status telemetry (voltage, current, power, and error states).
Example of operation

Tested against UglyDrone PDU-12S