Use new MotorModel, spawn or connect to existing.

remove vscode changes.
This commit is contained in:
Benjamin Perseghetti
2022-09-05 17:31:54 -04:00
parent 9ed35debec
commit c8673d4f96
24 changed files with 137 additions and 2159 deletions
@@ -8,8 +8,7 @@
. ${R}etc/init.d/rc.mc_defaults
PX4_SIMULATOR=${PX4_SIMULATOR:=ignition}
PX4_SIM_MODEL=${PX4_SIM_MODEL:=x500}
PX4_SIM_WORLD=${PX4_SIM_WORLD:=default}
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
param set-default SYS_CTRL_ALLOC 1
@@ -24,24 +24,53 @@ elif [ "$PX4_SIMULATOR" = "ignition" ]; then
if [ -z $ign_world ]; then
# starting ign gazebo with ${PX4_SIM_WORLD} world
# starting ign gazebo with ${PX4_GZ_WORLD} world
echo "INFO [init] starting ign gazebo"
if [ -z $HEADLESS ]; then
ign gazebo --verbose=1 -r "${PX4_IGN_GAZEBO_WORLDS}/${PX4_SIM_WORLD}.sdf" &
ign gazebo --verbose=1 -r "${PX4_GZ_WORLDS}/${PX4_GZ_WORLD}.sdf" &
else
# starting ign gazebo headless
ign gazebo --verbose=1 -r -s "${PX4_IGN_GAZEBO_WORLDS}/${PX4_SIM_WORLD}.sdf" &
ign gazebo --verbose=1 -r -s "${PX4_GZ_WORLDS}/${PX4_GZ_WORLD}.sdf" &
fi
else
echo "INFO [init] ign gazebo already running world: $ign_world"
PX4_SIM_WORLD=$ign_world
PX4_GZ_WORLD=$ign_world
fi
if [ -z $PX4_IGN_MODEL_POSE ]; then
# start ignition bridge without pose arg.
echo "WARN [init] PX4_IGN_MODEL_POSE not set, spawning at origin."
if simulator_ignition_bridge start -m "${PX4_SIM_MODEL}" -w "${PX4_SIM_WORLD}"; then
if [ ! -z $PX4_GZ_MODEL ]; then
if [ -z $PX4_GZ_MODEL_POSE ]; then
# start ignition bridge without pose arg.
echo "WARN [init] PX4_GZ_MODEL_POSE not set, spawning at origin."
if simulator_ignition_bridge start -m "${PX4_GZ_MODEL}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
else
echo "ERROR [init] ign gazebo failed to start"
exit 1
fi
else
# Clean potential input line formatting.
model_pose="$( echo ${PX4_GZ_MODEL_POSE} | sed -e 's/^[ \t]*//; s/[ \t]*$//; s/,/ /g; s/ / /g; s/ /,/g' )"
echo "INFO [init] PX4_GZ_MODEL_POSE set, spawning at: ${model_pose}"
# start ignition bridge with pose arg.
if simulator_ignition_bridge start -p "${model_pose}" -m "${PX4_GZ_MODEL}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
else
echo "ERROR [init] ign gazebo failed to start"
exit 1
fi
fi
elif [ ! -z $PX4_GZ_MODEL_NAME ]; then
if simulator_ignition_bridge start -n "${PX4_GZ_MODEL_NAME}" -w "${PX4_GZ_WORLD}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
@@ -49,24 +78,13 @@ elif [ "$PX4_SIMULATOR" = "ignition" ]; then
echo "ERROR [init] ign gazebo failed to start"
exit 1
fi
else
# Clean potential input line formatting.
model_pose="$( echo ${PX4_IGN_MODEL_POSE} | sed -e 's/^[ \t]*//; s/[ \t]*$//; s/,/ /g; s/ / /g; s/ /,/g' )"
echo "INFO [init] PX4_IGN_MODEL_POSE set, spawning at: ${model_pose}"
# start ignition bridge with pose arg.
if simulator_ignition_bridge start -p "${model_pose}" -m "${PX4_SIM_MODEL}" -w "${PX4_SIM_WORLD}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
else
echo "ERROR [init] ign gazebo failed to start"
exit 1
fi
echo "ERROR [init] failed to pass PX4_GZ_MODEL_NAME or PX4_GZ_MODEL"
exit 1
fi
else
# otherwise start simulator (mavlink) module
simulator_tcp_port=$((4560+px4_instance))