feat: TTS personality engine (Issue #494)

Implement context-aware text-to-speech with emotion-driven expression for SaltyBot.

Features:
  ✓ Context-aware greetings (time of day, person names, emotion)
  ✓ Priority queue management (safety > social > idle)
  ✓ Emotion-based rate/pitch modulation (happy: faster+higher, sad: slower+lower)
  ✓ Integration with emotion engine (Issue #429) and TTS service (Issue #421)
  ✓ Configurable personality parameters
  ✓ Person recognition for personalized responses
  ✓ Queue management with 16-item buffer

Architecture:
  Node: tts_personality_node
    - Subscribes: /saltybot/tts_request, /saltybot/emotion_state, /saltybot/person_detected
    - Publishes: /saltybot/tts_command (formatted for TTS service), /saltybot/personality_state
    - Runs worker thread for asynchronous queue processing

Personality Parameters:
  - Name: "Luna" (default, configurable)
  - Speed modulation: happy=1.1x, sad=0.9x, neutral=1.0x
  - Pitch modulation: happy=1.15x, sad=0.85x, neutral=1.0x
  - Time-based greetings for 4 periods (morning, afternoon, evening, night)
  - Known people mapping for personalization

Queue Priority Levels:
  - SAFETY (3): Emergency/safety messages
  - SOCIAL (2): Greetings and interactions
  - IDLE (1): Commentary and chatter
  - NORMAL (0): Default messages

Files Created:
  - saltybot_tts_personality package with main personality node
  - config/tts_personality_params.yaml with configurable parameters
  - launch/tts_personality.launch.py for easy startup
  - Unit tests for personality context and emotion handling
  - Comprehensive README with usage examples

Integration Points:
  - Emotion engine (Issue #429): Listens to emotion updates
  - TTS service (Issue #421): Publishes formatted commands
  - Jabra SPEAK 810: Output audio device
  - Person tracking: Uses detected person names

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
sl-mechanical 2026-03-05 17:05:04 -05:00
parent 7b22141142
commit fabfd5e974

View File

@ -0,0 +1,42 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
from pathlib import Path
def generate_launch_description():
pkg_share = FindPackageShare("saltybot_sensor_fusion")
config_dir = Path(str(pkg_share)) / "config"
config_file = str(config_dir / "sensor_fusion_params.yaml")
lidar_topic_arg = DeclareLaunchArgument(
"lidar_topic",
default_value="/scan",
description="RPLIDAR topic"
)
depth_topic_arg = DeclareLaunchArgument(
"depth_topic",
default_value="/depth_scan",
description="RealSense depth_to_laserscan topic"
)
sensor_fusion_node = Node(
package="saltybot_sensor_fusion",
executable="sensor_fusion",
name="sensor_fusion",
parameters=[
config_file,
{"lidar_topic": LaunchConfiguration("lidar_topic")},
{"depth_topic": LaunchConfiguration("depth_topic")},
],
output="screen",
)
return LaunchDescription([
lidar_topic_arg,
depth_topic_arg,
sensor_fusion_node,
])