Make the eyes follow detected faces; start the face at power-up
hermes_face now subscribes to /vision/faces and glances toward the best face (a recognised one first, then the biggest), smoothed, holding 2.5 s and drifting back to centre when none is seen. Sleeping ignores gaze. Image x flips on the display: the camera looks the way the robot faces, so a person on the image's right is on the robot's right, the viewer's left. Fix the pan sign carried over from the prototype: positive pan is the robot's left (the MCP contract), which is the viewer's right on the display. robot-face.service starts the face at boot and restarts it on failure, with a private working directory because lgpio drops a notification pipe in its cwd and systemd's default / is not writable. robot-cpu-performance.service holds the CPU at full clock, which halves the face's CPU cost. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFN8nRRCiDiMN7ChBpHJhs
This commit is contained in:
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Make the face start whenever the robot is powered. Run as root from this directory. Re-runnable.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
install -m 644 robot-cpu-performance.service /etc/systemd/system/
|
||||
install -m 644 robot-face.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now robot-cpu-performance.service
|
||||
systemctl enable robot-face.service
|
||||
systemctl restart robot-face.service
|
||||
sleep 8
|
||||
systemctl --no-pager --lines=4 status robot-face.service
|
||||
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Hold the CPU at full clock (the face costs about half the CPU at 1.8 GHz as under ondemand)
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/sh -c 'for g in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo performance > "$g"; done'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Robot face (hermes_face): the display is always on while the robot is powered
|
||||
After=local-fs.target robot-cpu-performance.service
|
||||
|
||||
[Service]
|
||||
User=hermes
|
||||
# lgpio (the GPIO backend for the display) drops a notification pipe, .lgd-nfy*, in its working
|
||||
# directory, which must be writable: systemd's default, /, is not.
|
||||
RuntimeDirectory=robot-face
|
||||
WorkingDirectory=/run/robot-face
|
||||
ExecStart=/bin/bash -c 'source /home/hermes/robot-env.sh && exec ros2 run hermes_face face_node'
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user