sih: remove SYS_SIH parameter and extend SYS_HITL

This commit is contained in:
romain 2019-03-18 10:39:56 -04:00 committed by Beat Küng
parent a9660d9da0
commit e1d9438f79
7 changed files with 45 additions and 60 deletions

View File

@ -13,9 +13,5 @@ sh /etc/init.d/rc.mc_defaults
set MIXER quad_x
set PWM_OUT 1234
# set HIL to avoid sensors startup
param set SYS_HITL 1
param set SYS_SIH 1
param set BAT_N_CELLS 4
# set SYS_HITL to 2 to start the SIH and avoid sensors startup
param set SYS_HITL 2

View File

@ -202,7 +202,7 @@ then
if fmu mode_${AUX_MODE} $FMU_ARGS
then
# Append aux mixer to main device.
if param compare SYS_HITL 1
if param greater SYS_HITL 0
then
if mixer append ${OUTPUT_DEV} ${MIXER_AUX_FILE}
then

View File

@ -328,17 +328,16 @@ else
# Sensors System (start before Commander so Preflight checks are properly run).
# Commander needs to be this early for in-air-restarts.
#
if param compare SYS_HITL 1
if param greater SYS_HITL 0
then
set OUTPUT_MODE hil
sensors start -h
commander start --hil
# disable GPS
param set GPS_1_CONFIG 0
# start the SIH if needed
if param compare SYS_SIH 1
# start the simulator in hardware if needed
if param compare SYS_HITL 2
then
sih start
fi

View File

