<commit_before>#!/bin/bash

rc_script=$1
debugger=$2
program=$3
build_path=$4

echo SITL ARGS
echo rc_script: $rc_script
echo debugger: $debugger
echo program: $program
echo build_path: $buid_path

if [ "$#" != 4 ]
then
	echo usage: sitl_run.sh rc_script debugger program build_path
	exit 1
fi

# kill process names that might stil
# be running from last time
pkill mainapp
kill -9 `jps | grep Simulator | cut -d" " -f1`

cp Tools/posix_lldbinit $build_path/src/firmware/posix/.lldbinit
cp Tools/posix.gdbinit $build_path/src/firmware/posix/.gdbinit

SIM_PID=0

if [ "$program" == "jmavsim" ]
then
	cd Tools/jMAVSim
	ant
	java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator -udp 127.0.0.1:14560 &
	SIM_PID=echo $!
elif [ "$3" == "gazebo" ]
then
	if [ -x "$(command -v gazebo)" ]
	then
		gazebo ${SITL_GAZEBO_PATH}/worlds/iris.world &
		SIM_PID=`echo $!`
	else
		echo "You need to have gazebo simulator installed!"
		exit 1
	fi
fi
cd $build_path/src/firmware/posix
mkdir -p rootfs/fs/microsd
mkdir -p rootfs/eeprom
touch rootfs/eeprom/parameters
# Start Java simulator
if [ "$debugger" == "lldb" ]
then
	lldb -- mainapp ../../../../$rc_script
elif [ "$debugger" == "gdb" ]
then
	gdb --args mainapp ../../../../$rc_script
else
	./mainapp ../../../../$rc_script
fi

if [ "$3" == "jmavsim" ]
then
	kill -9 $SIM_PID
elif [ "$3" == "gazebo" ]
then
	kill -9 $SIM_PID
fi
<commit_msg>Don't kill if jmavsim not found.<commit_after>#!/bin/bash

rc_script=$1
debugger=$2
program=$3
build_path=$4

echo SITL ARGS
echo rc_script: $rc_script
echo debugger: $debugger
echo program: $program
echo build_path: $buid_path

if [ "$#" != 4 ]
then
	echo usage: sitl_run.sh rc_script debugger program build_path
	exit 1
fi

# kill process names that might stil
# be running from last time
pkill mainapp
jmavsim_pid=`jps | grep Simulator | cut -d" " -f1`
echo jmavsim_pid=\"${jmavsim_pid}\"
if [ -n "$jmavsim_pid" ]
then
	kill $jmavsim_pid
fi

cp Tools/posix_lldbinit $build_path/src/firmware/posix/.lldbinit
cp Tools/posix.gdbinit $build_path/src/firmware/posix/.gdbinit

SIM_PID=0

if [ "$program" == "jmavsim" ]
then
	cd Tools/jMAVSim
	ant
	java -Djava.ext.dirs= -cp lib/*:out/production/jmavsim.jar me.drton.jmavsim.Simulator -udp 127.0.0.1:14560 &
	SIM_PID=echo $!
elif [ "$3" == "gazebo" ]
then
	if [ -x "$(command -v gazebo)" ]
	then
		gazebo ${SITL_GAZEBO_PATH}/worlds/iris.world &
		SIM_PID=`echo $!`
	else
		echo "You need to have gazebo simulator installed!"
		exit 1
	fi
fi
cd $build_path/src/firmware/posix
mkdir -p rootfs/fs/microsd
mkdir -p rootfs/eeprom
touch rootfs/eeprom/parameters
# Start Java simulator
if [ "$debugger" == "lldb" ]
then
	lldb -- mainapp ../../../../$rc_script
elif [ "$debugger" == "gdb" ]
then
	gdb --args mainapp ../../../../$rc_script
else
	./mainapp ../../../../$rc_script
fi

if [ "$3" == "jmavsim" ]
then
	kill -9 $SIM_PID
elif [ "$3" == "gazebo" ]
then
	kill -9 $SIM_PID
fi

{'fraction_non_alphanumeric': 0.15807442813246841, 'fraction_numerical': 0.017412086036189826, 'mean_word_length': 3.599686028257457, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4179716', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1216, 'n_words': 310}