diff --git a/scripts/run_simulation.sh b/scripts/run_simulation.sh index 5402e4d..7b82ae5 100755 --- a/scripts/run_simulation.sh +++ b/scripts/run_simulation.sh @@ -202,17 +202,21 @@ cd "$ARDUPILOT_HOME" export PATH=$PATH:$ARDUPILOT_HOME/Tools/autotest:$HOME/.local/bin:$HOME/.local/pipx/venvs/mavproxy/bin +# Run sim_vehicle.py without --console to keep it running +# The --no-mavproxy flag runs just the SITL, then we start mavproxy separately sim_vehicle.py \ -v $VEHICLE \ -f gazebo-iris \ --model JSON \ -I $INSTANCE \ - --console \ + --no-mavproxy \ & SITL_PID=$! -sleep 10 +# Wait for SITL to initialize +sleep 8 +# Start MAVProxy in foreground so user can interact with it echo "" echo -e "${GREEN}==========================================${NC}" echo -e "${GREEN} Simulation Running${NC}" @@ -222,7 +226,7 @@ echo -e "${BLUE}Components:${NC}" echo " - Gazebo: PID $GZ_PID" echo " - ArduPilot SITL: PID $SITL_PID" echo "" -echo -e "${BLUE}MAVProxy Commands (in console):${NC}" +echo -e "${BLUE}MAVProxy Commands:${NC}" echo " mode guided # Switch to GUIDED mode" echo " arm throttle # Arm the drone" echo " takeoff 5 # Takeoff to 5 meters" @@ -230,8 +234,11 @@ echo " guided 10 5 -10 # Fly to position (N, E, D)" echo " rtl # Return to launch" echo " land # Land" echo "" -echo -e "${YELLOW}Press Ctrl+C to stop simulation${NC}" +echo -e "${YELLOW}MAVProxy starting... (Ctrl+C to exit)${NC}" echo "" -# Wait for processes -wait +# Start MAVProxy in foreground - user can type commands directly +mavproxy.py \ + --master tcp:127.0.0.1:5760 \ + --sitl 127.0.0.1:5501 \ + --out udp:127.0.0.1:14550