PiCrawler / Recovery & SD-card Preservation
Recovery & SD-card Preservation
Preserve the old installation and calibration before repair or modernization.
Physical recovery plan
DO NOT UPDATE ANYTHING YET.
This recovery procedure is prepared guidance. The current Pi and card have not been inspected; no connection, backup, calibration or motion is claimed.
1. Inspect the machine without power
Photograph the kit label, HAT revision/silkscreen, MCU marking, servo labels and connections, camera marking/ribbon, battery label and connector. Compare to the channel map. Check loose fasteners, trapped cables, cracked parts and legs that bind. Do not turn a powered servo shaft, plug a ribbon under power or guess battery polarity. Keep the body supported and fingers away from pinch points for later startup. Identify the accessible power cutoff before running a robot constructor.
If the battery is damaged, swollen, leaking or abnormally hot, do not charge or run it. Confirm the HAT revision and matching charging connector/input. Do not insert an arbitrary battery because it says 7.4 V. If nothing indicates damage, proceed with a short controlled boot while watching for unexpected startup motion. Old services may start automatically; a boot is not guaranteed motion-free.
2. Boot and discover, without installing
Use the existing card. Observe power indicators and any reset/undervoltage behavior. Connect the Windows laptop and robot through a permitted network; a school network may isolate clients. Try the historical hostname only as a candidate. If it fails, use the router's device list, Ethernet or a local screen/keyboard. Do not scan a campus network indiscriminately or guess another machine's login.
Windows PowerShell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
ssh <verified-user>@<verified-host>Verify the SSH host fingerprint against this machine, then log in using the actual account credentials. A .local resolution failure, refused port and rejected login are different evidence. If no login is possible, retain the card and use authorized local recovery; do not reimage it merely to regain access.
3. Capture passive software evidence first
Run these in the verified Pi terminal and retain their outputs privately:
Raspberry Pi Linux shell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
hostname
cat /proc/device-tree/model
cat /etc/os-release
uname -a
id
python3 --version
command -v python3
python3 -m pip --version
python3 -m pip show picrawler robot_hat vilib sunfounder-voice-assistant
python3 -m pip list --format=json
python3 -m site
ls -la ~
printf '%s\n' "$PATH" "$PYTHONPATH"These commands inspect the interpreter context without creating a crawler. Do not dump the full environment because it may contain credentials. recovery/capture_state.py automates the same scoped capture to a new directory, copies login-user and readable /opt calibration candidates and records Git metadata. It refuses an existing output directory. Review the script before running it. Its files are evidence copies, not changed live robot settings.
Raspberry Pi Linux shell · BACKUP WRITE · creates private evidence copies; verify paths and destination. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
python3 capture_state.py --output "$HOME/picrawler-recovery-YYYY-MM-DD-before"Choose a fresh name if that directory already exists; never remove it to rerun the capture. The helper does not use sudo, import robot/camera packages, read root-only configs, capture complete source contents, or make a full-card image. The later steps complete those missing preservation tasks.
4. Record every likely checkout
Inspect ~/picrawler, ~/picrawler_old, ~/robot-hat, and ~/vilib if present. For each actual directory:
Raspberry Pi Linux shell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
git -C ~/picrawler status --short --branch
git -C ~/picrawler remote -v
git -C ~/picrawler rev-parse HEAD
git -C ~/picrawler branch -a
git -C ~/picrawler diff --stat
git -C ~/picrawler diff --cached --stat
git -C ~/picrawler ls-files --others --exclude-standard
git -C ~/picrawler stash list
git -C ~/picrawler log -8 --date=iso --format='%h %ad %s'Repeat with each other path, preserving a “not a Git repository” result if appropriate. Capture patches with git diff and git diff --cached into separately named evidence files, but also archive the entire source folder: a patch omits untracked files and the installed eggs can differ from the checkout. Preserve .git so stashes and local commits survive. Review remotes/logs before sharing because they can contain identifying data or embedded credentials.
No pull, checkout, reset, clean, stash mutation or installer belongs in this stage. picrawler_old is an evidence source, not cleanup material.
5. Find calibration and installed source without constructing hardware
Search the likely locations by file name:
Raspberry Pi Linux shell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
find ~/.config -maxdepth 5 -type f \( -iname '*picrawler*' -o -iname '*robot-hat*' -o -iname '*robot_hat*' \) -print
find /opt/picrawler -maxdepth 2 -type f -name '*.config' -print
sudo find /root/.config -maxdepth 5 -type f \( -iname '*picrawler*' -o -iname '*robot-hat*' -o -iname '*robot_hat*' \) -printThe sudo command is a deliberate read of root's robot-related configuration; use local authorization and retain the result privately. Inspect candidate file ownership, timestamps, contents and hashes before running any helper. Important candidates are /opt/picrawler/picrawler.config, the login user's .config/.picrawler.config, the generic .config/robot-hat/robot-hat.conf, and corresponding root home locations. The current source's expanduser() under sudo may choose root, while the inspected old PiCrawler implementation selected /opt/picrawler/picrawler.config.
Use python3 -m pip show locations and distribution metadata to identify installed source, including eggs and editable installs. Repeat version/site/pip inspection under the actual historical sudo command context after recording the normal-user results. Do not set HOME or PYTHONPATH to force a guessed fix. Read the installed picrawler/picrawler.py, robot_hat/__init__.py and version files directly and hash them. Compare them to the repository files.
Metadata can be inspected without importing the hardware packages:
Raspberry Pi Linux shell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
python3 - <<'PY'
import importlib.metadata as m
import sys
print('executable:', sys.executable)
print('search path:', sys.path)
for name in ('picrawler','robot_hat','vilib','sunfounder-voice-assistant'):
try:
d=m.distribution(name)
print(name, d.version, d.locate_file(''))
except m.PackageNotFoundError:
print(name, 'not found for this interpreter')
PYLocate any virtual environments from their pyvenv.cfg files and record their interpreter paths. Inspect apt-installed camera/OpenCV packages with dpkg-query. Python 3.13 observations and package names are not sufficient to infer OS or exact source.
6. Make copies, hashes and an off-device backup
The capture folder must contain copies of calibration candidates, system context, Git metadata, patches and whole relevant source/checkouts. Also preserve installed eggs/directories from the identified site locations. Copy boot configuration and ALSA config before any audio/doctor fixes. The corresponding root files may require a locally authorized sudo copy; that copy writes evidence, not the live config.
For a file whose existence has been confirmed:
Raspberry Pi Linux shell · BACKUP WRITE · creates private evidence copies; verify paths and destination. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
cp -p ~/.config/.picrawler.config ~/picrawler-recovery-YYYY-MM-DD-before/user-picrawler.config
sha256sum ~/picrawler-recovery-YYYY-MM-DD-before/user-picrawler.configDo not run this particular source path if discovery found a different one. Archive only verified paths; source archives can contain secret.py or API keys and should stay private. Copy the evidence folder and archives to the Windows laptop using scp or a trusted external drive. From PowerShell:
Windows PowerShell · BACKUP WRITE · creates private evidence copies; verify paths and destination. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
scp -r <verified-user>@<verified-host>:~/picrawler-recovery-YYYY-MM-DD-before .Check the copied files and compare SHA-256 hashes. A message saying scp completed is not a full SD-card backup. SD_CARD_PRESERVATION.md explains full-card imaging before major modernization; it is not required before simple read-only inspection.
7. Inspect diagnostics before repair
Record available device nodes, camera command versions and playback/capture enumeration. Read boot overlays and existing relevant service definitions. Identify any autostart scripts that can move the robot. Do not enable/disable those services until recorded and until the reason is understood.
If the recovered HAT package already supplies doctor, inspect its source and run report mode after backups and I2C-device review. Report mode performs active bus probing. Do not run --fix yet. If doctor is absent, preserve that fact and use manual read-only checks; do not update to obtain it.
After capture, verify the imports needed for locomotion with bytecode writing disabled:
Raspberry Pi Linux shell · PACKAGE INITIALIZATION · inspect recovered imports for side effects first. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
PYTHONDONTWRITEBYTECODE=1 python3 -c 'import robot_hat; print(robot_hat.__file__); print(hasattr(robot_hat, "Robot"))'
PYTHONDONTWRITEBYTECODE=1 python3 -c 'import picrawler; print(picrawler.__file__)'These are package imports, not crawler construction. Inspect the recovered files first because local modifications can add import side effects. Importing Vilib is a later camera diagnostic, not a passive metadata check: its current class-level camera object initializes during import. Test both normal-user and required hardware execution contexts deliberately, recording differences.
8. Open remote development only after preservation
VS Code Remote SSH installs a server component and writes files on the Pi. It belongs after the initial capture. Open the recovered checkout and select its actual interpreter. Keep recovered vendor source unchanged while understanding it. A new club experiment folder is preferable to an undocumented overwrite of the working installation.
9. Calibrate with matched source and physical support
Read the actual helper. Use the historical examples/calibration/calibration.py if that is the recovered compatible path, or current examples/0_calibration.py after a deliberate migration. Do not use the current OpenClaw calibration shortcut: its signature does not match the implementation. A helper will construct the crawler and move legs immediately.
Use the printed calibration chart or a verified equivalent physical reference. Keep the robot supported and check every limb's response at small increments. Stop if a limb binds, moves the wrong joint, approaches the offset limit or repeatedly resets the Pi. Fix channel/horn/mechanical errors before treating them as tiny calibration biases. Confirm save, then capture the actual file selected by the process and a new after-calibration hash. Never overwrite the before snapshot.
10. The deliberately small recovery success test
Record actual results for boot, verified SSH, locomotion imports, HAT communication, helper launch, persisted offsets, sit, stand, one forward gait cycle and sit. Use a clear level area, a charged inspected battery, a nearby operator and an accessible physical cutoff. Use modest speed, wait between commands, and observe startup motion separately. “One forward step” means one library gait cycle, not a guaranteed distance.
Do not make the whole sequence an unattended command pasted into a terminal. Run each stage and observe it. A Ctrl+C or a sit command asks software to change pose; it is not a hard independent power disconnect. If a servo stalls or software cannot stop promptly, use the physical cutoff. Shut Linux down normally when there is time to avoid SD corruption; immediate cutoff is for an active fault.
Session outcome record
Complete a private local recovery session record with actual file hashes, paths, SHAs, observed results and still-unresolved questions. Mark a function BENCH_VERIFIED only with a dated test record identifying hardware, source version, command and outcome. Keep credentials, raw backups and local personal data outside public site material. A successful session may still leave optional camera/audio/AI projects untested; record that honestly.
Source evidence: user-evidence, pc-core, pc-historical-core, pc-calibration, hat-doctor, hat-init, vi-core, pi-remote, ms-remote-ssh. All commands are prepared, not run on the robot.
SD-card preservation and migration strategy
Copying the picrawler folder preserves that folder's files. It does not preserve the operating system, installed eggs, apt packages, kernel, boot overlays, calibration elsewhere in the filesystem, user services, networking setup or the exact import environment. A complete card image preserves the partition table and all readable sectors, allowing the old software system to be studied or restored later.
Read-only software inspection can happen before imaging. Before major updates, reinstallation or source replacement, shut the Pi down cleanly, remove the card with power off, and read it from a suitable computer/card reader. Use a tool's read/image-from-device operation to an image file on another storage device. Select the exact 32 GB card by its capacity and device identity. Do not use Raspberry Pi Imager's write operation to preserve the old card; it overwrites its target.
The image needs enough destination storage for the whole card, not just the used filesystem. Retain the uncompressed image or a verified compressed copy, its size, capture time, source-card identity and SHA-256 hash. If the reading tool reports errors, record them instead of declaring a complete backup. Testing recovery means writing a copy to a separate spare card and checking it there, while retaining the original.
An offline image is more coherent than imaging a live, actively writing filesystem. The initial directory/metadata backups still have value because they are easy to inspect and identify calibration/local edits quickly. Both levels are useful. Images and archives can contain passwords, keys, personal files and network credentials, so store them privately; the public research package should contain findings and identifiers, not raw recovered secrets.
If the original system works, keep it as a comparison baseline. Build a modern stack on a spare card and measure the same controlled recovery sequence. A fresh OS that boots but cannot reproduce camera, HAT access or calibration is not a successful migration. The preserved image makes changes reversible and supplies the evidence needed to explain the former member's undocumented fix.
This cloud pass has not imaged or read the physical card. The plan and blank session template are ready, but no image hash, partition layout or calibration value is fabricated.
What the old observations establish
Historical reports describe Python 3.13-era egg installations labeled PiCrawler 2.1.4 and Robot HAT 2.3.0. An earlier traceback failed at from robot_hat import Robot, utils; a later observation showed the calibration helper. This establishes an earlier import failure and a later helper launch. It does not establish saved offsets, complete calibration, walking or present operation. Private account, hostname and screen records are not published here.
Preserve every relevant checkout, including any picrawler_old directory. That name could identify a copied working version, renamed checkout, abandoned attempt or backup. Inspect remote, SHA, local edits, untracked files, stashes and timestamps without pulling, resetting, cleaning or overwriting it.
Compare implementation rather than version labels
Inspected historical and current PiCrawler source both report 2.1.4 despite changed example paths and calibration behavior. The old core selects /opt/picrawler/picrawler.config; the current core selects the effective user's ~/.config/.picrawler.config. Moving to newer code or changing execution user can silently select a different file. Preserve the original offsets and source together.
The historical Robot error does not prove that every 2.3.0 package lacked that class. Nearby historical upstream exports and the current package contain it. Possible causes include shadowing, a different branch/install, local edits, incomplete dependencies or an export guard. Python 3.13 is a real boundary for some optional vision packages; it is not independently proven to have caused that historical import failure.
Evidence needed at the machine
Record actual OS/kernel/interpreter, distribution locations, installed file hashes, source checkouts and normal-user versus historical privileged execution context. Read installed source without constructing hardware. Capture every real calibration candidate before imports or constructors. Compare the preserved files with the pinned source library. Only that evidence can close the historical timeline; no card image, calibration values or current package state are supplied by this website.
Work through these gates in order. The current installation, calibration and hardware function are unknown. No command on this page has been run on the club's robot as part of website publication.
A — Identify the machine
The reported machine is a SunFounder PiCrawler 4, model CN0488D, with a Raspberry Pi 5 / 4 GB, twelve metal-gear servos, a front camera, ultrasonic module, speaker and an existing microSD installation. The battery label says 7.4 V / 2000 mAh. These are physical reports, not current function tests. Robot HAT V4 — visually confirmed by club owner (reported October 25, 2026); the installed camera sensor is unresolved.
- Photograph the kit, Pi, HAT revision and MCU marking.
- Photograph servo labels, each connector and camera ribbon before disconnecting anything.
- Compare the hardware and channel reference with the actual assembly.
- Identify the actual microSD and keep it as the original installation.
B — Inspect before applying power
- Check loose fasteners, binding legs, cracked parts, trapped cables and connector condition.
- Inspect the battery. Do not charge or run a damaged, swollen, leaking or abnormally hot pack.
- Confirm the charging arrangement from the actual board and battery; do not guess polarity.
- Support the body, clear all legs and pinch points, and identify an accessible physical power cutoff.
Booting an old service or constructing Picrawler() can move the legs before the main loop begins. Do not run a calibration helper as a discovery command. Do not change ribbon or actuator wiring under power.
C — Establish a verified connection
Use an authorized network. Obtain the actual account and hostname/IP from local records, an authorized router client list or a local Pi keyboard/monitor. A historically recorded hostname is only a candidate; it is intentionally not published here. School Wi-Fi may isolate clients. Do not scan a campus network indiscriminately.
Windows PowerShell · connection only · replace both placeholders first:
Windows PowerShell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
ssh <verified-user>@<verified-host-or-IP>Verify the SSH fingerprint against this Pi before accepting it. Name resolution failure means discovery failed; timeout can mean reachability/client isolation; connection refused means no listening SSH service; permission denied means authentication failed. A changed host key needs local identity verification, not automatic deletion. If login fails, preserve the card and use authorized local recovery rather than reimaging.
D — Preserve the installation before changing it
Do not reinstall, upgrade, clean, pull, reset or replace anything before preservation. Keep the following outputs private. Plain SSH comes before VS Code Remote SSH because the latter installs a server and writes files to the Pi.
Raspberry Pi Linux terminal · passive file/package metadata · no robot imports:
Raspberry Pi Linux shell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
cat /proc/device-tree/model
cat /etc/os-release
uname -a
python3 --version
command -v python3
python3 -m pip --version
python3 -m pip show picrawler robot_hat vilib sunfounder-voice-assistant
python3 -m siteRaspberry Pi Linux terminal · passive Python distribution inspection:
Python source on the selected Pi interpreter · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
import importlib.metadata as metadata
import sys
print("Interpreter:", sys.executable)
for name in ("picrawler", "robot_hat", "vilib", "sunfounder-voice-assistant"):
try:
package = metadata.distribution(name)
print(name, package.version, package.locate_file(""))
except metadata.PackageNotFoundError:
print(name, "not found for this interpreter")The Python block is an illustrative metadata script, not a shell command. Save it to a deliberately chosen new inspection file before running it with the recovered interpreter. Missing pip or a missing distribution is evidence to record, not a reason to install packages immediately.
For each confirmed existing checkout, record status, remote, SHA, branches, unstaged/staged patches, untracked files and stashes. Preserve the complete directory including .git and installed source/eggs; a patch alone misses untracked content. Review remotes and logs privately before sharing.
Raspberry Pi Linux terminal · passive Git inspection · only if this directory exists:
Raspberry Pi Linux shell · CONNECTION / PASSIVE INSPECTION · keep collected metadata private. prepared procedure · read the preceding gates; verify placeholders and actual installed paths
git -C ~/picrawler status --short --branch
git -C ~/picrawler rev-parse HEAD
git -C ~/picrawler diff --stat
git -C ~/picrawler ls-files --others --exclude-standard
git -C ~/picrawler stash listCopy discovered calibration, relevant source, boot/audio settings and evidence off the device; verify the copies and hashes. These copies write backup files but must not change live configuration. Before modernization, shut down cleanly and make a read/image-from-device full-card image to separate storage. An imager's write operation overwrites its target. Test restoration on a spare card while retaining the original. Detailed recovery and SD-card procedure.
E — Locate and preserve calibration
Offsets depend on the actual installed implementation and effective user. Current upstream selects ~/.config/.picrawler.config; an inspected historical version selects /opt/picrawler/picrawler.config. Also inspect the relevant user's/root's robot configuration candidates deliberately. Do not assume a login-user backup is the file selected under sudo.
Preserve the actual files, permissions, timestamps and SHA-256 before any constructor. No real calibration values are supplied here. A wrong channel, reversed joint or large bias needs mechanical/source investigation. Calibration, helper keys and persistence.
F — Qualify one small hardware test
Passive inspection → reviewed package imports → active bus/sensor checks → supported calibration → one controlled motion stage at a time. Vilib import may initialize the camera; it is not passive metadata inspection. Doctor report mode can probe I²C; --fix modifies configuration. Proposed diagnostic tools are specifications, not installed commands.
Before any actuator test:
- Original source and calibration have verified off-device backups.
- Actual HAT/connector/channel assumptions and matching helper have been reviewed.
- Battery, mechanical freedom and support are acceptable.
- An operator watches the test with access to the independent cutoff.
- The startup behavior and small requested action are understood.
- A clear test area and recovery path are ready.
Use the matched terminal helper only after those gates; it already moves legs at startup. Observe initialization, calibration persistence, sit, stand and one gait cycle separately. Do not paste an unattended sequence. Stop for binding, wrong joints, heating or repeated resets. A cycle is not a guaranteed distance. Ctrl+C, a sit command, a debugger pause or closing SSH is not an immediate independent emergency stop.
Record dated hardware identity, source/interpreter/config hashes, commands and actual outcomes. Only those results can establish bench verification. Stop limitations and diagnostic classes.
G — Begin a club-owned Python experiment
After recovery, use VS Code Remote SSH with the verified Pi account and recovered interpreter. Start in a separate proposed workspace such as ~/engineering-club-picrawler/, leaving vendor checkouts preserved. First inspect geometry offline, characterize range readings, or qualify a single pose; avoid a dependency migration as the first experiment.
Program the robot, find the pinned official source, or choose a project proposal. Every time estimate assumes the recovered baseline and stated prerequisites already exist.
Continue
Meeting checklist · Source library · Modification atlas · All project proposals