Skip to content

Explore Area Mission

Margarita Matson edited this page Jul 15, 2026 · 1 revision

explore_area is Marsy's first mapping and autonomous exploration mission.

The mission moves through an area, performs repeated ultrasonic scans, avoids trusted obstacles, permits cautious progress when sonar data is uncertain, and builds a lightweight occupancy map.

Main files:

missions/explore_area.py
behaviors/explore_navigation.py
skills/marsy_skills.py
skills/mapping.py

Mission status

The current implementation is SLAM-lite, not full SLAM.

It combines:

ultrasonic mast scans
sparse occupancy mapping
path recording
simulator pose or dead reckoning
local forward-first navigation
stateful committed obstacle turns

It does not yet include:

visual odometry
wheel-encoder odometry
loop closure
global map optimization
automatic correction of accumulated pose drift

The map is currently used primarily for visualization, telemetry, debugging, and future navigation development.

On the physical rover, local sonar decisions control movement. Map-frontier scores do not directly steer every action because dead-reckoning error is still too large.


Starting the mission

From the dashboard

Connect to Marsy:

ssh astrosheep@marsrover.local

Start the existing dashboard script:

cd /home/astrosheep/marsy
./scripts/run_real_dashboard.sh

Open:

http://marsrover.local:8080/

Select:

Missions β†’ Explore area

Set the parameters and press Start mission.

Use the dashboard STOP control whenever the rover behaves unexpectedly.


Standalone in the simulator

Start the simulator:

python simulator/marsy_sim_ui.py

In a second terminal:

MARSY_MODE=sim python -m missions.explore_area --steps 20

Standalone on the real rover

Conservative example:

MARSY_MODE=real python -m missions.explore_area \
  --steps 10 \
  --step-distance 8 \
  --speed 20 \
  --rotate-speed 25 \
  --safe-distance 45 \
  --danger-distance 28

The dashboard and standalone mission should not control the rover hardware at the same time.


Parameters

CLI option Default Meaning
--steps 20 Number of successful forward movements to complete
--run-seconds none Optional mission time limit
--step-distance 12 cm Requested normal forward distance
--speed 30 Normal forward speed
--rotate-speed 25 In-place turn speed
--turn-step 30Β° Rotation increment during obstacle recovery
--max-turns-without-progress 4 Stop after repeated turns without forward progress
--safe-distance 40 cm Normal minimum trusted front clearance
--danger-distance 24 cm Hard-stop distance for any real close echo
--max-range 200 cm Maximum sonar distance accepted for mapping
--resolution 5 cm Occupancy-grid cell size
--scan-angles 0,-25,25,-50,50,-75,75 Mast scan sequence
--map-dir artifacts/maps Map output directory
--return-home off Attempt return to the recorded start pose

A step is counted only after meaningful forward progress.

A rotation, reverse action, failed movement, or tiny aborted movement does not increment the mission step counter.


Current working real-rover behavior

The current tested compromise for unreliable sonar is:

Uncertain step distance: 6 cm
Uncertain speed: 22

These values are configured through:

MARSY_UNCERTAIN_STEP_CM=6
MARSY_UNCERTAIN_SPEED=22

This means:

  • trusted clear front β†’ use the mission's requested distance and speed;
  • uncertain front β†’ move only 6 cm at speed 22;
  • trusted obstacle inside the safe distance β†’ do not move forward;
  • any real echo inside the danger distance β†’ hard stop.

This setting was selected because a fully conservative policy often caused Marsy to rotate without making progress, while treating every missing echo as clear space was unsafe.


Exploration cycle

Each cycle follows this logic.

1. Scan

Marsy scans seven mast directions:

0Β°
-25Β°
+25Β°
-50Β°
+50Β°
-75Β°
+75Β°

The center-first order provides useful front information early and updates the dashboard arc progressively.

Each sector uses three ultrasonic readings.

The median is used when enough readings are valid.


2. Classify each measurement

A sector may be classified as:

measured
no_echo
insufficient
unstable
suspicious_far

A trusted sector requires:

quality == measured
valid distance

Unknown measurements remain visible as uncertainty.

They are not converted into fake free space on the map.


3. Assess the front corridor

The front corridor uses the sectors near:

-25Β°
0Β°
+25Β°

Possible decisions:

Corridor status Action
clear Normal forward movement
uncertain_clear Cautious 6 cm movement at speed 22
blocked Obstacle recovery turn
stale_scan Collect a new scan before moving

A close real echo always has priority over the quality label.

This protects against a series such as:

10 cm
no echo
170 cm

The 10 cm reading still triggers the danger stop.


4. Move forward first

The mission is deliberately forward-first.

When the front corridor is usable, the rover moves forward instead of turning toward whichever side has the largest unexplored map area.

This prevents the earlier behavior where Marsy repeatedly rotated toward alternating left and right scan sectors.


5. Verify real progress

A movement is counted only when the rover travels at least 60% of the commanded distance.

For example:

Commanded normal step: 12 cm
Minimum counted progress: 7.2 cm

For an uncertain command:

Commanded cautious step: 6 cm
Minimum counted progress: 3.6 cm

This prevents a tiny aborted movement from being counted as a completed exploration step.


6. Commit to one recovery direction

When the front is blocked, the mission evaluates trusted side measurements.

For each side it considers:

number of clear rays
number of trusted rays
median clearance
minimum clearance

Several consistent clear rays are preferred over one isolated large value.

Once a left or right recovery direction is selected, Marsy keeps that direction until it achieves real forward progress.

It does not immediately reverse the turn direction after the next scan.

This state is maintained by ExploreMotionState.


7. Limit rotations without progress

Recovery turns are performed in increments, normally:

30Β°

The increment is clamped to:

15°–45Β°

After the configured number of turns without forward progress, normally four, the mission stops instead of rotating indefinitely.


8. Update the map

After each action, the current map is exported.

The mission keeps only one current pair:

artifacts/maps/explore_area_latest.json
artifacts/maps/explore_area_latest.svg

These files are overwritten rather than creating a new file for every step.


Dashboard distance arc

When explore_area runs through the dashboard, the camera overlay shows the seven scan sectors:

FAR L
L
HALF L
C
HALF R
R
FAR R

The values are updated progressively while the mast scans.

Display states:

Display Meaning
42 cm Trusted measurement
? Measured but unreliable or no valid echo
β€” No value has been received for the current scan

The overlay is aligned to the visible camera image rather than the entire camera container.

The center point may also update from front checks performed while Marsy is moving.


Mapping

Occupancy grid

The map uses a sparse grid.

Default properties:

Resolution: 5 cm per cell
Maximum sonar range: 200 cm
Sonar origin offset: 9 cm from rover pose

Cell states:

unknown
free
occupied
visited

Trusted ultrasonic rays mark:

  • intermediate cells as free;
  • the final cell as occupied.

Untrusted rays are skipped completely.

Pose source

Mode Pose source
Simulator Simulator ground-truth position and heading
Real rover Time-based dead reckoning

Real-rover maps can drift because wheel slip, steering error, and rotation error accumulate.

JSON content

The JSON map contains:

format
mapping_mode
resolution_cm
max_range_cm
sensor_offset_cm
current_pose
path
cells
metadata

Each cell contains:

x
y
state
free_hits
occupied_hits
visits

SVG content

The SVG map visualizes:

free cells
occupied cells
travel path
current rover position

It can be opened directly in a browser or through the Marsy map viewer.


Map lifecycle

Standalone mission

The standalone mission:

  1. removes stale JSON/SVG map files when it starts;
  2. overwrites the same latest map pair during the mission;
  3. leaves the final latest pair after the mission ends.

Dashboard mission

