|
|
|
@ -370,6 +370,20 @@ void FixedwingAttitudeControl::run()
@@ -370,6 +370,20 @@ void FixedwingAttitudeControl::run()
|
|
|
|
|
fds[0].events = POLLIN; |
|
|
|
|
|
|
|
|
|
while (!should_exit()) { |
|
|
|
|
|
|
|
|
|
/* only update parameters if they changed */ |
|
|
|
|
bool params_updated = false; |
|
|
|
|
orb_check(_params_sub, ¶ms_updated); |
|
|
|
|
|
|
|
|
|
if (params_updated) { |
|
|
|
|
/* read from param to clear updated flag */ |
|
|
|
|
parameter_update_s update; |
|
|
|
|
orb_copy(ORB_ID(parameter_update), _params_sub, &update); |
|
|
|
|
|
|
|
|
|
/* update parameters from storage */ |
|
|
|
|
parameters_update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* wait for up to 500ms for data */ |
|
|
|
|
int pret = px4_poll(&fds[0], (sizeof(fds) / sizeof(fds[0])), 100); |
|
|
|
|
|
|
|
|
@ -386,19 +400,6 @@ void FixedwingAttitudeControl::run()
@@ -386,19 +400,6 @@ void FixedwingAttitudeControl::run()
|
|
|
|
|
|
|
|
|
|
perf_begin(_loop_perf); |
|
|
|
|
|
|
|
|
|
/* only update parameters if they changed */ |
|
|
|
|
bool params_updated = false; |
|
|
|
|
orb_check(_params_sub, ¶ms_updated); |
|
|
|
|
|
|
|
|
|
if (params_updated) { |
|
|
|
|
/* read from param to clear updated flag */ |
|
|
|
|
parameter_update_s update; |
|
|
|
|
orb_copy(ORB_ID(parameter_update), _params_sub, &update); |
|
|
|
|
|
|
|
|
|
/* update parameters from storage */ |
|
|
|
|
parameters_update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* only run controller if attitude changed */ |
|
|
|
|
if (fds[0].revents & POLLIN) { |
|
|
|
|
static uint64_t last_run = 0; |
|
|
|
|