Skip to content

Commit

Permalink
Merge pull request #34 from nathanbowness/yoloV8Switch
Browse files Browse the repository at this point in the history
Update tracking to have a delay to simulate processing. Update README
  • Loading branch information
nathanbowness authored Oct 1, 2024
2 parents 35ba312 + 67e6460 commit 3adf4b8
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 19 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/docker-publish-latest-jetson.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3

# Get the commit count from the repository to tag the image
- name: Get Commit Count
run: echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
# Read the version from version.yaml
- name: Read Version from version.yaml
id: read_version
run: |
VERSION=$(cat version.yaml | grep 'version:' | cut -d ' ' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Using version: $VERSION"
- name: Log in to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
Expand All @@ -34,4 +38,4 @@ jobs:
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/uav-experiments:latest-jetson-jetpack5
${{ secrets.DOCKER_USERNAME }}/uav-experiments:0.1.${{ env.COMMIT_COUNT }}-jetson-jetpack5
${{ secrets.DOCKER_USERNAME }}/uav-experiments:${{ env.VERSION }}-jetson-jetpack5
12 changes: 8 additions & 4 deletions .github/workflows/docker-publish-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3

# Get the commit count from the repository to tag the image
- name: Get Commit Count
run: echo "COMMIT_COUNT=$(git rev-list --count HEAD)" >> $GITHUB_ENV
# Read the version from version.yaml
- name: Read Version from version.yaml
id: read_version
run: |
VERSION=$(cat version.yaml | grep 'version:' | cut -d ' ' -f 2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Using version: $VERSION"
- name: Log in to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
Expand All @@ -26,4 +30,4 @@ jobs:
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/uav-experiments:latest
${{ secrets.DOCKER_USERNAME }}/uav-experiments:0.1.${{ env.COMMIT_COUNT }}
${{ secrets.DOCKER_USERNAME }}/uav-experiments:${{ env.VERSION }}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ docker build . -f Dockerfile-jetson-jetpack5 uav-experiments:latest-jetson-jetpa
```

## Update Image Tag
You can update the tag to simply the process for running the container locally. The local name `tracking` will be used for all following examples and commands to simplify the documentation.
You can update the tag to simply the process for running the container locally. The local name `tracking-image` will be used for all following examples and commands to simplify the documentation.
```bash
docker tag nbowness/uav-experiments:latest-jetson-jetpack5 tracking
docker tag nbowness/uav-experiments:latest-jetson-jetpack5 tracking-image
```

## Running the Container On WSL, Linux
Expand All @@ -40,7 +40,7 @@ docker tag nbowness/uav-experiments:latest-jetson-jetpack5 tracking
docker run -v "$(pwd)"/data:/data -v "$(pwd)"/configuration:/configuration -v "$(pwd)"/output:/output -it tracking-image

# Run elements, non interactive
docker run -v "$(pwd)"/data:/data -v "$(pwd)"/configuration:/configuration -v "$(pwd)"/output:/output tracking-image python3 tracking.py --skip-radar
docker run -v "$(pwd)"/data:/data -v "$(pwd)"/configuration:/configuration -v "$(pwd)"/output:/output -it tracking-image python3 tracking.py --skip-radar

# Run with UI elements active.
xhost +local:docker && docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.Xauthority:/root/.Xauthority -v "$(pwd)"/data:/data -v "$(pwd)"/configuration:/configuration -v "$(pwd)"/output:/output -it tracking-image
Expand All @@ -54,7 +54,9 @@ docker run -v "$(pwd)"/data:/data -v "$(pwd)"/configuration:/configuration -it t
When running on Jetson. Jetson equips iGPU rather than the dGPU. The OS is also a customized l4t rather than standard Linux. You can use --runtime=nvidia and by default, it will enable GPU for usage.
```bash
# Run the container interactively
docker run -v "$(pwd)"/data:/data --runtime=nvidia -it tracking-image-json
docker run -v "$(pwd)"/data:/data -v "$(pwd)"/output:/output --ipc=host --runtime=nvidia -it tracking-image
# After being inside the container, you can run the following:
python3 tracking.py --radar-start-delay 30 # Add 30 second delay, since loading the Yolo model on Jetson takes a while
```

### Easily overwrite configuration in the container
Expand Down
4 changes: 2 additions & 2 deletions configuration/RadarConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ cfarParams:
run: LIVE # Options are LIVE, RERUN
sourcePath: "/data/radar/run2-TD/" # Path to the data to be processed for RERUN mode

recordData: true # Record radar data to disk
recordData: True # Record radar data to disk
recordDataPath: "/output" # Path to the data to be recorded

# How many Radar results to keep in the buffer for analysis and CFAR
processingWindow: 200

# Print radar runtime settings to console on startup
printSettings: true
printSettings: True
4 changes: 2 additions & 2 deletions radar/configuration/RadarConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def load_config(self):
self.apply_defaults()

# Print settings if enabled
if self.print_settings:
print(self)
# if self.print_settings:
# print(self)

def apply_defaults(self):
"""
Expand Down
13 changes: 10 additions & 3 deletions radar/radar_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np

import multiprocessing as mp
import time

from radar.cfar import get_range_bin_for_indexs
from radar.configuration.RunType import RunType
Expand Down Expand Up @@ -56,7 +57,7 @@ def process_live_data(self, stop_event):
Process the radar data from the radar module until the stop event is set.
"""
if self.config.record_data:
print(f"Running radar tracking on live data. Recording raw results to folder: {self.config.output_path}")
print(f"Running radar tracking on live data. Recording raw results to folder: {self.output_dir}")
os.makedirs(self.output_dir, exist_ok=True)
self.export_radar_config_to_file(self.output_dir)
else:
Expand All @@ -67,6 +68,11 @@ def process_live_data(self, stop_event):

while not stop_event.is_set():
voltage_data = get_td_data_voltage(self.radar_module)
if voltage_data is None:
# There was likely an error - reset error code, try again
self.radar_module.error = False
continue

if self.config.record_data:
voltage_data.print_data_to_file(self.output_dir)

Expand Down Expand Up @@ -99,7 +105,8 @@ def process_time_domain_data(self, td_data):
# TODO - convert the TDData to FDDataMatrix, for processing.. Need FD for this (or do it in the RadarWindow itself)
# self.radar_window.add_raw_record(td_data)
# self.radar_window.calculate_detections(record_timestamp=td_data.timestamp)


time.sleep(0.2) # Simulate the processing time
# Until we have enough records for CFAR or analysis, just continue
if(len(self.radar_window.get_raw_records()) < self.radar_window.required_cells_cfar):
return
Expand Down Expand Up @@ -129,7 +136,7 @@ def export_radar_config_to_file(self, output_dir, output_file="RadarConfiguratio
f"Ramp Time [ms]:\t{self.config.ramp_time_fmcw_chirp}\n"
f"Attenuation [dB]:\t{sysParmas.atten}\n"
f"Bin Size [mm]:\t{formatted_bin_size_mm}\n"
f"Number of Samples:\t512\n"
f"Number of Samples:\t1024\n"
f"Bin Size [Hz]:\t{sysParmas.freq_bin}\n"
f"Zero Pad Factor:\t{sysParmas.zero_pad}\n"
f"Normalization:\t{sysParmas.norm}\n"
Expand Down
4 changes: 4 additions & 0 deletions radar/radarprocessing/get_td_sensor_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def get_td_data_voltage(radar_module: RadarModule, ramp_type: str = "UP-Ramp") -
Return the TD data in voltage format.
"""
radar_module.GetTdData(measurement=ramp_type)
# If there's an error return, we'll try again
if radar_module.error:
return None

time = pd.Timestamp.now()
n_samples = 1024

Expand Down
1 change: 1 addition & 0 deletions version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 0.1.2

0 comments on commit 3adf4b8

Please sign in to comment.