Controller Update 3
This commit is contained in:
@@ -22,17 +22,22 @@ print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
SOFTWARE_RENDER=false
|
||||
WORLD="iris_runway.sdf"
|
||||
MISSION="hover" # hover, square, circle
|
||||
USE_CONSOLE=true # Show MAVProxy console by default
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--software-render) SOFTWARE_RENDER=true; shift ;;
|
||||
--world) WORLD="$2"; shift 2 ;;
|
||||
--mission) MISSION="$2"; shift 2 ;;
|
||||
--no-console) USE_CONSOLE=false; shift ;;
|
||||
--console) USE_CONSOLE=true; shift ;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [options]"
|
||||
echo " --software-render Use software rendering (WSL/no GPU)"
|
||||
echo " --world <file> World file to load (default: iris_runway.sdf)"
|
||||
echo " --mission <type> Mission type: hover, square, circle (default: hover)"
|
||||
echo " --console Show MAVProxy console (default: on)"
|
||||
echo " --no-console Hide MAVProxy console"
|
||||
exit 0
|
||||
;;
|
||||
*) shift ;;
|
||||
@@ -45,6 +50,7 @@ cleanup() {
|
||||
pkill -f "gz sim" 2>/dev/null || true
|
||||
pkill -f "arducopter" 2>/dev/null || true
|
||||
pkill -f "sim_vehicle.py" 2>/dev/null || true
|
||||
pkill -f "mavproxy" 2>/dev/null || true
|
||||
pkill -f "autonomous_controller.py" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
@@ -87,15 +93,26 @@ print_success "Gazebo running (PID: $GZ_PID)"
|
||||
print_info "Starting ArduPilot SITL..."
|
||||
cd ~/ardupilot
|
||||
|
||||
# Build SITL command
|
||||
SITL_ARGS="-v ArduCopter -f gazebo-iris --model JSON -I0"
|
||||
|
||||
# Add console/map if requested
|
||||
if [ "$USE_CONSOLE" = true ]; then
|
||||
SITL_ARGS="$SITL_ARGS --console --map"
|
||||
print_info "MAVProxy console enabled"
|
||||
else
|
||||
SITL_ARGS="$SITL_ARGS --no-mavproxy"
|
||||
fi
|
||||
|
||||
# Check if custom param file exists
|
||||
PARAM_FILE="$PROJECT_DIR/config/ardupilot_gps_denied.parm"
|
||||
if [ -f "$PARAM_FILE" ]; then
|
||||
print_info "Loading GPS-denied parameters..."
|
||||
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --no-mavproxy -I0 \
|
||||
--add-param-file "$PARAM_FILE" &
|
||||
else
|
||||
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --no-mavproxy -I0 &
|
||||
SITL_ARGS="$SITL_ARGS --add-param-file $PARAM_FILE"
|
||||
fi
|
||||
|
||||
# Start SITL
|
||||
sim_vehicle.py $SITL_ARGS &
|
||||
SITL_PID=$!
|
||||
|
||||
# Wait longer for SITL to fully initialize
|
||||
|
||||
Reference in New Issue
Block a user