posix shell: lots of cleanup and fixes

- move posix-configs/SITL/init/{rcS,10016_iris,6011_typhoon_h480} to ROMFS/px4fmu_common/init.d-posix
  allows for easier unification, only one symlink is required.
  - rcS: add AUTOCNF support. Update scripts to match with behavior of PX4
    master (parameter values, some sitl driver got removed)
- add alias to allow 'set variable value' syntax in scripts to px4-alias.sh
- use px4_getopt
- use separate argument for the test_data directory
- append PATH from within the px4 binary: this simplifies the usage
  w/o the sitl_run.sh script.
- add 'source px4-alias.sh' to all existing sitl startup scripts
- move sitl mixers to ROMFS/px4fmu_common/mixers-sitl
  makes it easier to use existing mixers and sitl-specific ones.
- remove unused rcS_gazebo_delta_wing
This commit is contained in:
Beat Küng
2018-08-08 21:09:39 +02:00
committed by Lorenz Meier
parent 413c09e20e
commit 7822e5b5c3
58 changed files with 472 additions and 371 deletions
@@ -0,0 +1,11 @@
#!nsh
#
# @name 3DR Iris Quadrotor SITL
#
# @type Quadrotor Wide
#
# @maintainer Julian Oes <julian@oes.ch>
#
pwm_out_sim mode_pwm
mixer load /dev/pwm_output0 etc/mixers/quad_w.main.mix
@@ -0,0 +1,32 @@
#!nsh
#
# @name Typhoon H480 SITL
#
# @type Hexarotor x
#
if [ $AUTOCNF == yes ]
then
param set MAV_TYPE 13
param set MC_PITCHRATE_P 0.1
param set MC_ROLLRATE_P 0.05
param set MPC_XY_VEL_I 0.2
param set MPC_XY_VEL_P 0.15
param set RTL_DESCEND_ALT 10.0
param set RTL_LAND_DELAY 0
param set TRIG_INTERFACE 3
param set TRIG_MODE 4
param set MNT_MODE_IN 0
param set MAV_PROTO_VER 2
fi
mavlink start -x -u 14558 -r 4000 -f -m onboard -o 14530
pwm_out_sim mode_pwm16
mixer load /dev/pwm_output0 etc/mixers/hexa_x.main.mix
mixer append /dev/pwm_output0 etc/mixers/mount_legs.aux.mix
vmount start
camera_trigger start
+151
View File
@@ -0,0 +1,151 @@
#!/usr/bin/bash
# PX4 commands need the 'px4-' prefix in bash.
# (px4-alias.sh is expected to be in the PATH)
source px4-alias.sh
# TODO: In the future we want to share rc.autostart with NuttX
#source rc.autostart
# Use the variable set by sitl_run.sh to choose the model settings.
if [ "$PX4_SIM_MODEL" == "iris" ]; then
set REQUESTED_AUTOSTART 10016
elif [ "$PX4_SIM_MODEL" == "typhoon_h480" ]; then
set REQUESTED_AUTOSTART 6011
else
echo "Unknown model"
exit -1
fi
uorb start
if [ -f eeprom/parameters ]
then
param load
fi
if param compare SYS_AUTOSTART $REQUESTED_AUTOSTART
then
set AUTOCNF no
else
set AUTOCNF yes
fi
if [ $AUTOCNF == yes ]
then
param set SYS_AUTOSTART $REQUESTED_AUTOSTART
param set BAT_N_CELLS 3
param set CAL_ACC0_ID 1376264
param set CAL_ACC0_XOFF 0.01
param set CAL_ACC0_XSCALE 1.01
param set CAL_ACC0_YOFF -0.01
param set CAL_ACC0_YSCALE 1.01
param set CAL_ACC0_ZOFF 0.01
param set CAL_ACC0_ZSCALE 1.01
param set CAL_ACC1_ID 1310728
param set CAL_ACC1_XOFF 0.01
param set CAL_GYRO0_ID 2293768
param set CAL_GYRO0_XOFF 0.01
param set CAL_MAG0_ID 196616
param set CAL_MAG0_XOFF 0.01
param set COM_DISARM_LAND 3
param set COM_OBL_ACT 2
param set COM_OBL_RC_ACT 0
param set COM_OF_LOSS_T 5
param set COM_RC_IN_MODE 1
param set EKF2_AID_MASK 1
param set EKF2_ANGERR_INIT 0.01
param set EKF2_GBIAS_INIT 0.01
param set EKF2_HGT_MODE 0
param set EKF2_MAG_TYPE 1
param set MC_PITCH_P 6
param set MC_PITCHRATE_P 0.2
param set MC_ROLL_P 6
param set MC_ROLLRATE_P 0.2
param set MIS_TAKEOFF_ALT 2.5
param set MPC_HOLD_MAX_Z 2.0
param set MPC_Z_VEL_I 0.15
param set MPC_Z_VEL_P 0.6
param set NAV_ACC_RAD 2.0
param set NAV_DLL_ACT 2
param set RTL_DESCEND_ALT 5.0
param set RTL_LAND_DELAY 5
param set RTL_RETURN_ALT 30.0
param set SDLOG_DIRS_MAX 7
param set SENS_BOARD_ROT 0
param set SENS_BOARD_X_OFF 0.000001
param set SYS_RESTART_TYPE 2
fi
# Use environment variable PX4_ESTIMATOR to choose estimator.
if [ "$PX4_ESTIMATOR" == "ekf2" ]; then
param set SYS_MC_EST_GROUP 2
elif [ "$PX4_ESTIMATOR" == "lpe" ]; then
param set SYS_MC_EST_GROUP 1
fi
dataman start
replay tryapplyparams
simulator start -s
tone_alarm start
gyrosim start
accelsim start
barosim start
gpssim start
sensors start
commander start
land_detector start multicopter
navigator start
if param compare SYS_MC_EST_GROUP 1
then
attitude_estimator_q start
local_position_estimator start
elif param compare SYS_MC_EST_GROUP 2
then
ekf2 start
else
echo "No estimator chosen"
exit -1
fi
mc_pos_control start
mc_att_control start
# TODO: eventually we want to re-use the existing autostart
# infrastructure already available on NuttX.
if param compare SYS_AUTOSTART 10016
then
source etc/init.d-posix/10016_iris
elif param compare SYS_AUTOSTART 6011
then
source etc/init.d-posix/6011_typhoon_h480
fi
mavlink start -x -u 14556 -r 4000000
mavlink start -x -u 14557 -r 4000000 -m onboard -o 14540
mavlink stream -r 50 -s POSITION_TARGET_LOCAL_NED -u 14556
mavlink stream -r 50 -s LOCAL_POSITION_NED -u 14556
mavlink stream -r 50 -s GLOBAL_POSITION_INT -u 14556
mavlink stream -r 50 -s ATTITUDE -u 14556
mavlink stream -r 50 -s ATTITUDE_QUATERNION -u 14556
mavlink stream -r 50 -s ATTITUDE_TARGET -u 14556
mavlink stream -r 50 -s SERVO_OUTPUT_RAW_0 -u 14556
mavlink stream -r 20 -s RC_CHANNELS -u 14556
mavlink stream -r 250 -s HIGHRES_IMU -u 14556
mavlink stream -r 10 -s OPTICAL_FLOW_RAD -u 14556
# Required for the typhoon
mavlink stream -r 10 -s MOUNT_ORIENTATION -u 14556
mavlink stream -r 50 -s ATTITUDE_QUATERNION -u 14557
mavlink stream -r 10 -s MOUNT_ORIENTATION -u 14557
logger start -e -t -b 1000
mavlink boot_complete
replay trystart
+24
View File
@@ -0,0 +1,24 @@
M: 4
O: 10000 10000 0 -10000 10000
S: 0 0 -10000 -10000 0 -10000 10000
S: 0 1 -10000 -10000 0 -10000 10000
S: 0 2 +10000 +10000 0 -10000 10000
S: 0 3 +10000 +10000 0 -10000 10000
M: 4
O: 10000 10000 0 -10000 10000
S: 0 0 +10000 +10000 0 -10000 10000
S: 0 1 -10000 -10000 0 -10000 10000
S: 0 2 -10000 -10000 0 -10000 10000
S: 0 3 +10000 +10000 0 -10000 10000
M: 4
O: 10000 10000 0 -10000 10000
S: 0 0 -10000 -10000 0 -10000 10000
S: 0 1 +10000 +10000 0 -10000 10000
S: 0 2 -10000 -10000 0 -10000 10000
S: 0 3 +10000 +10000 0 -10000 10000
M: 4
O: 10000 10000 0 -10000 10000
S: 0 0 +10000 +10000 0 -10000 10000
S: 0 1 +10000 +10000 0 -10000 10000
S: 0 2 +10000 +10000 0 -10000 10000
S: 0 3 +10000 +10000 0 -10000 10000
-34
View File
@@ -1,34 +0,0 @@
############################################################################
#
# Copyright (c) 2018 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
add_subdirectory(mixers)