Skip to content

Commit

Permalink
Set callback thread priority to nav_and_controllers priority
Browse files Browse the repository at this point in the history
Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Dec 18, 2023
1 parent ac733be commit e6bfe2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion platforms/common/uORB/uORBManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/posix.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>

#include "uORBDeviceNode.hpp"
#include "uORBUtils.hpp"
Expand Down Expand Up @@ -474,10 +475,14 @@ uORB::Manager::launchCallbackThread()
return -1;
}

/* Set the priority to 1 higher than the highest controller, which is always nav_and_controllers */

int priority = sched_get_priority_max(SCHED_FIFO) + px4::wq_configurations::nav_and_controllers.relative_priority + 1;

if (per_process_cb_thread == -1) {
per_process_cb_thread = px4_task_spawn_cmd("orb_callback",
SCHED_DEFAULT,
SCHED_PRIORITY_MAX - 1,
priority,
PX4_STACK_ADJUSTED(1024),
callback_thread,
nullptr);
Expand Down

0 comments on commit e6bfe2c

Please sign in to comment.