Repository navigation
Dashboard
This page explains how to run the Marsy web dashboard on the real 4tronix M.A.R.S. Rover with Raspberry Pi, camera, range mast, manual driving controls, and obstacle avoidance.
The dashboard server runs on the rover. The browser opens from a laptop on the same network.
Mac / browser / local project folder
β ssh / rsync
Raspberry Pi on Marsy
β real backend
motors / steering servos / mast servo / camera / ultrasonic range sensor
The real rover dashboard is a browser-based control panel for Marsy.
It provides:
- live Raspberry Pi camera stream;
- manual drive controls;
- sticky steering controls;
- mast / range sensor controls;
- live distance readout;
- obstacle avoidance mode;
- emergency
STOP; - shutdown button for the dashboard;
- scripts for launching and killing the dashboard process.
The dashboard is intended for MARSY_MODE=real.
SSH into the rover:
ssh marsroverGo to the project folder:
cd ~/marsyStart the dashboard:
./scripts/run_real_dashboard.shThe script should set the real mode and camera rotation automatically:
MARSY_MODE=real
MARSY_CAMERA_ROTATION=90Equivalent manual command:
MARSY_CAMERA_ROTATION=90 MARSY_MODE=real python3 -m marsy_web.server --host 0.0.0.0 --port 8080The important part is:
--host 0.0.0.0This makes the dashboard reachable from another computer on the same network.
Open in the browser:
http://marsrover.local:8080
or by IP address, for example:
http://192.168.3.79:8080
If the UI was recently updated, hard-refresh the browser:
Cmd + Shift + R
The drive pad uses this layout:
β β² β
β Brake βΆ
β βΌ β
Controls:
| Control | Meaning |
|---|---|
β² |
Drive forward while held |
βΌ |
Drive backward while held |
β |
Forward left while held |
β |
Forward right while held |
β |
Reverse left while held |
β |
Reverse right while held |
β |
Steer wheels left and keep them there |
βΆ |
Steer wheels right and keep them there |
Brake |
Brake motors |
STOP |
Emergency stop |
Center wheels |
Return steering servos to center |
Reset pose |
Stop motors and reset wheels / mast where supported |
The left / right buttons are sticky steering:
press β or βΆ β wheels turn and stay turned
press Center wheels β wheels return to center
This is intentional. It allows this workflow:
1. steer wheels left or right
2. drive forward/backward
3. center wheels when needed
Keyboard controls use physical key codes, so they should work even if the keyboard layout is not English.
| Key | Action |
|---|---|
W or β
|
Drive forward while held |
S or β
|
Drive backward while held |
A or β
|
Steer wheels left |
D or β
|
Steer wheels right |
Space |
STOP |
Speed controls motor speed.
Recommended first-test value:
20β30
Do not start with high speed on the floor.
Steering controls how far the steering wheels turn for arc driving and sticky steering.
Recommended values:
20β30Β° normal steering
35β45Β° sharp steering
The LiDAR / range mast panel controls the servo-mounted range sensor.
Current hardware uses the mast-mounted range sensor / ultrasonic sensor. The UI is prepared for future LiDAR-style behavior.
Controls:
| Control | Meaning |
|---|---|
Mast angle |
Move the range mast |
Left |
Turn mast left |
Center |
Center mast |
Right |
Turn mast right |
-60Β° ... 60Β° |
Send mast to a specific angle |
Scan L/C/R |
Measure left / center / right |
Sweep scan |
Sweep several angles and measure distance |
Known physical limit:
Right 90Β° is not reliable on the current hardware.
81Β° works.
The dashboard should avoid sending 90Β° as a hard mast limit.
Distance is displayed in the LiDAR / range mast readout window.
It shows the range sensor measurement in centimeters.
Important:
Distance is measured in the direction where the mast is currently pointing.
Examples:
Mast centered β Distance is roughly forward distance
Mast left β Distance is left-side distance
Mast right β Distance is right-side distance
The value can jump because ultrasonic readings are noisy. This can happen due to:
- angled surfaces;
- floor reflections;
- soft or narrow objects;
- mast vibration;
- sensor echo failures;
- objects too close or too far.
Obstacle avoidance is started from the top bar:
Start Obstacle Avoidance
Stop it with:
Stop Mission
Return the UI to manual mode with:
Manual UI Mode
The dashboard should run obstacle avoidance inside the same dashboard process, not as a competing separate process. This avoids GPIO / PWM conflicts such as:
PWM object already exists for this GPIO channel
Manual forward driving should be guarded by the distance sensor. If an obstacle is too close, forward commands should be blocked or stopped.
Use the kill script:
ssh marsrover "cd ~/marsy && ./scripts/kill_dashboard.sh"Without SSH alias:
ssh astrosheep@marsrover.local "cd ~/marsy && ./scripts/kill_dashboard.sh"On the rover directly:
cd ~/marsy
./scripts/kill_dashboard.shThe script should:
- try the dashboard shutdown API;
- terminate dashboard processes;
- kill stuck dashboard processes if needed;
- free port
8080.
If the camera stack is still stuck after this, reboot the rover.
First stop the dashboard:
ssh marsrover "cd ~/marsy && ./scripts/kill_dashboard.sh"Then shut down the Raspberry Pi:
ssh marsrover "sudo shutdown -h now"Without SSH alias:
ssh astrosheep@marsrover.local "cd ~/marsy && ./scripts/kill_dashboard.sh"
ssh astrosheep@marsrover.local "sudo shutdown -h now"Wait 30β60 seconds before disconnecting power.
If the camera is stuck or the dashboard process cannot recover cleanly:
ssh marsrover "sudo reboot"Wait until the rover comes back:
ping marsrover.localThen start the dashboard again:
ssh marsrover
cd ~/marsy
./scripts/run_real_dashboard.shCheck that the server is running:
ssh marsrover
pgrep -af "marsy_web.server|run_real_dashboard.sh"Check that port 8080 is in use:
ss -ltnp | grep 8080Start again:
cd ~/marsy
./scripts/run_real_dashboard.shKill dashboard:
cd ~/marsy
./scripts/kill_dashboard.shIf needed:
sudo fuser -k 8080/tcpCheck camera package:
python3 -c "from picamera2 import Picamera2; print('picamera2 ok')"Check camera detection:
rpicam-hello --list-camerasIf rpicam-hello is not available:
libcamera-hello --list-camerasIf camera initialization is stuck, reboot:
sudo rebootInstall:
sudo apt update
sudo apt install -y python3-picamera2 rpicam-appsThe current correct value is:
MARSY_CAMERA_ROTATION=90The run script should set it automatically.
Manual launch:
MARSY_CAMERA_ROTATION=90 MARSY_MODE=real python3 -m marsy_web.server --host 0.0.0.0 --port 8080Hard-refresh:
Cmd + Shift + R
If needed, restart dashboard:
ssh marsrover "cd ~/marsy && ./scripts/kill_dashboard.sh && ./scripts/run_real_dashboard.sh"This is common for ultrasonic sensors.
Check:
- mast is centered if measuring forward distance;
- the obstacle is not too close;
- the obstacle is not too angled;
- the rover is not vibrating;
- the sensor is not looking at the floor.
Before running on the floor:
1. Put rover wheels in the air.
2. Start dashboard.
3. Open browser.
4. Set Speed to 20β30.
5. Press STOP.
6. Test Center wheels.
7. Test β / βΆ steering.
8. Test β² forward briefly.
9. Test Brake and STOP.
10. Test mast Left / Center / Right.
11. Test Distance reading.
12. Test Obstacle Avoidance only after manual controls work.
On the floor:
1. Keep speed low.
2. Keep a hand near the power switch.
3. Test STOP first.
4. Test forward with an obstacle in front.
5. Confirm that manual safety guard stops forward motion.
Start dashboard:
ssh marsrover "cd ~/marsy && ./scripts/run_real_dashboard.sh"Stop dashboard:
ssh marsrover "cd ~/marsy && ./scripts/kill_dashboard.sh"Copy changed frontend files:
rsync -av --progress --relative \
marsy_web/static/index.html \
marsy_web/static/app.js \
marsy_web/static/style.css \
marsrover:/home/astrosheep/marsy/Copy server file:
rsync -av --progress --relative \
marsy_web/server.py \
marsrover:/home/astrosheep/marsy/Shutdown rover:
ssh marsrover "cd ~/marsy && ./scripts/kill_dashboard.sh"
ssh marsrover "sudo shutdown -h now"Reboot rover:
ssh marsrover "sudo reboot"