Skip to content

Commit 153494f

Browse files
committed
docs(README): run instructions for fake backend
1 parent 1237705 commit 153494f

1 file changed

Lines changed: 65 additions & 35 deletions

File tree

README.md

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,53 @@
1-
# Purpose
2-
The purpose of RoverGUI is to provide a live camera view to anyone operating the rover via a web browser! While RoverGUI is meant to be used by anyone, it is important to keep in mind that non-autonomous members will likely
3-
be using the GUI as a live camera view like this would not be allowed for Autonomous operation during URC.
1+
# RoverGUI
42

5-
# Dependencies
6-
The following dependencies are under the assertion that both the frontend and backend are running on an **x86-64 linux operation system**. Each bullet is a link to the corresponding dependency's download/install page.
3+
RoverGUI provides a live camera view to anyone operating the rover via a web browser! Non-Autonomous members will likely be using the GUI, so it's easy to use.
74

8-
## Frontend Dependencies
9-
* [NodeJS](https://nodejs.org/en/download)
10-
* [NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
5+
## Usage
6+
7+
First, open two `ssh` windows to the Rover. Run both the backend and frontend, starting **with the backend first**:
8+
9+
In window 1:
10+
11+
```console
12+
~ $ cd RoverGUI/backend
13+
~/RoverGUI/backend $ cargo run
14+
```
15+
16+
In window 2:
17+
18+
```console
19+
~ $ cd RoverGUI/react-app
20+
~/RoverGUI/backend $ npm run start --host
21+
```
22+
23+
From your laptop, **open the GUI in a web browser with its URL**: (i.e., open this link in Firefox/Chrome: [http://192.168.1.68:3000](http://192.168.1.68:3000), where `192.168.1.68` is the Rover's IP address, and ). You should then be presented with a page with a dropdown list of available cameras. Select a camera -- then, a live stream should be visible!
24+
25+
## Dependencies
26+
27+
The following dependencies are under the assertion that both the frontend and backend are running on an **x86-64 Linux operating system**. Each bullet is a link to the corresponding dependency's download/install page.
28+
29+
### Frontend
30+
31+
- [NodeJS](https://nodejs.org/en/download)
32+
- [NPM](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
1133

1234
> [!TIP]
1335
> It is recommended to install NodeJS using the **nvm** package manager on linux. This simplifies the process of both installing and upgrading NodeJS versions. This also automatically installs NPM for you! The NodeJS download page should provide instructions given that **Linux**, **nvm**, and **npm** are selected.
1436
15-
## Backend Dependencies
16-
* [Rust](https://rust-lang.org/tools/install/)
17-
* Video4Linux (v4l)
37+
### Backend
38+
39+
- [Rust](https://rust-lang.org/tools/install/)
40+
- Video4Linux (v4l)
1841

1942
> [!IMPORTANT]
20-
> Video4Linux is a kernel-level driver dependency. Usually it is included with almost all linux distros. If it isn't, please consult your distro's documentation!
43+
> Video4Linux is a kernel-level driver dependency. It is usually included with most Linux distros. If it isn't, please consult your distro's documentation for installation instructions!
44+
45+
## Instructions
46+
47+
### Frontend
48+
49+
#### Installing Frontend's Package Dependencies
2150

22-
# Frontend (`/react-app`)
23-
## Installing Frontend's Package Dependencies
2451
Before running the frontend, you will need to install the package's dependencies using your favorite terminal!
2552

2653
```bash
@@ -54,25 +81,18 @@ npm notice
5481
# Done!
5582
```
5683

57-
## Running the frontend
84+
#### Running the frontend
85+
5886
```bash
5987
# To start the frontend, simply run the following command in the frontend's folder.
60-
npm run start
88+
npm run start --host
6189

6290
# Your output should look like this:
63-
Compiled successfully!
64-
65-
You can now view react-app in the browser.
66-
67-
Local: http://localhost:3000
68-
On Your Network: http://192.168.2.62:3000
91+
VITE v7.3.1 ready in 96 ms
6992

70-
Note that the development build is not optimized.
71-
To create a production build, use npm run build.
72-
73-
webpack compiled successfully
74-
75-
# Done!
93+
➜ Local: http://localhost:5173/
94+
➜ Network: http://192.168.1.68:5173/
95+
➜ press h + enter to show help
7696
```
7797

7898
The URLs that are outputted by this command (i.e. http://localhost:3000) are the same URLs that you use to see the GUI from your web browser. You may hold ctrl and then click on the links to view them or simply copy & paste them into your browser.
@@ -88,11 +108,14 @@ The URLs that are outputted by this command (i.e. http://localhost:3000) are the
88108
Would you like to run the app on another port instead? › (Y/n)
89109
```
90110

91-
## Stopping the frontend
92-
In the same terminal in which you are running the frontend, simply do `Ctrl+C` to send a SIGINT signal to interrupt the frontend (this stops it)!
111+
#### Stopping the frontend
112+
113+
In the same terminal in which you are running the frontend, press `Ctrl+C` to send a SIGINT signal to interrupt the frontend (this stops it)!
114+
115+
### Backend (`/backend`)
116+
117+
#### Building the backend crate and its Cargo dependencies
93118

94-
# Backend (`/backend`)
95-
## Building the backend crate and its Cargo dependencies
96119
Before running the backend, you will need to build the frontend along with all of its dependencies.
97120

98121
```bash
@@ -135,6 +158,7 @@ cargo build
135158
```
136159

137160
## Running the backend
161+
138162
```bash
139163
# Simply run:
140164
cargo run
@@ -176,8 +200,14 @@ arget(s) in 0.24s
176200

177201
The output of this command tells important information about the backend like its address, port, and its available routes. In this case, the frontend would need to access the backend from the URL `http://127.0.0.1:3600`.
178202

179-
## Stopping the backend
203+
### Stopping the backend
204+
180205
In the same terminal in which you are running the backend, simply do `Ctrl+C` to send a SIGINT signal to interrupt the backend (this stops it)!
181206

182-
# Using RoverGUI
183-
Simply open the GUI in a web browser with its URL (i.e. http://localhost:3000). You should then be presented with a page that has a dropdown for the different camera paths that are available on the system. Simply select a path and then the corresponding live camera stream should be visible!
207+
### The "fake" backend
208+
209+
There's a `fake_backend` binary you can use to test the frontend on a non-Linux computer (i.e., macOS or Windows). To use it, just type: `NUM_CAMERAS=1 cargo run --bin fake_backend $NUM_CAMERAS`. You can set `NUM_CAMERAS` to any value you'd like.
210+
211+
Then, open up the frontend as described above. It'll connect successfully!
212+
213+
You can press `Ctrl+C` to stop the fake backend from running.

0 commit comments

Comments
 (0)