@ -64,31 +64,21 @@ PARAM_DEFINE_INT32(SYS_AUTOSTART, 0);
PARAM_DEFINE_INT32(SYS_AUTOCONFIG, 0);
/**
* Enable HITL mode on next boot
* Enable HITL/SIH mode on next boot
*
* While enabled the system will boot in HITL mode and not enable all sensors and checks.
* When disabled the same vehicle can be normally flown outdoors.
* While enabled the system will boot in Hardware-In-The-Loop (HITL)
* or Simulation-In-Hardware (SIH) mode and not enable all sensors and checks.
* When disabled the same vehicle can be flown normally.
*
* @boolean
* @value 0 HITL and SIH disabled
* @value 1 HITL enabled
* @value 2 SIH enabled
* @reboot_required true
*
* @group System
*/
PARAM_DEFINE_INT32(SYS_HITL, 0);
/**
* Enable SIH mode on next boot
*
* The simulation in hardware (SIH) will enable a quad simulator to run on the autopilot.
* When disabled the same vehicle can be normally flown outdoors.
*
* @boolean
* @reboot_required true
*
* @group System
*/
PARAM_DEFINE_INT32(SYS_SIH, 0);
/**
* Set restart type
*

View File

@ -82,7 +82,7 @@ Most of the variables are declared global in the .hpp file to avoid stack overfl
)DESCR_STR");
PRINT_MODULE_USAGE_NAME("sih", "sih");
PRINT_MODULE_USAGE_NAME("sih", "simulation");
PRINT_MODULE_USAGE_COMMAND("start");
PRINT_MODULE_USAGE_PARAM_FLAG('f', "Optional example flag", true);
PRINT_MODULE_USAGE_PARAM_INT('p', 0, 0, 1024, "Optional example parameter", true);

View File

@ -217,11 +217,11 @@ private:
(ParamFloat<px4::params::SIH_L_PITCH>) _sih_l_pitch,
(ParamFloat<px4::params::SIH_KDV>) _sih_kdv,
(ParamFloat<px4::params::SIH_KDW>) _sih_kdw,
(ParamInt<px4::params::SIH_LAT0>) _sih_lat0,
(ParamInt<px4::params::SIH_LON0>) _sih_lon0,
(ParamFloat<px4::params::SIH_H0>) _sih_h0,
(ParamFloat<px4::params::SIH_MU_X>) _sih_mu_x,
(ParamFloat<px4::params::SIH_MU_Y>) _sih_mu_y,
(ParamFloat<px4::params::SIH_MU_Z>) _sih_mu_z
(ParamInt<px4::params::SIHG_LAT0>) _sih_lat0,
(ParamInt<px4::params::SIHG_LON0>) _sih_lon0,
(ParamFloat<px4::params::SIHG_H0>) _sih_h0,
(ParamFloat<px4::params::SIHG_MU_X>) _sih_mu_x,
(ParamFloat<px4::params::SIHG_MU_Y>) _sih_mu_y,
(ParamFloat<px4::params::SIHG_MU_Z>) _sih_mu_z
)
};

View File

@ -48,7 +48,7 @@
* @min 0.0
* @decimal 2
* @increment 0.1
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_MASS, 1.0f);
@ -62,7 +62,7 @@ PARAM_DEFINE_FLOAT(SIH_MASS, 1.0f);
* @min 0.0
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_IXX, 0.025f);
@ -76,7 +76,7 @@ PARAM_DEFINE_FLOAT(SIH_IXX, 0.025f);
* @min 0.0
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_IYY, 0.025f);
@ -90,7 +90,7 @@ PARAM_DEFINE_FLOAT(SIH_IYY, 0.025f);
* @min 0.0
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_IZZ, 0.030f);
@ -103,7 +103,7 @@ PARAM_DEFINE_FLOAT(SIH_IZZ, 0.030f);
* @unit kg*m*m
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_IXY, 0.0f);
@ -116,7 +116,7 @@ PARAM_DEFINE_FLOAT(SIH_IXY, 0.0f);
* @unit kg*m*m
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_IXZ, 0.0f);
@ -129,7 +129,7 @@ PARAM_DEFINE_FLOAT(SIH_IXZ, 0.0f);
* @unit kg*m*m
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_IYZ, 0.0f);
@ -145,7 +145,7 @@ PARAM_DEFINE_FLOAT(SIH_IYZ, 0.0f);
* @min 0.0
* @decimal 2
* @increment 0.5
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_T_MAX, 5.0f);
@ -161,7 +161,7 @@ PARAM_DEFINE_FLOAT(SIH_T_MAX, 5.0f);
* @min 0.0
* @decimal 3
* @increment 0.05
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_Q_MAX, 0.1f);
@ -177,7 +177,7 @@ PARAM_DEFINE_FLOAT(SIH_Q_MAX, 0.1f);
* @min 0.0
* @decimal 2
* @increment 0.05
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_L_ROLL, 0.2f);
@ -193,7 +193,7 @@ PARAM_DEFINE_FLOAT(SIH_L_ROLL, 0.2f);
* @min 0.0
* @decimal 2
* @increment 0.05
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_L_PITCH, 0.2f);
@ -210,7 +210,7 @@ PARAM_DEFINE_FLOAT(SIH_L_PITCH, 0.2f);
* @min 0.0
* @decimal 2
* @increment 0.05
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_KDV, 1.0f);
@ -227,7 +227,7 @@ PARAM_DEFINE_FLOAT(SIH_KDV, 1.0f);
* @min 0.0
* @decimal 3
* @increment 0.005
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_KDW, 0.025f);
@ -243,9 +243,9 @@ PARAM_DEFINE_FLOAT(SIH_KDW, 0.025f);
* @unit 1e-7 deg
* @min -850000000
* @max 850000000
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_INT32(SIH_LAT0, 454671160);
PARAM_DEFINE_INT32(SIHG_LAT0, 454671160);
/**
* Initial geodetic longitude
@ -259,9 +259,9 @@ PARAM_DEFINE_INT32(SIH_LAT0, 454671160);
* @unit 1e-7 deg
* @min -1800000000
* @max 1800000000
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_INT32(SIH_LON0, -737578370);
PARAM_DEFINE_INT32(SIHG_LON0, -737578370);
/**
* Initial AMSL ground altitude
@ -280,9 +280,9 @@ PARAM_DEFINE_INT32(SIH_LON0, -737578370);
* @max 8848.0
* @decimal 2
* @increment 0.01
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_H0, 32.34f);
PARAM_DEFINE_FLOAT(SIHG_H0, 32.34f);
/**
* North magnetic field at the initial location
@ -300,9 +300,9 @@ PARAM_DEFINE_FLOAT(SIH_H0, 32.34f);
* @max 1.0
* @decimal 2
* @increment 0.001
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_MU_X, 0.179f);
PARAM_DEFINE_FLOAT(SIHG_MU_X, 0.179f);
/**
* East magnetic field at the initial location
@ -320,9 +320,9 @@ PARAM_DEFINE_FLOAT(SIH_MU_X, 0.179f);
* @max 1.0
* @decimal 2
* @increment 0.001
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_MU_Y, -0.045f);
PARAM_DEFINE_FLOAT(SIHG_MU_Y, -0.045f);
/**
* Down magnetic field at the initial location
@ -340,6 +340,6 @@ PARAM_DEFINE_FLOAT(SIH_MU_Y, -0.045f);
* @max 1.0
* @decimal 2
* @increment 0.001
* @group SIH
* @group Simulation In Hardware
*/
PARAM_DEFINE_FLOAT(SIH_MU_Z, 0.504f);
PARAM_DEFINE_FLOAT(SIHG_MU_Z, 0.504f);