The dashboard:

  1. clears stale map artifacts when the dashboard starts;
  2. overwrites the same latest pair during exploration;
  3. removes map artifacts during normal dashboard shutdown.

This keeps the rover from accumulating large numbers of intermediate map files.


Mission state and completion

The dashboard reports progress using successful forward movements:

step 4/20

The action counter additionally includes:

forward attempts
rotations
reverse actions

The mission can finish because of:

  • requested steps completed;
  • user STOP;
  • optional time limit;
  • repeated turns without forward progress;
  • interrupted hardware operation;
  • exception;
  • keyboard interruption in standalone mode.

A result such as:

step 0/20

means the mission performed actions but none reached the minimum progress threshold.


Recommended first test

Use a clear area and stay near STOP.

Suggested values:

Maximum steps: 5
Step distance: 8 cm
Forward speed: 20
Rotate speed: 25
Safe distance: 45 cm
Danger distance: 28 cm
Turn step: 30Β°
Maximum turns without progress: 4
Return home: off

Expected behavior:

scan
β†’ normal or cautious forward movement
β†’ map update
β†’ repeat

When blocked:

scan
β†’ choose one recovery side
β†’ committed turn
β†’ rescan
β†’ continue turning in the same direction or move forward

Known limitations

Soft furniture

Sofas, curtains, clothing, and other soft materials can absorb or scatter ultrasound.

Marsy may receive:

no echo
unstable values
a reflection from a distant object behind or above the soft obstacle

The current uncertain creep improves mobility but cannot make ultrasonic sensing fully reliable.

Use STOP when testing near soft furniture.

A low-mounted ToF sensor or mechanical bumper remains the recommended future safety layer.

Low obstacles

The mast sensor may look above objects that are lower than the beam.

Examples:

shallow boxes
cables
thin furniture bases
small objects near the wheels

Angled and narrow surfaces

Angled surfaces can reflect the pulse away from the rover.

Thin chair legs may only appear in some scan sectors.

Dead-reckoning drift

The physical map can bend, rotate, or overlap itself because pose is estimated from elapsed movement time.

Rotation on high-friction floors

The middle wheel pair does not steer.

In-place rotation can still scrub or slip, even though the corner wheels use a rotation pose.

Return home

--return-home is experimental on the physical rover because it depends on the accumulated pose estimate.


Troubleshooting

Marsy only rotates

Check:

  • whether the front arc contains trusted obstacles inside safe_distance;
  • whether cautious motion is enabled;
  • whether MARSY_UNCERTAIN_STEP_CM is greater than zero;
  • whether the turn limit is being reached;
  • whether the rover actually moves far enough to satisfy the 60% progress threshold.

Current working values:

MARSY_UNCERTAIN_STEP_CM=6
MARSY_UNCERTAIN_SPEED=22

Marsy turns one way and immediately turns back

The current controller should keep a committed turn direction until forward progress.

Confirm that the deployed rover contains:

behaviors/explore_navigation.py

and that both the dashboard and standalone mission use the same current exploration controller.

The camera arc does not update during the mission

Confirm that:

  • the mission is started from the current dashboard;
  • the server and static JavaScript files are from the same version;
  • the browser was reloaded with Cmd + Shift + R;
  • the mission scan callback is publishing partial samples.

A point shows ?

The sensor produced an unreliable result.

This is expected for:

no echo
insufficient valid samples
unstable samples
suspicious isolated far reading

The map shows incorrect geometry

This is expected when physical dead reckoning drifts.

The map is currently an observational SLAM-lite map, not globally corrected SLAM.


Safety

  • Keep the dashboard STOP control visible.
  • Use short steps during first tests.
  • Do not test near stairs.
  • Do not depend on sonar alone near soft furniture.
  • Avoid long reverse movement because there is no rear distance sensor.
  • Stop immediately if a steering servo moves in the wrong direction.
  • Use a clear floor area when testing new navigation parameters.

Clone this wiki locally