Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load monitor support for Qurt platform #22883

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading