49 Commits

Author SHA1 Message Date
b09f882369 added more radio metrics 2026-03-09 21:23:31 -07:00
cdbfaebc17 added modified AERPAW scripts 2026-03-09 21:23:31 -07:00
1b4fec0f72 plot script fixes 2026-03-09 21:23:31 -07:00
cd3463d479 finalized plotting utility 2026-03-09 21:23:31 -07:00
624b2bdcb2 type error fix 2026-03-09 21:23:31 -07:00
6da0c97abf added radio plotting tools 2026-03-09 21:23:31 -07:00
3c775cf814 plotting update 2026-03-09 21:23:31 -07:00
1562fdc351 fixed GPS log out path 2026-03-09 21:23:31 -07:00
a706857374 radio experiment TDM working 2026-03-09 21:23:31 -07:00
8c5811ff6a seems to line up well again, constrainMotion updates 2026-03-09 21:23:31 -07:00
14201aff5d scenario update, quadprog issue 2026-03-09 21:23:31 -07:00
532e37f133 obstacle respected now 2026-03-09 21:23:31 -07:00
986f4e2dcf obstacles in but ignored 2026-03-09 21:23:31 -07:00
c18b470706 scenario - obstacle - one around, one over 2026-03-09 21:23:31 -07:00
438ebda388 per-UAV parameters 2026-03-09 21:23:31 -07:00
f40d2bfd84 moved reader out of miSim, went to event-based guidance 2026-03-09 21:23:31 -07:00
117d34590e removed prompt to continue 2026-03-09 21:23:31 -07:00
7da35c5cda results compare favorably 2026-03-09 21:23:31 -07:00
05ac8a6e97 scenario edits 2026-03-09 21:23:31 -07:00
813b124c47 improved globe plotting 2026-03-09 21:23:31 -07:00
5408a31d56 moved origin to get more space from geofence 2026-03-09 21:23:31 -07:00
1d4f59734b scenario csv on both platforms 2026-03-09 21:23:31 -07:00
5e52292b71 added slack in collision avoidance constraint 2026-03-09 21:23:31 -07:00
f1c2df31d9 csv parse update 2026-03-09 21:23:31 -07:00
c19f65c3a1 testing fixes 2026-03-09 21:23:31 -07:00
dbba95c6a9 added constraint violation recovery mechanism 2026-03-09 21:23:31 -07:00
1ada914384 codegen fixes, bug fixes, gets running on testbed environment 2026-03-09 21:23:31 -07:00
58d87cd16f gps log plotting 2026-03-09 21:23:31 -07:00
cec6458f7c aerpaw gps csv reader 2026-03-09 21:23:31 -07:00
9385b9bd06 gps logging updates 2026-03-09 21:23:31 -07:00
d25287cdf9 respect geofence, move from socket to async/await 2026-03-09 21:23:31 -07:00
61e440b594 more config cleanup 2026-03-09 21:23:31 -07:00
dbb4ba178a config cleanup 2026-03-09 21:23:31 -07:00
cde86065e9 project cleanup 2026-03-09 21:23:31 -07:00
87d925ba5c logging consistency 2026-03-09 21:23:31 -07:00
0e9f494c50 message type updates 2026-03-09 21:23:31 -07:00
bcfaad1817 removed potentially faulty environment detection in favor of explicit setting 2026-03-09 21:23:31 -07:00
1475d9e7d1 refactor experiment config 2026-03-09 21:23:31 -07:00
ee238f239d added parallel message receiving for previously implemented messaging where necessary 2026-03-09 21:23:31 -07:00
4cdcb16ee3 added RTL and LAND capabilities 2026-03-09 21:23:31 -07:00
9705c1e952 kinda working 2026-03-09 21:23:31 -07:00
8002336ba1 added real autopilot connection info 2026-03-09 21:23:31 -07:00
cb61ddb161 allowed connection to real autopilot 2026-03-09 21:23:31 -07:00
4d08e2c88a added aerpawlib capabilities to uav script 2026-03-09 21:23:31 -07:00
c8b54a30aa reorganized and added aerpawlib submodule 2026-03-09 21:23:31 -07:00
1ae617d5f7 sending starting positions to agents (not verified on AERPAW yet) 2026-03-09 21:23:31 -07:00
fa5d63361c cleanup demo 2026-03-09 21:23:31 -07:00
8abd009aed basic implementation of client/server for AERPAW, whole lot of mess included 2026-03-09 21:23:31 -07:00
20417f240c experiment setup 2026-03-09 21:23:31 -07:00
10 changed files with 175 additions and 17 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "aerpaw/aerpawlib"]
path = aerpaw/aerpawlib
url = https://github.com/morzack/aerpawlib-vehicle-control.git

Submodule aerpaw/aerpawlib deleted from 705fc699ef

View File

@@ -267,6 +267,10 @@ class CSwSNRRX(gr.top_block):
'/root/Quality', num_uavs, slot_duration, guard_interval) '/root/Quality', num_uavs, slot_duration, guard_interval)
self.blocks_file_sink_0 = TdmTaggedFileSink( self.blocks_file_sink_0 = TdmTaggedFileSink(
'/root/Power', num_uavs, slot_duration, guard_interval) '/root/Power', num_uavs, slot_duration, guard_interval)
self.blocks_file_sink_noisefloor = TdmTaggedFileSink(
'/root/NoiseFloor', num_uavs, slot_duration, guard_interval)
self._freqoffset_file = open('/root/FreqOffset', 'w')
self._freqoffset_file.write('tx_uav_id,value\n')
self.blocks_divide_xx_0 = blocks.divide_ff(1) self.blocks_divide_xx_0 = blocks.divide_ff(1)
self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0_0 = blocks.complex_to_real(1)
self.blocks_complex_to_real_0 = blocks.complex_to_real(1) self.blocks_complex_to_real_0 = blocks.complex_to_real(1)
@@ -310,6 +314,7 @@ class CSwSNRRX(gr.top_block):
self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_add_const_vxx_0, 0)) self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_add_const_vxx_0, 0))
self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_sub_xx_0, 0)) self.connect((self.blocks_nlog10_ff_0_0, 0), (self.blocks_sub_xx_0, 0))
self.connect((self.blocks_nlog10_ff_0_0_0, 0), (self.blocks_sub_xx_0, 1)) self.connect((self.blocks_nlog10_ff_0_0_0, 0), (self.blocks_sub_xx_0, 1))
self.connect((self.blocks_nlog10_ff_0_0_0, 0), (self.blocks_file_sink_noisefloor, 0))
self.connect((self.blocks_stream_to_vector_0_0, 0), (self.epy_block_0, 0)) self.connect((self.blocks_stream_to_vector_0_0, 0), (self.epy_block_0, 0))
self.connect((self.blocks_sub_xx_0, 0), (self.blocks_file_sink_0_0_0, 0)) self.connect((self.blocks_sub_xx_0, 0), (self.blocks_file_sink_0_0_0, 0))
self.connect((self.blocks_vector_to_stream_0_0, 0), (self.blocks_keep_m_in_n_0, 0)) self.connect((self.blocks_vector_to_stream_0_0, 0), (self.blocks_keep_m_in_n_0, 0))
@@ -321,6 +326,26 @@ class CSwSNRRX(gr.top_block):
self.connect((self.freq_xlating_fft_filter_ccc_0_0, 0), (self.blocks_stream_to_vector_0_0, 0)) self.connect((self.freq_xlating_fft_filter_ccc_0_0, 0), (self.blocks_stream_to_vector_0_0, 0))
self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_xx_0, 0))
##################################################
# Frequency offset polling thread
##################################################
def _freq_offset_probe():
frame_dur = slot_duration * num_uavs
while True:
val = self.digital_fll_band_edge_cc_0_0.get_frequency()
freq_hz = val * samp_rate / (2 * math.pi)
now = time.time()
slot_time = now % frame_dur
current_slot = int(slot_time / slot_duration)
time_into_slot = slot_time - current_slot * slot_duration
tx_id = -1 if time_into_slot < guard_interval else current_slot
self._freqoffset_file.write(f'{tx_id},{freq_hz}\n')
self._freqoffset_file.flush()
time.sleep(0.01)
_freq_offset_thread = threading.Thread(target=_freq_offset_probe)
_freq_offset_thread.daemon = True
_freq_offset_thread.start()
def get_args(self): def get_args(self):
return self.args return self.args

View File

