mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 21:07:40 +08:00
Additional changes to use commands instead of actuator_pprz (#3330)
* first push * Remove redundant logic
This commit is contained in:
committed by
GitHub
parent
5f18e784b6
commit
6c8c6f118b
@@ -35,9 +35,13 @@
|
||||
#include "modules/ins/ins.h"
|
||||
#include "math/pprz_algebra.h"
|
||||
|
||||
#ifdef NPS_USE_COMMANDS
|
||||
#include "modules/core/commands.h"
|
||||
#define NPS_NO_MOTOR_MIXING TRUE
|
||||
#endif
|
||||
|
||||
#ifndef NPS_NO_MOTOR_MIXING
|
||||
#include "modules/actuators/motor_mixing.h"
|
||||
|
||||
#if NPS_COMMANDS_NB != MOTOR_MIXING_NB_MOTOR
|
||||
#warning "NPS_COMMANDS_NB does not match MOTOR_MIXING_NB_MOTOR!"
|
||||
#endif
|
||||
@@ -169,8 +173,13 @@ void nps_autopilot_run_step(double time)
|
||||
/* scale final motor commands to 0-1 for feeding the fdm */
|
||||
for (uint8_t i = 0; i < NPS_COMMANDS_NB; i++) {
|
||||
#if NPS_NO_MOTOR_MIXING
|
||||
#if NPS_USE_COMMANDS
|
||||
commands[i] = autopilot_get_motors_on() ? commands[i] : 0;
|
||||
nps_autopilot.commands[i] = (double)commands[i] / MAX_PPRZ;
|
||||
#else
|
||||
actuators_pprz[i] = autopilot_get_motors_on() ? actuators_pprz[i] : 0;
|
||||
nps_autopilot.commands[i] = (double)actuators_pprz[i] / MAX_PPRZ;
|
||||
nps_autopilot.commands[i] = (double)actuators_pprz[i] / MAX_PPRZ;
|
||||
#endif
|
||||
#else
|
||||
nps_autopilot.commands[i] = (double)motor_mixing.commands[i] / MAX_PPRZ;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user