ROS Package bob_face
ROS 2 package for facial animation playback and sentiment-driven color orchestration.
Features
Animation Engine (C++): Blended playback of
MarkerArrayface geometry from rosbag2.Sentiment Logic (Python): ONNX-based TinyBERT sentiment analysis for deep context awareness.
Marker Colorizer (C++): Real-time RGBA override for visualization markers.
Sequence GUI (Python): PyQt5 interface for triggering and managing animation sequences.
Dynamic Tuning: Adjust behavior at runtime via ROS parameters or Environment Variables.
Components
bag (Node)
Playback engine for facial geometry.
Subscribes: N/A
Publishes:
face_marker_array(visualization_msgs/MarkerArray)Services:
set_sequence(bob_msgs/SetSequence)
face_marker (Node)
Applies sentiment color to incoming markers.
Subscribes:
marker_array_in(visualization_msgs/MarkerArray),face_color_override(std_msgs/ColorRGBA)Publishes:
marker_array_out(visualization_msgs/MarkerArray)
sentiment (Node)
Text-to-color mapping. Performs context-aware analysis using ONNX models.
Subscribes:
analize(std_msgs/String)Publishes:
face_color_override(std_msgs/ColorRGBA),sentiment_score(std_msgs/Float32)
motion_manager (Node) / motion_node
Automation of facial states (Speaking/Idle).
Subscribes:
spoken_text(std_msgs/String),speaking_flag(std_msgs/Bool)Services:
set_sequence(Client: calls thebagnode)
face_gui (Node)
Interactive sequence editor and manual control.
Services:
set_sequence(Client)Files: Reads/Writes
config/sequences.yaml
Parameters & Environment Variables
All nodes support standard ROS parameters which can also be initialized via Environment Variables (useful for Docker deployments).
Sentiment Parameters
Parameter |
Env Variable |
Default |
Description |
|---|---|---|---|
|
|
|
HF model repository. |
|
|
|
Local directory for model storage. |
|
|
|
[Dynamic] Multiplier (spread). |
|
|
|
[Dynamic] Smoothing [0..1]. |
|
|
|
[Dynamic] Logit scaling [>0]. |
|
|
|
[Dynamic] Character buffer. |
|
|
|
Matplotlib colormap. |
Motion Parameters
Parameter |
Env Variable |
Default |
Description |
|---|---|---|---|
|
|
|
Path to sequences file. |
|
|
|
[Dynamic] s/char heuristic. |
|
|
|
[Dynamic] Min idle pause. |
|
|
|
[Dynamic] Max idle pause. |
|
|
|
[Dynamic] Comma-separated names. |
|
|
|
[Dynamic] Comma-separated names. |
Sentiment Tuning (Lessons Learned)
Through extensive testing, we found the following “sweet spot” settings:
1. The “Mood” Persistence (Buffer & Smoothing)
Recommendation: Use
buffer_size := 80(approx. one sentence).Inertia: Use
smooth_alpha := 0.5. This mimics human emotion inertia.
2. Clarity vs. Neutrality (Temperature)
Recommendation: Use
temperature := 1.0. Lower values makes Bob more “extreme”, higher values more neutral.
3. Stretching the Spectrum (Sensitivity)
If Bob stays too “pale” (yellow), increase
sensitivityto2.5-3.0.
Model Choice & Alternatives
-
Label Order:
0: Negative,1: Neutral,2: Positive.Pros: Excellent nuanced understanding of German and English. Recommended.
Requirements
Python:
onnxruntime,tokenizers,matplotlib,PyQt5,PyYAML,numpy<2ROS 2:
rclcpp,rclpy,visualization_msgs,bob_msgs
Installation & Build
Docker (Recommended)
Official images for amd64 and arm64:
docker pull ghcr.io/bob-ros2/bob-face:latest
# Example run with env overrides
docker run -it --rm --network host \
-e MOTION_SECONDS_PER_CHAR=0.05 \
-e SENTIMENT_SENSITIVITY=3.0 \
ghcr.io/bob-ros2/bob-face:latest
Manual Build
cd ~/ros2_ws/src
git clone https://github.com/bob-ros2/bob_face.git
cd ..
rosdep install --from-paths src --ignore-src -r -y
pip install -r src/bob_face/requirements.txt
colcon build --packages-select bob_face