feat(social): personal space respector node (Issue #310) #314

Merged
sl-jetson merged 1 commits from sl-jetson/issue-310-personal-space into main 2026-03-03 00:20:10 -05:00
Collaborator

Summary

Closes #310

ROS2 node that monitors face distances and backs the robot away when someone enters personal space.

  • Subscribes /social/faces/detected (FaceDetectionArray) + /social/person_states (PersonStateArray)
  • Maintains face_id → distance cache from PersonState messages
  • State machine: CLEAR / TOO_CLOSE with configurable hysteresis band (default 0.1 m) to prevent chatter
  • Publishes cmd_vel (Twist.linear.x = -backup_speed) while too close
  • Publishes /saltybot/too_close (Bool) latch
  • Pure helpers (closest_face_distance, should_backup, should_clear) for testability
  • Face freshness window (lost_timeout_s = 1.5 s) — clears state if face data goes stale
  • Configurable: personal_space_m=0.8, backup_speed=0.1, hysteresis_m=0.1, control_rate=10 Hz

Test plan

  • 92/92 offline unit tests pass (test_personal_space.py)
  • Pure helpers: closest_face_distance, should_backup, should_clear
  • Node init: publishers, subscribers, timer, parameter storage
  • Subscription callbacks: distance cache updates, face ID tracking
  • Control loop: CLEAR → TOO_CLOSE → CLEAR full cycle
  • Hysteresis: state latches in band, clears only above band
  • Stale face timeout: state clears when no fresh face data
  • Multi-face: closest face drives the decision
  • Logging: WARN on entry, INFO on clear/face-lost
  • Config YAML, launch file, setup.py entry point

🤖 Generated with Claude Code

## Summary Closes #310 ROS2 node that monitors face distances and backs the robot away when someone enters personal space. - Subscribes `/social/faces/detected` (FaceDetectionArray) + `/social/person_states` (PersonStateArray) - Maintains `face_id → distance` cache from PersonState messages - State machine: **CLEAR** / **TOO_CLOSE** with configurable hysteresis band (default 0.1 m) to prevent chatter - Publishes `cmd_vel` (`Twist.linear.x = -backup_speed`) while too close - Publishes `/saltybot/too_close` (`Bool`) latch - Pure helpers (`closest_face_distance`, `should_backup`, `should_clear`) for testability - Face freshness window (`lost_timeout_s = 1.5 s`) — clears state if face data goes stale - Configurable: `personal_space_m=0.8`, `backup_speed=0.1`, `hysteresis_m=0.1`, `control_rate=10 Hz` ## Test plan - [x] 92/92 offline unit tests pass (`test_personal_space.py`) - [x] Pure helpers: `closest_face_distance`, `should_backup`, `should_clear` - [x] Node init: publishers, subscribers, timer, parameter storage - [x] Subscription callbacks: distance cache updates, face ID tracking - [x] Control loop: CLEAR → TOO_CLOSE → CLEAR full cycle - [x] Hysteresis: state latches in band, clears only above band - [x] Stale face timeout: state clears when no fresh face data - [x] Multi-face: closest face drives the decision - [x] Logging: WARN on entry, INFO on clear/face-lost - [x] Config YAML, launch file, setup.py entry point 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sl-webui added 1 commit 2026-03-02 21:43:14 -05:00
feat(social): personal space respector node (Issue #310)
Some checks failed
social-bot integration tests / Lint (flake8 + pep257) (push) Failing after 5s
social-bot integration tests / Core integration tests (mock sensors, no GPU) (push) Has been skipped
social-bot integration tests / Lint (flake8 + pep257) (pull_request) Failing after 9s
social-bot integration tests / Core integration tests (mock sensors, no GPU) (pull_request) Has been skipped
social-bot integration tests / Latency profiling (GPU, Orin) (push) Has been cancelled
social-bot integration tests / Latency profiling (GPU, Orin) (pull_request) Has been cancelled
b8a14e2bfc
Subscribes /social/faces/detected + /social/person_states; backs robot
away (cmd_vel linear.x = -backup_speed) when closest person <= 0.8 m,
latches /saltybot/too_close Bool; hysteresis band prevents chatter.
92/92 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sl-jetson merged commit d468cb515e into main 2026-03-03 00:20:10 -05:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#314
No description provided.