Configuration¶
ROS F.A.I.R.y has very little to configure. Everything lives in two places, and
both are written by ros2 fairy setup.
Paths¶
| Path | What it holds |
|---|---|
/etc/ros-fairy/robot_identity.yaml |
The robot, its owner and its sensors (below). |
/etc/ros-fairy/watchdog.env |
The ROS environment the watchdog service runs with (below). |
/etc/ros-fairy/paths.yaml |
Where the data folder is, when it isn't /var/ros-fairy (below). |
/var/ros-fairy/spool/ |
The mission in progress. |
/var/ros-fairy/spool/bags/ |
Recordings made with mission_record. |
/var/ros-fairy/spool/mission_context.json |
The briefing answers. |
/var/ros-fairy/spool/harvest.json |
Everything the watchdog captured (What is captured). |
/var/ros-fairy/spool/session.env |
The DDS settings of the shell that started the mission (below). |
/var/ros-fairy/spool/watchdog.log |
The watchdog's log for this mission (archived with it). |
/var/ros-fairy/archive/ |
Saved missions, one RO-Crate folder each (Archive format). |
/var/ros-fairy/archive/.staging/ |
Saves in progress. Never delete anything here by hand: run mission_close. |
/var/ros-fairy/index.db |
The mission list (SQLite). A cache: ros2 fairy reindex rebuilds it from the archive. |
/var/ros-fairy/watchdog.state |
The watchdog's live status. |
/var/ros-fairy/ros_processes.json |
The DDS discovery settings of the containers' running ROS processes, as the watchdog last saw them (every 10 s, rewritten only when they change). Read by doctor and setup --from-container; holds nothing else from their environment. |
/var/ros-fairy/log/ |
ROS log directory for the watchdog, used when root has no writable ~/.ros/log. |
The rows below /etc are in the data folder, /var/ros-fairy unless it
was moved.
Moving the data folder¶
To keep recordings and saved missions on another disk, choose the folder at
setup (the wizard asks, or ros2 fairy setup --var-dir /data/ros-fairy), or
move what is already there with
ros2 fairy move_data. Either one writes the place
into /etc/ros-fairy/paths.yaml:
var_dir: /data/ros-fairy
Every process reads this file: operator shells, the watchdog service,
sudo, cron jobs and launch files. A change applies at once, with no new
login. Don't edit it to move missions that already exist (they would stay
behind, unlisted): use move_data. A file that can't be used (no var_dir,
a relative path, broken YAML) stops every command with a plain message rather
than quietly using /var/ros-fairy; ros2 fairy setup --var-dir <folder>
writes it again.
For tests and one-off experiments, two environment variables still override everything:
| Variable | Default | Moves |
|---|---|---|
ROS_FAIRY_VAR_DIR |
paths.yaml, else /var/ros-fairy |
the data folder, for this shell only |
ROS_FAIRY_CONFIG_DIR |
/etc/ros-fairy |
the identity file, watchdog.env and paths.yaml |
The service never sees a shell's variables, so a shell with
ROS_FAIRY_VAR_DIR set works on different missions than the watchdog
(doctor warns about it). For the same reason the setup wizard refuses to
run while ROS_FAIRY_VAR_DIR is set: unset it, or give the folder as
--var-dir. A moved config folder also needs a systemd drop-in
(sudo systemctl edit ros-fairy-watchdog), because the unit file hard-codes
EnvironmentFile=-/etc/ros-fairy/watchdog.env.
Permissions¶
- The
ros-fairygroup owns the data folder and everything below it. Directories are2775(setgid, so new files inherit the group), the index is0664, and saved crates are made group-writable. - Every operator account must be in that group:
setupadds the ones you name, andros2 fairy add_operator <user>adds more. Without it, the verbs that record or save stop before asking anything and say so. /etc/ros-fairyandrobot_identity.yamlare world-readable and root-writable.- The watchdog runs as root with group
ros-fairyandUMask=0002.
robot_identity.yaml¶
Created by ros2 fairy setup, and changed one part at a time with its
flags (--show prints
it). You can also edit it by hand. It is read again at every harvest, so no
restart is needed.
robot:
name: Heron-02
platform: Clearpath Heron USV
serial_number: H02-2031-XK
owner:
organization: Example Marine Robotics Lab
contact_email: fleet@example.org
default_license: https://spdx.org/licenses/CC-BY-4.0 # optional
sensors: # optional
- sensor_id: gps0
type: gps
make_model: u-blox ZED-F9P
topic: /fix
frame_id: gps_link # optional
calibration: gps0_cal # optional, names a calibrations[] entry
calibrations: # optional
- name: gps0_cal
source_path: /opt/cal/gps0.yaml
format: yaml # optional
recording: # optional, used by mission_record
topics: [/fix, /depth] # default: record all topics
storage: mcap # default: rosbag2's default
export: # optional
upload_to: lab-nas:fairy/heron # an rclone destination, for uploads
| Section | Required fields | Notes |
|---|---|---|
robot |
name, platform, serial_number |
|
owner |
organization, contact_email |
default_license becomes the RO-Crate's license; without it the crate has none. |
sensors[] |
sensor_id, type, make_model, topic |
sensor_id must be unique. Topics are made absolute. |
calibrations[] |
name, source_path |
The file is copied into each saved mission with its sha256. setup names an entry <sensor_id>_cal (_cal_2, … when that name is taken), and renames it along with its sensor. |
recording |
none | topics may be a list or a single string. A topic selection or --storage given to mission_record replaces these for that recording. |
export |
none | upload_to: where export --upload and upload copy bundles, set with setup --upload-to. The rclone remote it names is set up per account with rclone config; it isn't stored here. |
All required fields must be non-empty strings. A broken file is reported in
plain language by doctor and in the harvest status. Missions recorded while
it is broken are graded poor: "the robot isn't set up".
Why declare sensors? A declared sensor is checked by name. A sensor that
published nothing during a recording produces a never published warning
("GPS (gps0) produced no data at all during this recording."). Its gaps are itemised rather than
summarised. A camera that only published …/compressed is recognised
as such. Undeclared topics only get the generic checks. See
Recording health.
watchdog.env¶
A systemd EnvironmentFile (KEY=value lines) holding the ROS environment
of the shell that ran setup:
- every
ROS_*,AMENT_*,RMW_*andCOLCON_*variable; PATH,LD_LIBRARY_PATH,PYTHONPATH,CMAKE_PREFIX_PATH;CYCLONEDDS_URI,FASTRTPS_DEFAULT_PROFILES_FILE,FASTDDS_DEFAULT_PROFILES_FILE.
ROS_FAIRY_* variables are never stored.
Because the service runs as root, LD_PRELOAD is dropped, and every
PATH/PYTHONPATH/LD_LIBRARY_PATH entry that isn't owned by root or is
writable by others is removed: both when the file is written and again when the
watchdog starts. A ROS install under /opt/ros is unaffected. An overlay in
someone's home directory is not visible to the service.
When the robot's ROS environment changes, regenerate it from a shell that has
the new one with ros2 fairy setup --refresh-env (no questions; it also
restarts the watchdog). doctor warns when the file no longer matches your
shell: the distro, any DDS discovery setting (ROS_DOMAIN_ID,
RMW_IMPLEMENTATION, ROS_AUTOMATIC_DISCOVERY_RANGE, ROS_LOCALHOST_ONLY,
ROS_STATIC_PEERS), a DDS profile file, or a root-owned overlay. An unset
setting counts as its Jazzy default (domain 0, rmw_fastrtps_cpp,
SUBNET), so stating a default isn't a difference.
For a robot whose ROS runs in Docker, doctor also compares the discovery
settings of the running ROS containers, and
ros2 fairy setup --refresh-env --from-container NAME takes them from a
container instead of the shell. See Robots whose ROS runs in
Docker, including what
it can't see.
session.env¶
Written to the spool by mission_start and mission_record from the operator's
shell, so that the harvest sees the same ROS graph even if the domain or RMW has
changed since setup. The file is group-writable, so the watchdog takes only
these keys from it, and never loader paths:
ROS_DOMAIN_ID RMW_IMPLEMENTATION ROS_LOCALHOST_ONLY
ROS_AUTOMATIC_DISCOVERY_RANGE ROS_STATIC_PEERS
ROS_FAIRY_IGNORE¶
The watchdog notices any ros2 bag record on the machine, not just
mission_record (see Recordings made outside ROS F.A.I.R.y),
and attaches it to the current mission. To keep a recording out, start it with
the variable set:
ROS_FAIRY_IGNORE=1 ros2 bag record -o scratch /chatter
Any value other than empty or 0 counts.
The systemd unit¶
ros-fairy-watchdog.service is installed into /etc/systemd/system/ by
setup:
| Setting | Why |
|---|---|
After=local-fs.target only |
It must keep working when ROS, the network or Docker are down. It only needs the spool. |
EnvironmentFile=-/etc/ros-fairy/watchdog.env |
The ROS environment. The - lets it start without one. |
ExecStart=/usr/bin/python3 -m fairy.watchdog.watchdog |
The interpreter setup ran under, if root owns it and it can load the fairy package as the service would; otherwise /usr/bin/python3. setup stops if neither can. |
Group=ros-fairy, UMask=0002 |
Operators can read and clean up what it writes. |
Environment=PYTHONDONTWRITEBYTECODE=1 |
Python writes no bytecode caches. With the group and umask above, a cache it wrote next to a module (/opt/ros/.../__pycache__) would be writable by every operator, and root would then run it. |
Restart=always, RestartSec=5 |
It recovers from crashes on its own (crash recovery). |
Nice=10 |
It yields CPU to the robot's own software. |
Useful commands:
systemctl status ros-fairy-watchdog
journalctl -u ros-fairy-watchdog -f
sudo systemctl restart ros-fairy-watchdog # after updating ROS F.A.I.R.y