simulation of bebop1 (#2033)

* simulation of bebop1

* update bebop sim with correct motor pos
This commit is contained in:
Ewoud Smeur
2017-03-07 20:52:43 +01:00
committed by Michal Podhradsky
parent ae8141490d
commit d85ae584bd
3 changed files with 520 additions and 5 deletions
@@ -5,12 +5,10 @@
<firmware name="rotorcraft">
<target name="ap" board="bebop"/>
<!-- nps currently needs the motor mixing module
<target name="nps" board="pc">
<module name="fdm" type="jsbsim"/>
<module name="udp"/>
</target>
-->
<!--define name="USE_SONAR" value="TRUE"/-->
@@ -183,8 +181,9 @@
<section name="SIMULATOR" prefix="NPS_">
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/>
<define name="JSBSIM_MODEL" value="simple_x_quad_ccw" type="string"/>
<define name="JSBSIM_MODEL" value="bebop" type="string"/>
<define name="SENSORS_PARAMS" value="nps_sensors_params_default.h" type="string"/>
<define name="NO_MOTOR_MIXING" value="TRUE"/>
</section>
<section name="AUTOPILOT">
File diff suppressed because it is too large Load Diff
+14 -2
View File
@@ -35,8 +35,14 @@
#include "subsystems/ins.h"
#include "math/pprz_algebra.h"
#ifndef NPS_NO_MOTOR_MIXING
#include "subsystems/actuators/motor_mixing.h"
#if NPS_COMMANDS_NB != MOTOR_MIXING_NB_MOTOR
#warning "NPS_COMMANDS_NB does not match MOTOR_MIXING_NB_MOTOR!"
#endif
#endif
#include "subsystems/abi.h"
#include "pprzlink/messages.h"
@@ -44,6 +50,7 @@
// for datalink_time hack
#include "subsystems/datalink/datalink.h"
#include "subsystems/actuators.h"
struct NpsAutopilot nps_autopilot;
bool nps_bypass_ahrs;
@@ -57,8 +64,8 @@ bool nps_bypass_ins;
#define NPS_BYPASS_INS FALSE
#endif
#if NPS_COMMANDS_NB != MOTOR_MIXING_NB_MOTOR
#error "NPS_COMMANDS_NB does not match MOTOR_MIXING_NB_MOTOR!"
#if INDI_RPM_FEEDBACK
#error "INDI_RPM_FEEDBACK can not be used in simulation!"
#endif
void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char *rc_dev)
@@ -152,7 +159,12 @@ 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
actuators_pprz[i] = autopilot_get_motors_on() ? actuators_pprz[i] : 0;
nps_autopilot.commands[i] = (double)actuators_pprz[i] / MAX_PPRZ;
#else
nps_autopilot.commands[i] = (double)motor_mixing.commands[i] / MAX_PPRZ;
#endif
}
}