Skip to content

Commit

Permalink
Add in 3D printed files and readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
misko committed Dec 29, 2023
1 parent 13d655e commit 9b55a1d
Show file tree
Hide file tree
Showing 38 changed files with 686 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
**/.DS_Store
**/__pycache__
spf/data
**/*.npy
**/*.zip
test_data
test_data.zip
test_data_dl.zip
test_data.txt
.ipynb_checkpoints
**/.ipynb_checkpoints
**/.ipynb_checkpoints
**/*.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ module array_mount() {

}

//sdr_unit();
sdr_unit();


array_mount();
//array_mount();



6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# SPF (Signal Processing Fun)

## Youtube explanation

[Overview](https://www.youtube.com/watch?v=vj99KvB2AcA)

[Wall array v1](https://youtu.be/ljlRKGjBUoE)

## Problem statement:

Given a mobile radio receiver (agent/detector) find the optimal (minimal) path of movement to accurately locate physical radio emitters in the operating space
Expand Down
3 changes: 3 additions & 0 deletions data_collection_experiments/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Data Collection Experiments

## Simulated
Binary file not shown.
Binary file not shown.
Binary file not shown.
122 changes: 122 additions & 0 deletions data_collection_model_and_results/2d_wall_array_v1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# 2D wall array (v1)

[see it in action!](https://studio.youtube.com/video/2BFlrQI8Ydw)

Instead of simulations we can collect real world data by moving a emitter around in 2D space while keeping our receiver in a fixed location.

![v1 hardware setup](v1_hardware_setup.png)

## Youtube explanation

[Overview](https://www.youtube.com/watch?v=vj99KvB2AcA)

[Wall array v1](https://youtu.be/ljlRKGjBUoE)

## Construction

Building a 2D apparatus like this can be difficult because each axis would require some kind of long lead screw. These can get diffcult to manage and costly if we exceed 1m. Instead of constructing the apparatus orthogonal to gravity we can leverage gravity to keep a suspended system taut.

We construct an appartus with our emitter attach by two arms (ArmA, ArmB) to motors on the wall (MotorA, MotorB). By operating MotorA/B we can change the length of the arms that exactly define the position of the emmitter on the wall (see [code](/spf/grbl/grbl_interactive.py)).

### 3D printed files

Thanks to great work by [@dammitcoetzee](https://github.com/dammitcoetzee) , we have 3D printable motor mounts designed on OnShape and STL files available.

[3D printable parts](3D_printed_parts/)

![Apparatus setup](onshape_setup.png)

### Bill of materials

* 2 x 27:1 Planetary Gearbox Nema 17 Stepper Motor [link](https://www.amazon.com/gp/product/B00WAUKZWG)
* 1 x ARM 32-bit 4 Axis GRBL 1.1f [link](https://www.amazon.com/gp/product/B09SZDTBHS)
* ? x Timing Belt 2GT 10mm Width[link](https://www.amazon.com/gp/product/B07PGHTSLT)
* 2 x GT2 Pulley 20 Teeth 5mm Bore Fit 10mm Belt Width[link](https://www.amazon.com/gp/product/B09X18H75P)
* 1 x GT2 Idler Pulley 20 Teeth 5mm Bore 10mm Width[link](https://www.amazon.com/gp/product/B07BPKX47Y)
* 3 x 2.5lb weight [link](https://www.amazon.com/gp/product/B09NLFHMMH)
* M3 screws
* 2 x 3D printed motor mounts
* Pulley holder
* 2 x PlutoPlus SDR
* ? x 18/4 Awg cabling (for steppers) [link](https://www.amazon.com/gp/product/B01GZ50P7Q)
* 4 x bingfu 2.4ghz antenna [link](https://www.amazon.com/gp/product/B09J8N8TXW/)
* ? x SMA terminals [link](https://www.amazon.com/gp/product/B07G2PBZBL)
* ? x 12inch SMA Female -> Male [link](https://www.amazon.com/gp/product/B07MJQWH8S)

## Results

Ontop of this data several models were trained using TrajectoryNet. Sample command lines can be found towards the end of the file [here](commands).

127486 minibatch updates were perfomed to simultaneously train 4 versions of TrajectoryNet with varying number of layers (1,2,4,8).

### Loss objectives

There were two loss objectives being optimized for
* Single snapshot prediction: Using a single radio measurement in time , predict the position of the emitter
* Trajectory prediction: Using multiple radio measurements over time , predict the full (including future) trajectory of the emitter

### Training
![Training loss](results/real/output_mb64_reference_lr0.001_real_loss_Train_127486.png)
Left: Single snapshot loss. Center: Trajectory prediciton loss.

![Training example: it76799](results/real/output_mb64_reference_lr0.001_real_TrajectoryNet_l4_76799_train.png)
Left: Ground truth, receiver is stationary, emitter is moving. Center: Single snapshot predictions. Right: Trajectory prediction

### Testing
![Test loss](results/real/output_mb64_reference_lr0.001_real_loss_Test_127486.png)
Left: Single snapshot loss. Center: Trajectory prediciton loss.

![Test example: it76799](results/real/output_mb64_reference_lr0.001_real_TrajectoryNet_l4_76799_test.png)
Left: Ground truth, receiver is stationary, emitter is moving. Center: Single snapshot predictions. Right: Trajectory prediction

### Equivalent simulated data

To see how well simulations perform relative to the above real data , equivalent experiments were performed.

### Training
![Training loss](results/sim/output_mb64_reference_lr0.001_loss_Train_118270.png)
Left: Single snapshot loss. Center: Trajectory prediciton loss.

![Training example: it76799](results/sim/output_mb64_reference_lr0.001_TrajectoryNet_l4_118271_train.png)
Left: Ground truth, receiver is stationary, emitter is moving. Center: Single snapshot predictions. Right: Trajectory prediction

### Testing
![Test loss](results/sim/output_mb64_reference_lr0.001_loss_Test_118270.png)
Left: Single snapshot loss. Center: Trajectory prediciton loss.

![Test example: it76799](results/sim/output_mb64_reference_lr0.001_TrajectoryNet_l4_118271_test.png)
Left: Ground truth, receiver is stationary, emitter is moving. Center: Single snapshot predictions. Right: Trajectory prediction

## Data

The data was collected using this [code](https://github.com/misko/spf/blob/3fd9fbcd7fd192fb53045ff7109e15664a48983b/software/grbl_sdr_collect.py#L42). The fulldata set has a couple hundred hours of recordings.

### Example usage

An example for how to use this data is shown [here](/spf/notebooks/load_real_data_session.ipynb).

### Format

The format is a flat file shaped as (N,5+65) float32 values. It is formatted this way to allow for quick loading via memmap.

The values in each row are as follows,

0) time_stamp
1) x position
2) y position
3) average phase difference
4) average phase difference with trimmed mean
5) index 5~69 contains the signal strengths for each of 65 directions [-pi,+pi] computed using the beamformer


### Dataloader

An example data loader can be found [here](https://github.com/misko/spf/blob/0a19260e9d5acec31f8c16b43fd75d85143b6a02/spf/dataset/spf_dataset.py#L98)

### Download

The complete dataset can be downloaded [here](https://www.dropbox.com/s/z2npdruftr57q48/data_dec2023.zip?dl=0)

A small subset of the data above can be downloaded [here](https://www.dropbox.com/s/zt7md2c9fpbgnc6/sample_data_dec2023.zip?dl=0)


Loading

0 comments on commit 9b55a1d

Please sign in to comment.