radio experiment TDM working
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
# Launches UAV client with environment-specific configuration
|
||||
#
|
||||
# Usage:
|
||||
# ./run_uav.sh local # Use local/simulation configuration
|
||||
# ./run_uav.sh testbed # Use AERPAW testbed configuration
|
||||
# ./run_uav.sh local # defaults to config/client.yaml
|
||||
# ./run_uav.sh testbed config/client2.yaml # use a specific config file
|
||||
|
||||
set -e
|
||||
|
||||
# Change to script directory
|
||||
cd "$(dirname "$0")"
|
||||
# Change to aerpaw directory
|
||||
cd /root/miSim/aerpaw
|
||||
|
||||
# Activate venv if it exists
|
||||
if [ -d "venv" ]; then
|
||||
@@ -23,22 +23,33 @@ elif [ "$1" = "local" ]; then
|
||||
ENV="local"
|
||||
else
|
||||
echo "Error: Environment not specified."
|
||||
echo "Usage: $0 [local|testbed]"
|
||||
echo "Usage: $0 [local|testbed] [config_file]"
|
||||
echo ""
|
||||
echo " local - Use local/simulation configuration"
|
||||
echo " testbed - Use AERPAW testbed configuration"
|
||||
echo ""
|
||||
echo " config_file - Path to client YAML (default: config/client.yaml)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Client config file (optional 2nd argument)
|
||||
CONFIG_FILE="${2:-config/client.yaml}"
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "Error: Config file not found: $CONFIG_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[run_uav] Environment: $ENV"
|
||||
echo "[run_uav] Config file: $CONFIG_FILE"
|
||||
|
||||
# Export environment for Python to use
|
||||
# Export for Python scripts to use
|
||||
export AERPAW_ENV="$ENV"
|
||||
export AERPAW_CLIENT_CONFIG="$(realpath "$CONFIG_FILE")"
|
||||
|
||||
# Read MAVLink connection from config.yaml using Python
|
||||
# Read MAVLink connection from config file using Python
|
||||
CONN=$(python3 -c "
|
||||
import yaml
|
||||
with open('config/client.yaml') as f:
|
||||
with open('$CONFIG_FILE') as f:
|
||||
cfg = yaml.safe_load(f)
|
||||
env = cfg['environments']['$ENV']['mavlink']
|
||||
print(f\"udp:{env['ip']}:{env['port']}\")
|
||||
|
||||
Reference in New Issue
Block a user