Skip to content

Dashboard

Margarita Matson edited this page Jul 14, 2026 · 2 revisions

Marsy Real Rover Web 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

What this dashboard is

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.


Starting the dashboard

SSH into the rover:

ssh marsrover

Go to the project folder:

cd ~/marsy

Start the dashboard:

./scripts/run_real_dashboard.sh

The script should set the real mode and camera rotation automatically:

MARSY_MODE=real
MARSY_CAMERA_ROTATION=90

Equivalent manual command:

MARSY_CAMERA_ROTATION=90 MARSY_MODE=real python3 -m marsy_web.server --host 0.0.0.0 --port 8080

The important part is:

--host 0.0.0.0

This makes the dashboard reachable from another computer on the same network.


Opening the dashboard

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

User interface guide

Manual drive

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

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

Speed controls motor speed.

Recommended first-test value:

20–30

Do not start with high speed on the floor.

Steering

Steering controls how far the steering wheels turn for arc driving and sticky steering.

Recommended values:

20–30Β° normal steering
35–45Β° sharp steering

LiDAR / range mast

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

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

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.


Correctly stopping the dashboard

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.sh

The script should:

  1. try the dashboard shutdown API;
  2. terminate dashboard processes;
  3. kill stuck dashboard processes if needed;
  4. free port 8080.

If the camera stack is still stuck after this, reboot the rover.


Correctly shutting down 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.


Rebooting the rover

If the camera is stuck or the dashboard process cannot recover cleanly:

ssh marsrover "sudo reboot"

Wait until the rover comes back:

ping marsrover.local

Then start the dashboard again:

ssh marsrover
cd ~/marsy
./scripts/run_real_dashboard.sh

Troubleshooting

Dashboard does not open

Check 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 8080

Start again:

cd ~/marsy
./scripts/run_real_dashboard.sh

Port already in use

Kill dashboard:

cd ~/marsy
./scripts/kill_dashboard.sh

If needed:

sudo fuser -k 8080/tcp

Camera does not start

Check camera package:

python3 -c "from picamera2 import Picamera2; print('picamera2 ok')"

Check camera detection:

rpicam-hello --list-cameras

If rpicam-hello is not available:

libcamera-hello --list-cameras

If camera initialization is stuck, reboot:

sudo reboot

Picamera2 missing

Install:

sudo apt update
sudo apt install -y python3-picamera2 rpicam-apps

Camera image rotated wrong

The current correct value is:

MARSY_CAMERA_ROTATION=90

The 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 8080

UI changes do not appear

Hard-refresh:

Cmd + Shift + R

If needed, restart dashboard:

ssh marsrover "cd ~/marsy && ./scripts/kill_dashboard.sh && ./scripts/run_real_dashboard.sh"

Distance jumps

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.

Safe first test checklist

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.

Common commands

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"

Clone this wiki locally