Skip to content

FPV Server Sidecar #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pnpm-debug.log*
lerna-debug.log*

node_modules
build
binaries
*spec
dist
dist-ssr
*.local
Expand Down
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,45 @@ Run the application.
bun tauri dev
```

## Running the Map Server
## Setting up FPV camera server

Ensure Docker is running then install the docker container.
Install Flask and opencv-python dependencies.

```bash
pip install flask
```

```bash
pip install opencv-python
```

</details>

Install pyinstaller, this will be used to compile the `.py` file into a binary.

```bash
pip install pyinstaller
```

Create binary from opencv.py

```bash
pyinstaller --onefile .\src-tauri\opencv.py --distpath .\src-tauri\binaries\
```

Ensure the`opencv` binary is in the `dist` folder. If needed move this into `binaries` folder (if there is already a file, replace it).

Run a Node.js script to rename the binary file, as you must add your architecture to the file name.

```bash
bun run target:triple
```

Now the FPV camera server should run with `bun tauri dev`. It takes time for it to spin up and once it does, make sure you refresh the camera window.

## Setting up map server

Ensure Docker is running then install the docker container. Note only update

```bash
bun run osm:setup
Expand All @@ -39,3 +75,5 @@ Run the Map Server container.
```bash
bun run osm:run
```

</details>
172 changes: 104 additions & 68 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
"osm:run": "docker-compose up osm-server",
"tauri": "tauri",
"format": "prettier --write src/",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"target:triple": "node scripts/target-triple.js"
},
"dependencies": {
"@rushstack/eslint-patch": "^1.10.3",
"@tauri-apps/api": "2.0.0",
"@tauri-apps/plugin-shell": "~2",
"@tauri-apps/plugin-shell": "^2.2.1",
"@vueuse/core": "^12.8.2",
"axios": "^1.6.8",
"class-variance-authority": "^0.7.1",
Expand Down
16 changes: 16 additions & 0 deletions scripts/target-triple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Node.js script to append the target triple to a binary

import { execSync } from 'child_process';
import fs from 'fs';

const extension = process.platform === 'win32' ? '.exe' : '';

const rustInfo = execSync('rustc -vV');
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1];
if (!targetTriple) {
console.error('Failed to determine platform target triple');
}
fs.renameSync(
`src-tauri/binaries/opencv${extension}`,
`src-tauri/binaries/opencv-${targetTriple}${extension}`
);
Loading