@@ -24,16 +24,25 @@ function [f, R] = plotRadioLogs(resultsPath)
R{ii}(bad, :) = []; R{ii}(bad, :) = [];
end end
% Compute path loss from Power (post-processing)
% Power = 20*log10(peak_mag) - rxGain; path loss = txGain - rxGain - Power
txGain_dB = 76; % from startchannelsounderTXGRC.sh GAIN_TX
rxGain_dB = 30; % from startchannelsounderRXGRC.sh GAIN_RX
for ii = 1:numel(R)
R{ii}.PathLoss = txGain_dB - rxGain_dB - R{ii}.Power;
R{ii}.FreqOffset = R{ii}.FreqOffset / 1e6; % Hz to MHz
end
% Build legend labels and color map for up to 4 UAVs % Build legend labels and color map for up to 4 UAVs
nUAV = numel(R); nUAV = numel(R);
colors = lines(nUAV * nUAV); colors = lines(nUAV * nUAV);
styles = ["-o", "-s", "-^", "-d", "-v", "-p", "-h", "-<", "->", "-+", "-x", "-*"]; styles = ["-o", "-s", "-^", "-d", "-v", "-p", "-h", "-<", "->", "-+", "-x", "-*"];
metricNames = ["SNR", "Power", "Quality"]; metricNames = ["SNR", "Power", "Quality", "PathLoss", "NoiseFloor", "FreqOffset"];
yLabels = ["SNR (dB)", "Power (dB)", "Quality"]; yLabels = ["SNR (dB)", "Power (dB)", "Quality", "Path Loss (dB)", "Noise Floor (dB)", "Freq Offset (MHz)"];
f = figure; f = figure;
tl = tiledlayout(3, 1, 'TileSpacing', 'compact', 'Padding', 'compact'); tl = tiledlayout(numel(metricNames), 1, 'TileSpacing', 'compact', 'Padding', 'compact');
for mi = 1:numel(metricNames) for mi = 1:numel(metricNames)
ax = nexttile(tl); ax = nexttile(tl);

View File

@@ -4,19 +4,19 @@ function R = readRadioLogs(logPath)
end end
arguments (Output) arguments (Output)
R (:, 6) table; R (:, 8) table;
end end
% Extract receiving UAV ID from directory name (e.g. "uav0_..." 0) % Extract receiving UAV ID from directory name (e.g. "uav0_..." 0)
[~, dirName] = fileparts(logPath); [~, dirName] = fileparts(logPath);
rxID = int32(sscanf(dirName, 'uav%d')); rxID = int32(sscanf(dirName, 'uav%d'));
metrics = ["quality", "snr", "power"]; metrics = ["quality", "snr", "power", "noisefloor", "freqoffset"];
logs = dir(logPath); logs = dir(logPath);
logs = logs(endsWith({logs(:).name}, metrics + "_log.txt")); logs = logs(endsWith({logs(:).name}, metrics + "_log.txt"));
R = table(datetime.empty(0,1), zeros(0,1,'int32'), zeros(0,1,'int32'), zeros(0,1), zeros(0,1), zeros(0,1), ... R = table(datetime.empty(0,1), zeros(0,1,'int32'), zeros(0,1,'int32'), zeros(0,1), zeros(0,1), zeros(0,1), zeros(0,1), zeros(0,1), ...
'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality"]); 'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality", "NoiseFloor", "FreqOffset"]);
for ii = 1:numel(logs) for ii = 1:numel(logs)
filepath = fullfile(logs(ii).folder, logs(ii).name); filepath = fullfile(logs(ii).folder, logs(ii).name);
@@ -43,13 +43,15 @@ function R = readRadioLogs(logPath)
val = data{3}; val = data{3};
n = numel(ts); n = numel(ts);
t = table(ts, txId, repmat(rxID, n, 1), NaN(n,1), NaN(n,1), NaN(n,1), ... t = table(ts, txId, repmat(rxID, n, 1), NaN(n,1), NaN(n,1), NaN(n,1), NaN(n,1), NaN(n,1), ...
'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality"]); 'VariableNames', ["Timestamp", "TxUAVID", "RxUAVID", "SNR", "Power", "Quality", "NoiseFloor", "FreqOffset"]);
switch metric switch metric
case "snr", t.SNR = val; case "snr", t.SNR = val;
case "power", t.Power = val; case "power", t.Power = val;
case "quality", t.Quality = val; case "quality", t.Quality = val;
case "noisefloor", t.NoiseFloor = val;
case "freqoffset", t.FreqOffset = val;
end end
R = [R; t]; %#ok<AGROW> R = [R; t]; %#ok<AGROW>

View File

@@ -1,5 +1,5 @@
%% Plot AERPAW logs (trajectory, radio) %% Plot AERPAW logs (trajectory, radio)
resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "t1"); % Define path to results copied from AERPAW platform resultsPath = fullfile(matlab.project.rootProject().RootFolder, "sandbox", "t2"); % Define path to results copied from AERPAW platform
% Plot GPS logged data and scenario information (domain, objective, obstacles) % Plot GPS logged data and scenario information (domain, objective, obstacles)
seaToGroundLevel = 110; % measured approximately from USGS national map viewer seaToGroundLevel = 110; % measured approximately from USGS national map viewer

43
aerpaw/scripts/startRadio.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
#RX
cd $PROFILE_DIR"/ProfileScripts/Radio/Helpers"
screen -S rxGRC -dm \
bash -c "stdbuf -oL -eL ./startchannelsounderRXGRC.sh \
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_radio_channelsounderrxgrc_log.txt"
screen -S power -dm \
bash -c "stdbuf -oL -eL tail -F /root/Power\
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_power_log.txt"
screen -S quality -dm \
bash -c "stdbuf -oL -eL tail -F /root/Quality\
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_quality_log.txt"
screen -S snr -dm \
bash -c "stdbuf -oL -eL tail -F /root/SNR\
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_snr_log.txt"
screen -S noisefloor -dm \
bash -c "stdbuf -oL -eL tail -F /root/NoiseFloor\
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_noisefloor_log.txt"
screen -S freqoffset -dm \
bash -c "stdbuf -oL -eL tail -F /root/FreqOffset\
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_freqoffset_log.txt"
#TX
screen -S txGRC -dm \
bash -c "stdbuf -oL -eL ./startchannelsounderTXGRC.sh \
2>&1 | ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_radio_channelsoundertxgrc_log.txt"
cd -

30
aerpaw/scripts/startVehicle.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
### Sample GPS logger portion
# use vehicle type generic to skip the arming requirement
export VEHICLE_TYPE="${VEHICLE_TYPE:-generic}"
# GPS Logger sample application (this does not move the vehicle)
#cd $PROFILE_DIR"/ProfileScripts/Vehicle/Helpers"
#
#screen -S vehicle -dm \
# bash -c "stdbuf -oL -eL ./gpsLoggerHelper.sh \
# 2> >(ts $TS_FORMAT >> $RESULTS_DIR/${LOG_PREFIX}_vehicle_log_err.txt) \
# | ts $TS_FORMAT \
# | tee $RESULTS_DIR/$LOG_PREFIX\_vehicle_log.txt"
#
#cd -
### Actual control portion (custom)
export VEHICLE_TYPE="${VEHICLE_TYPE:-drone}" # out of rover, drone, generic
cd /root/miSim/aerpaw
# Use screen/ts/tee aerpawism from sample script
screen -S vehicle -dm \
bash -c "stdbuf -oL -eL ./run_uav.sh testbed /root/miSim/aerpaw/config/client1.yaml \
| ts $TS_FORMAT \
| tee $RESULTS_DIR/$LOG_PREFIX\_vehicle_log.txt"
cd -

View File

@@ -0,0 +1,53 @@
#!/bin/bash
/root/stopexperiment.sh
source /root/.ap-set-experiment-env.sh
source /root/.bashrc
# set path to client config YAML
export AERPAW_CLIENT_CONFIG=/root/miSim/aerpaw/config/client1.yaml
export AERPAW_REPO=${AERPAW_REPO:-/root/AERPAW-Dev}
export AERPAW_PYTHON=${AERPAW_PYTHON:-python3}
export PYTHONPATH=/usr/local/lib/python3/dist-packages/
export EXP_NUMBER=${EXP_NUMBER:-1}
if [ "$AP_EXPENV_THIS_CONTAINER_NODE_VEHICLE" == "vehicle_uav" ]; then
export VEHICLE_TYPE=drone
elif [ "$AP_EXPENV_THIS_CONTAINER_NODE_VEHICLE" == "vehicle_ugv" ]; then
export VEHICLE_TYPE=rover
else
export VEHICLE_TYPE=none
fi
if [ "$AP_EXPENV_SESSION_ENV" == "Virtual" ]; then
export LAUNCH_MODE=EMULATION
elif [ "$AP_EXPENV_SESSION_ENV" == "Testbed" ]; then
export LAUNCH_MODE=TESTBED
else
export LAUNCH_MODE=none
fi
# prepare results directory
export UAV_ID=$(python3 -c "import yaml; print(yaml.safe_load(open('$AERPAW_CLIENT_CONFIG'))['uav_id'])")
export RESULTS_DIR_TIMESTAMP=$(date +%Y-%m-%d_%H_%M_%S)
export RESULTS_DIR="/root/Results/uav${UAV_ID}_${RESULTS_DIR_TIMESTAMP}"
mkdir -p "$RESULTS_DIR"
export TS_FORMAT="${TS_FORMAT:-'[%Y-%m-%d %H:%M:%.S]'}"
export LOG_PREFIX="$(date +%Y-%m-%d_%H_%M_%S)"
export TX_FREQ=3.32e9
export RX_FREQ=3.32e9
export PROFILE_DIR=$AERPAW_REPO"/AHN/E-VM/Profile_software"
cd $PROFILE_DIR"/ProfileScripts"
./Radio/startRadio.sh
#./Traffic/startTraffic.sh
./Vehicle/startVehicle.sh
schedule_stop.sh 30

BIN
t1.zip

Binary file not shown.