Skip to content

Commit

Permalink
add load_mon support for Qurt platform (#22883)
Browse files Browse the repository at this point in the history
 - Added check in commander to see if CPU load monitoring has been disabled before signalling overload
  • Loading branch information
katzfey authored Mar 14, 2024
1 parent ad50afd commit ae94751
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion boards/modalai/voxl2/default.px4board
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ CONFIG_DRIVERS_VOXL2_IO=y
CONFIG_MODULES_COMMANDER=y
CONFIG_MODULES_CONTROL_ALLOCATOR=y
CONFIG_MODULES_DATAMAN=y
CONFIG_MODULES_LOAD_MON=y
CONFIG_MODULES_LOGGER=y
CONFIG_MODULES_MAVLINK=y
CONFIG_MODULES_MUORB_APPS=y
Expand Down
1 change: 0 additions & 1 deletion boards/modalai/voxl2/target/voxl-px4-hitl-start
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ qshell flight_mode_manager start
# Start all of the processing modules on the applications processor
dataman start
navigator start
load_mon start

# Start microdds_client for ros2 offboard messages from agent over localhost
microdds_client start -t udp -h 127.0.0.1 -p 8888
Expand Down
1 change: 0 additions & 1 deletion boards/modalai/voxl2/target/voxl-px4-start
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ qshell flight_mode_manager start
# Start all of the processing modules on the applications processor
dataman start
navigator start
load_mon start

# This bridge allows raw data packets to be sent over UART to the ESC
voxl2_io_bridge start
Expand Down
9 changes: 8 additions & 1 deletion src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2419,7 +2419,14 @@ void Commander::control_status_leds(bool changed, const uint8_t battery_warning)
if (_cpuload_sub.copy(&cpuload)) {
const float cpuload_percent = cpuload.load * 100.f;

bool overload = (cpuload_percent > _param_com_cpu_max.get()) || (cpuload.ram_usage > 0.99f);
bool overload = false;

// Only check CPU load if it hasn't been disabled
if (!(_param_com_cpu_max.get() < FLT_EPSILON)) {
overload = (cpuload_percent > _param_com_cpu_max.get());
}

overload = overload || (cpuload.ram_usage > 0.99f);

if (_overload_start == 0 && overload) {
_overload_start = time_now_us;
Expand Down
3 changes: 3 additions & 0 deletions src/modules/load_mon/LoadMon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ void LoadMon::cpuload()
struct mallinfo mem = mallinfo();
cpuload.ram_usage = (float)mem.uordblks / mem.arena;
cpuload.load = 1.f - interval_idletime / interval;
#elif defined(__PX4_QURT)
cpuload.ram_usage = 0.0f;
cpuload.load = px4muorb_get_cpu_load() / 100.0f;
#endif
cpuload.timestamp = hrt_absolute_time();

Expand Down

0 comments on commit ae94751

Please sign in to comment.