Skip to content

armgit / moss

Public Imported from GitHub
0

MOSS: a small, mostly 3D-printed litter-picking rover. Cleaner streets, one maker at a time.

Python

gyro prior off by default: dimOS's RealSense IMU pipeline fails to open on the rover ('No device connected') and takes colour and depth down with it; MOSS_GYRO=1 keeps it as an experiment

metroxf2d7a3ba516f
diff --git a/benches/bench_moss_blueprints_cold.py b/benches/bench_moss_blueprints_cold.py
index cd29fe3..6fb147d 100644
--- a/benches/bench_moss_blueprints_cold.py
+++ b/benches/bench_moss_blueprints_cold.py
@@ -452,11 +452,11 @@ check("lidar on the CP2102N by-id at 460800, frame lidar_link",
hw = atom(nav, "MossControlCoordinator").kwargs["hardware"][0]
check("base: adapter 'moss' on the QT Py by-id", hw.adapter_type == "moss" and hw.address == os.path.join(byid, QTPY))
check("pad: the same MOSS envelope as moss-gamepad", atom(nav, "GamepadTeleop").kwargs.get("envelope") == teleop_envelope(g))
-check("odometry with the gyro prior (MOSS_GYRO unset = on)", atom(nav, "LidarOdometry").kwargs.get("use_gyro_prior") is True)
+check("odometry without the gyro prior (MOSS_GYRO unset = off)", atom(nav, "LidarOdometry").kwargs.get("use_gyro_prior") is False)
cam = atom(nav, "RealSenseCamera").kwargs
-check("RealSense 640x480 @ 5 fps, colour + depth (aligned), no point cloud, IMU on (the gyro prior)",
+check("RealSense 640x480 @ 5 fps, colour + depth (aligned), no point cloud, no IMU (MOSS_GYRO off by default)",
(cam.get("width"), cam.get("height"), cam.get("fps"), cam.get("enable_depth"),
- cam.get("enable_pointcloud"), cam.get("enable_imu")) == (640, 480, 5, True, False, True))
+ cam.get("enable_pointcloud"), cam.get("enable_imu")) == (640, 480, 5, True, False, False))
t = cam["base_transform"]
check("camera mount from the profile: (0.156, 0, 0.075) m",
close(t.translation.x, 0.156) and close(t.translation.z, 0.075))
diff --git a/docs/cockpit.md b/docs/cockpit.md
index 83a1cd1..2aebf58 100644
--- a/docs/cockpit.md
+++ b/docs/cockpit.md
@@ -80,9 +80,11 @@ firmware 300 ms after the last drive.
table top the rover has turned away from keeps its wall until the camera looks
at that spot again and sees nothing. The knobs are `MOSS_HIT_CAP`,
`MOSS_FREE_FLOOR` and `MOSS_RAY_MAX_M` (below);
-- the lidar odometry's rotation prior from the RealSense's gyro (`MOSS_GYRO=0` turns it
- off): a full-power pivot turns the rover 25 degrees between two scans, more than the
- constant-velocity prior follows, and the map drifts; the gyro says where the rover turned;
+- an experiment, off by default: the lidar odometry's rotation prior from the RealSense's
+ gyro (`MOSS_GYRO=1`): a full-power pivot turns the rover 25 degrees between two scans,
+ more than the constant-velocity prior follows, and the map drifts; the gyro would say
+ where the rover turned, but the IMU pipeline fails to open on the rover today and takes
+ the camera down with it;
- the sound module (`moss_dimos/sounds.py`): a pack of short synthesized cues in
`assets/sounds` played through the robot user's PulseAudio session (a Bluetooth
speaker once connected, the default sink otherwise) on confirmed events only: the
diff --git a/moss_dimos/blueprints.py b/moss_dimos/blueprints.py
index 1cf9ed1..f23e6a7 100644
--- a/moss_dimos/blueprints.py
+++ b/moss_dimos/blueprints.py
@@ -34,8 +34,8 @@ Switches (env, read when moss-nav / moss-explore is built; robot_profile.env_on
parses them: 0, false, no or off = off, any other value = on, unset = the default):
MOSS_CAMERA=0 no RealSense (default on: colour 640x480 @ 5 fps, JPEG on the bus, plus depth aligned
to colour at the same rate, turned into map obstacles by lidar_odometry)
- MOSS_GYRO=0 no gyro prior for the lidar odometry (default on, with the camera: the RealSense's IMU
- feeds the odometry's rotation prior; without a camera there is no gyro)
+ MOSS_GYRO=1 gyro prior for the lidar odometry from the RealSense's IMU (default OFF: the IMU
+ pipeline fails to open on the rover and takes the camera down with it; an experiment)
MOSS_SOUNDS=0 no sound module (default on when pw-play or paplay is on the PATH: the sound pack
in assets/sounds plays boot_ready, bump_surprise, recovery_success, resume,
mission_complete, battery_low / battery_critical on the stack's events;
@@ -428,7 +428,10 @@ def _common_parts(ports: dict, profile: RobotProfile) -> list:
from moss_dimos.lidar_odometry import LidarOdometry
from moss_dimos.rplidar_c1 import RPLidarC1
- gyro = robot_profile.env_on("MOSS_GYRO", True) and robot_profile.env_on("MOSS_CAMERA", True)
+ # MOSS_GYRO=1 is an experiment: dimOS's RealSense module opens a second pipeline for the IMU,
+ # which fails with 'No device connected' on the rover (the colour and depth streams then never
+ # start either), so the gyro prior is OFF unless asked for
+ gyro = robot_profile.env_on("MOSS_GYRO", False) and robot_profile.env_on("MOSS_CAMERA", True)
parts = [
_coordinator_blueprint(_moss_base(address=ports["base"])),
_gamepad_part(),