add load_mon support for Qurt platform (#22883)

- Added check in commander to see if CPU load monitoring has been disabled before signalling overload
This commit is contained in:
Eric Katzfey 2024-03-13 18:33:58 -07:00 committed by GitHub
parent ad50afda10
commit ae947513d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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();