uavcan: add node status logging to uORB
Initial implementation taken from https://github.com/PX4/PX4-Autopilot/pull/23882 but reimplemented using the existing interface. This adds ~700B to flash for the extra data in NodeStatus but I think it's worth it
@vertiq-jordan let me know what you think
@vertiq-jordan let me know what you think
Looks good on my end! Here's a couple of quick captures of one of our nodes going through the different health cases:
Here's a sanity check that everyone is reporting the correct Node ID/they're being logged:
I'll get on the Extended ESC Status PR shortly, thank you!
I do quite like this, we just need to make it fit.
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:
https://discuss.px4.io/t/px4-sync-q-a-jan-22-2025/43384/3
Rebasing, we will check back once the FLASH report is done.
@mrpollo flash report is failing. Does it only work with branches from this repo?
It's running so often that it's reaching max usage limits for the GitHub api, same is happening with the container action.
I think we are going to have to stop auto comments until we figure out a solution.
I'm worried this 700B is going to push px4_fmu-v6x over the edge..
I'm worried this 700B is going to push px4_fmu-v6x over the edge..
Might I suggest that we kill the vertiq_io module from the board defaults? I believe that right now the v6x defaults file is the only one that has our module enabled. We have fairly detailed documentation on our end for building from scratch with our stuff enabled for any board, so I'd be ok killing it as a default option. Should save a couple K.
Looks like it's the 6c that has the vertiq module, so that won't help unfortunately.
@mrpollo does anyone "own" V6X? It would be nice to have an owner of the target who can keep the flash usage under control and make the executive decisions about which modules to support.
FMUv5X
Memory region Used Size Region Size %age Used
FLASH_ITCM: 0 B 2016 KB 0.00%
FLASH_AXIM: 2021588 B 10080 KB 19.59%
ITCM_RAM: 14624 B 16 KB 89.26%
DTCM_RAM: 0 B 128 KB 0.00%
SRAM1: 93380 B 368 KB 24.78%
SRAM2: 0 B 16 KB 0.00%
[1296/1297] Generating ../../px4_fmu-v5x_flash-analysis.bin
FILE SIZE VM SIZE
-------------- --------------
+0.0% +608 +0.0% +608 .text
[NEW] +292 [NEW] +292 UavcanNode::publish_node_statuses()
[NEW] +212 [NEW] +212 UavcanNode::publish_can_interface_statuses()
+0.0% +80 +0.0% +80 [section .text]
+0.3% +64 +0.3% +64 uORB::compressed_fields
+72% +58 +72% +58 uavcan::NodeStatusMonitor::changeNodeStatus()
+0.9% +28 +0.9% +28 px4::logger::LoggedTopics::add_default_topics()
+35% +24 +35% +24 uavcan::NodeStatusMonitor::handleNodeStatus()
+1.5% +16 +1.5% +16 UavcanNode::UavcanNode()
[NEW] +16 [NEW] +16 __orb_dronecan_node_status
+11% +10 +11% +10 uavcan::NodeStatusMonitor::handleTimerEvent()
+6.7% +8 +6.7% +8 uavcan::NodeStatusMonitor::NodeStatusMonitor()
+0.2% +4 +0.2% +4 RcvTopicsPubs::init()
+0.5% +4 +0.5% +4 UavcanNode::init()
-99.9% +4 -99.9% +4 [8 Others]
+0.4% +4 +0.4% +4 two_over_pi
-0.8% -4 -0.8% -4 ModuleBase<>::unlock_module()
-1.0% -4 -1.0% -4 SendTopicsSubs::init()
-1.0% -4 -1.0% -4 UavcanNode::cb_getset()
-4.5% -4 -4.5% -4 UavcanNode::param_opcode()
-3.1% -16 -3.1% -16 UavcanNode::~UavcanNode()
-10.6% -184 -10.6% -184 UavcanNode::Run()
+0.0% +934 [ = ] 0 .debug_abbrev
+0.0% +48 [ = ] 0 .debug_aranges
+0.0% +156 [ = ] 0 .debug_frame
+0.1% +14.4Ki [ = ] 0 .debug_info
+0.0% +2.05Ki [ = ] 0 .debug_line
-20.0% -1 [ = ] 0 [Unmapped]
+0.0% +2.05Ki [ = ] 0 [section .debug_line]
+0.0% +585 [ = ] 0 .debug_loclists
+0.0% +178 [ = ] 0 .debug_rnglists
[NEW] +2 [ = ] 0 [Unmapped]
+0.0% +176 [ = ] 0 [section .debug_rnglists]
+0.0% +521 [ = ] 0 .debug_str
-0.8% -2 [ = ] 0 .shstrtab
+0.0% +146 [ = ] 0 .strtab
[NEW] +50 [ = ] 0 UavcanNode::publish_can_interface_statuses()
[NEW] +41 [ = ] 0 UavcanNode::publish_node_statuses()
+0.1% +25 [ = ] 0 [section .strtab]
+100% +16 [ = ] 0 __memcpy_veneer
[NEW] +27 [ = ] 0 __orb_dronecan_node_status
-39.0% -16 [ = ] 0 __param_get_index_veneer
+0.7% +1 [ = ] 0 uavcan::NodeInfoRetriever::handleTimerEvent()
+1.1% +2 [ = ] 0 uavcan::NodeInfoRetriever::~NodeInfoRetriever()
+0.0% +128 [ = ] 0 .symtab
-33.3% -32 [ = ] 0 RcvTopicsPubs::init()
+20% +16 [ = ] 0 UavcanNode::print_params()
[NEW] +48 [ = ] 0 UavcanNode::publish_can_interface_statuses()
[NEW] +48 [ = ] 0 UavcanNode::publish_node_statuses()
-50.0% -16 [ = ] 0 UavcanNode::update_params()
+0.3% +32 [ = ] 0 [section .symtab]
+50% +16 [ = ] 0 ___ZNK3Ekf21updateAidSourceStatusI24estimator_aid_source3d_sN6matrix7Vector3IfEES4_EEvRT_RKyRKT1_RKT0_SE_SE_f.isra.0_veneer
+67% +32 [ = ] 0 __memcpy_veneer
[NEW] +48 [ = ] 0 __orb_dronecan_node_status
-40.0% -32 [ = ] 0 __param_get_index_veneer
+33% +16 [ = ] 0 __stm32_epin_request_veneer
-33.3% -16 [ = ] 0 __stm32_i2c_sendstart_veneer
-25.0% -16 [ = ] 0 __up_flush_dcache_veneer
+0.4% +16 [ = ] 0 uavcan::GenericSubscriber<>::~GenericSubscriber()
-33.3% -16 [ = ] 0 uavcan::NodeStatusMonitor::changeNodeStatus()
-50.0% -16 [ = ] 0 uavcan::NodeStatusMonitor::handleNodeStatus()
+50% +16 [ = ] 0 uavcan::NodeStatusMonitor::handleTimerEvent()
-2.7% -16 [ = ] 0 uavcan::ServiceServer<>::~ServiceServer()
-5.8% -600 [ = ] 0 [Unmapped]
-0.1% -8 -0.1% -8 .ramfunc
+14% +1 +14% +1 ___ZNK3Ekf21updateAidSourceStatusI24estimator_aid_source3d_sN6matrix7Vector3IfEES4_EEvRT_RKyRKT1_RKT0_SE_SE_f.isra.0_veneer
-12.5% -1 -12.5% -1 __stm32_i2c_sendstart_veneer
-1.2% -4 -1.2% -4 Ekf::measurementUpdate()
-16.7% -4 -16.7% -4 get_orb_meta()
+0.0% +19.1Ki +0.0% +600 TOTAL
FMUv6X
Memory region Used Size Region Size %age Used
ITCM_RAM: 0 B 64 KB 0.00%
FLASH: 1930348 B 10080 KB 18.70%
DTCM1_RAM: 0 B 64 KB 0.00%
DTCM2_RAM: 0 B 64 KB 0.00%
AXI_SRAM: 100732 B 512 KB 19.21%
SRAM1: 0 B 128 KB 0.00%
SRAM2: 0 B 128 KB 0.00%
SRAM3: 0 B 32 KB 0.00%
SRAM4: 2 KB 64 KB 3.12%
BKPRAM: 0 B 4 KB 0.00%
[1242/1243] Generating ../../px4_fmu-v6x_flash-analysis.bin
FILE SIZE VM SIZE
-------------- --------------
+0.0% +608 +0.0% +608 .text
[NEW] +292 [NEW] +292 UavcanNode::publish_node_statuses()
[NEW] +212 [NEW] +212 UavcanNode::publish_can_interface_statuses()
+0.0% +80 +0.0% +80 [section .text]
+0.3% +64 +0.3% +64 uORB::compressed_fields
+72% +58 +72% +58 uavcan::NodeStatusMonitor::changeNodeStatus()
+0.9% +28 +0.9% +28 px4::logger::LoggedTopics::add_default_topics()
+35% +24 +35% +24 uavcan::NodeStatusMonitor::handleNodeStatus()
+1.5% +16 +1.5% +16 UavcanNode::UavcanNode()
[NEW] +16 [NEW] +16 __orb_dronecan_node_status
+11% +10 +11% +10 uavcan::NodeStatusMonitor::handleTimerEvent()
+6.7% +8 +6.7% +8 uavcan::NodeStatusMonitor::NodeStatusMonitor()
+0.2% +4 +0.2% +4 RcvTopicsPubs::init()
+0.5% +4 +0.5% +4 UavcanNode::init()
-99.9% +4 -99.9% +4 [8 Others]
+0.4% +4 +0.4% +4 two_over_pi
-0.8% -4 -0.8% -4 ModuleBase<>::unlock_module()
-1.0% -4 -1.0% -4 SendTopicsSubs::init()
-1.0% -4 -1.0% -4 UavcanNode::cb_getset()
-4.5% -4 -4.5% -4 UavcanNode::param_opcode()
-3.1% -16 -3.1% -16 UavcanNode::~UavcanNode()
-10.6% -184 -10.6% -184 UavcanNode::Run()
+0.0% +934 [ = ] 0 .debug_abbrev
+0.0% +48 [ = ] 0 .debug_aranges
+0.0% +156 [ = ] 0 .debug_frame
+0.1% +14.4Ki [ = ] 0 .debug_info
+0.0% +2.05Ki [ = ] 0 .debug_line
-20.0% -1 [ = ] 0 [Unmapped]
+0.0% +2.05Ki [ = ] 0 [section .debug_line]
+0.0% +585 [ = ] 0 .debug_loclists
+0.0% +178 [ = ] 0 .debug_rnglists
[NEW] +2 [ = ] 0 [Unmapped]
+0.0% +176 [ = ] 0 [section .debug_rnglists]
+0.0% +521 [ = ] 0 .debug_str
-0.8% -2 [ = ] 0 .shstrtab
+0.0% +146 [ = ] 0 .strtab
[NEW] +50 [ = ] 0 UavcanNode::publish_can_interface_statuses()
[NEW] +41 [ = ] 0 UavcanNode::publish_node_statuses()
+0.1% +25 [ = ] 0 [section .strtab]
+100% +16 [ = ] 0 __memcpy_veneer
[NEW] +27 [ = ] 0 __orb_dronecan_node_status
-39.0% -16 [ = ] 0 __param_get_index_veneer
+0.7% +1 [ = ] 0 uavcan::NodeInfoRetriever::handleTimerEvent()
+1.1% +2 [ = ] 0 uavcan::NodeInfoRetriever::~NodeInfoRetriever()
+0.0% +128 [ = ] 0 .symtab
-33.3% -32 [ = ] 0 RcvTopicsPubs::init()
+20% +16 [ = ] 0 UavcanNode::print_params()
[NEW] +48 [ = ] 0 UavcanNode::publish_can_interface_statuses()
[NEW] +48 [ = ] 0 UavcanNode::publish_node_statuses()
-50.0% -16 [ = ] 0 UavcanNode::update_params()
+0.3% +32 [ = ] 0 [section .symtab]
+50% +16 [ = ] 0 ___ZNK3Ekf21updateAidSourceStatusI24estimator_aid_source3d_sN6matrix7Vector3IfEES4_EEvRT_RKyRKT1_RKT0_SE_SE_f.isra.0_veneer
+67% +32 [ = ] 0 __memcpy_veneer
[NEW] +48 [ = ] 0 __orb_dronecan_node_status
-40.0% -32 [ = ] 0 __param_get_index_veneer
+33% +16 [ = ] 0 __stm32_epin_request_veneer
-33.3% -16 [ = ] 0 __stm32_i2c_sendstart_veneer
-25.0% -16 [ = ] 0 __up_flush_dcache_veneer
+0.4% +16 [ = ] 0 uavcan::GenericSubscriber<>::~GenericSubscriber()
-33.3% -16 [ = ] 0 uavcan::NodeStatusMonitor::changeNodeStatus()
-50.0% -16 [ = ] 0 uavcan::NodeStatusMonitor::handleNodeStatus()
+50% +16 [ = ] 0 uavcan::NodeStatusMonitor::handleTimerEvent()
-2.7% -16 [ = ] 0 uavcan::ServiceServer<>::~ServiceServer()
-5.8% -600 [ = ] 0 [Unmapped]
-0.1% -8 -0.1% -8 .ramfunc
+14% +1 +14% +1 ___ZNK3Ekf21updateAidSourceStatusI24estimator_aid_source3d_sN6matrix7Vector3IfEES4_EEvRT_RKyRKT1_RKT0_SE_SE_f.isra.0_veneer
-12.5% -1 -12.5% -1 __stm32_i2c_sendstart_veneer
-1.2% -4 -1.2% -4 Ekf::measurementUpdate()
-16.7% -4 -16.7% -4 get_orb_meta()
+0.0% +19.1Ki +0.0% +600 TOTAL
@dakejahl For the common px4/fmuv_5x and px4/fmu_v6x targets we don't have owners but the devs who have been helping out and are most interested in keeping them sane are @niklaut @davids5 @dagar and myself.
I think flash wise we should so far we have been dealing with issues when they come and disabling modules based on what seems right at the moment, once we move to a per vehicle type build we shouldn't be running into this anymore, but until then, we should look into how to improve this ad-hoc process.