diff --git a/setup/install_ubuntu.sh b/setup/install_ubuntu.sh index 58114a1..3874cf7 100755 --- a/setup/install_ubuntu.sh +++ b/setup/install_ubuntu.sh @@ -48,10 +48,10 @@ for arg in "$@"; do done if [ "$INSTALL_ARDUPILOT" = true ]; then - TOTAL_STEPS=10 + TOTAL_STEPS=9 echo "[INFO] Full installation with ArduPilot SITL" else - TOTAL_STEPS=7 + TOTAL_STEPS=6 echo "[INFO] Basic installation (no ArduPilot)" fi echo "" @@ -317,33 +317,6 @@ if [ "$INSTALL_ARDUPILOT" = true ]; then make -j$(nproc) echo "[OK] ArduPilot Gazebo plugin built" - - # ========================================================================= - # STEP 10: Configure Environment - # ========================================================================= - echo "" - echo "[STEP 10/$TOTAL_STEPS] Configuring shell environment..." - - BASHRC_MARKER="# === RDC Simulation ArduPilot ===" - - if ! grep -q "$BASHRC_MARKER" ~/.bashrc; then - cat >> ~/.bashrc << EOF - -$BASHRC_MARKER -# Source ArduPilot environment -if [ -f ~/.ardupilot_env ]; then - source ~/.ardupilot_env -fi -export ARDUPILOT_HOME=$ARDUPILOT_HOME -export PATH=\$PATH:$ARDUPILOT_HOME/Tools/autotest -export PATH=\$PATH:\$HOME/.local/bin -export GZ_SIM_SYSTEM_PLUGIN_PATH=$ARDUPILOT_GZ/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH -export GZ_SIM_RESOURCE_PATH=$ARDUPILOT_GZ/models:$ARDUPILOT_GZ/worlds:\$GZ_SIM_RESOURCE_PATH -EOF - echo "[OK] Added ArduPilot configuration to ~/.bashrc" - else - echo "[OK] ArduPilot configuration already in ~/.bashrc" - fi # Install MAVProxy pip3 install --user pymavlink mavproxy pexpect @@ -352,7 +325,6 @@ EOF echo "" echo "Verifying ArduPilot installation..." - source ~/.bashrc 2>/dev/null || true export PATH=$PATH:$ARDUPILOT_HOME/Tools/autotest:$HOME/.local/bin command -v sim_vehicle.py &> /dev/null && echo "[OK] sim_vehicle.py" || echo "[WARN] sim_vehicle.py not found" @@ -371,17 +343,16 @@ echo "==============================================" echo "" if [ "$INSTALL_ARDUPILOT" = true ]; then - echo "IMPORTANT: Run this command to reload your environment:" - echo " source ~/.bashrc" - echo "" echo "Quick Start (3 terminals):" echo "" echo "Terminal 1 - Start Gazebo:" echo " cd ~/RDC_Simulation" + echo " source activate.sh" echo " ./scripts/run_ardupilot_sim.sh runway" echo "" echo "Terminal 2 - Start ArduCopter SITL:" - echo " source ~/.bashrc" + echo " cd ~/RDC_Simulation" + echo " source activate.sh" echo " sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console" echo "" echo "Terminal 3 - Run Controller:" diff --git a/setup/uninstall.sh b/setup/uninstall.sh index edce3a4..0cb06f4 100755 --- a/setup/uninstall.sh +++ b/setup/uninstall.sh @@ -56,7 +56,7 @@ for arg in "$@"; do echo " - ~/ardupilot_gazebo (ArduPilot Gazebo plugin)" echo " - Project venv/ directory" echo " - Project activate.sh" - echo " - ArduPilot configuration from ~/.bashrc" + echo " - ~/.ardupilot_env (ArduPilot environment file)" echo "" echo "What is NOT removed:" echo " - ROS 2 (use: sudo apt remove 'ros-*')" @@ -139,30 +139,7 @@ remove_activate() { fi } -# ============================================================================= -# REMOVE BASHRC CONFIGURATION -# ============================================================================= -remove_bashrc_config() { - BASHRC_MARKER="# === RDC Simulation ArduPilot ===" - OLD_MARKER="# === ArduPilot SITL ===" - - if grep -q "$BASHRC_MARKER" ~/.bashrc 2>/dev/null || grep -q "$OLD_MARKER" ~/.bashrc 2>/dev/null; then - echo "[INFO] Removing ArduPilot configuration from ~/.bashrc" - - # Create backup - cp ~/.bashrc ~/.bashrc.backup.$(date +%Y%m%d_%H%M%S) - - # Remove the configuration block (everything from marker to next blank line or EOF) - # This handles both old and new markers - sed -i "/$BASHRC_MARKER/,/^$/d" ~/.bashrc 2>/dev/null || true - sed -i "/$OLD_MARKER/,/^$/d" ~/.bashrc 2>/dev/null || true - - echo "[OK] ArduPilot configuration removed from ~/.bashrc" - echo "[INFO] Backup saved to ~/.bashrc.backup.*" - else - echo "[SKIP] No ArduPilot configuration found in ~/.bashrc" - fi -} + # ============================================================================= # REMOVE ARDUPILOT ENV FILE @@ -188,7 +165,6 @@ if [ "$REMOVE_ALL" = true ]; then remove_ardupilot_gazebo remove_venv remove_activate - remove_bashrc_config remove_ardupilot_env elif [ "$REMOVE_ARDUPILOT" = true ]; then @@ -196,7 +172,6 @@ elif [ "$REMOVE_ARDUPILOT" = true ]; then echo "" remove_ardupilot remove_ardupilot_gazebo - remove_bashrc_config remove_ardupilot_env else @@ -231,8 +206,7 @@ else remove_activate fi - if ask_yes_no "Remove ArduPilot configuration from ~/.bashrc?"; then - remove_bashrc_config + if ask_yes_no "Remove ArduPilot environment file (~/.ardupilot_env)?"; then remove_ardupilot_env fi fi