The A2 robot is equipped with a speaker that can perform TTS announcements when connected to the internet. Without an internet connection, it can play basic audio files and adjust volume. It also supports queue playback, playback status queries, and interruption control logic.
priority_level: Priority level, keep as INTERACTION_L6
domain: Identifier for the calling party, can be a custom client string for easier troubleshooting, etc.
trace_id: Announcement ID, if you need to get the announcement status, this field must be passed, and its value should be used as a parameter to query the announcement status
is_interrupted: Whether to interrupt announcements of the same priority, default to true, use false for queue announcements
priority_level: Priority level, no need to pay attention
priority_weight: Priority weight, no need to pay attention
domain: Identifier for the calling party, returns the custom string passed in the request, for easier troubleshooting
trace_id: Announcement ID, returns the custom string passed in the request + a random string, used for querying the announcement status, etc.
is_success: Whether the priority check was successful, generally true, does not mean it will play, for example, passing an incorrect or non-existent file name will still return true, only returns true if there is a higher priority content being announced, such as a fault alarm
error_message: Error message
estimated_duration: Invalid field, no need to pay attention, cannot estimate playback duration
Example Script
examples/agent/tts_broadcast.sh
Notes
Only supports short text requests, up to 1024 bytes, approximately 200 Chinese/English characters
Port number 59201 can still be used, it will automatically forward to 59301
file_name: File name (supports relative or absolute paths. If a relative path is used, the file is read by default from the ORIN /agibot/data/var/hal_audio/file directory, e.g., you can pass wake.pcm. If an absolute path is used, the file is read from the specified path, e.g., /agibot/data/home/agi/Desktop/wake.pcm. The file must be a 24kHz, 16-bit, mono PCM file.)
priority_level: Priority level, keep as INTERACTION_L6
domain: Identifier for the calling party, can be a custom client string for easier troubleshooting, etc.
trace_id: Announcement ID, if you need to get the announcement status, this field must be passed, and its value should be used as a parameter to query the announcement status
is_interrupted: Whether to interrupt announcements of the same priority, default to true, use false for queue announcements
priority_level: Priority level, no need to pay attention
priority_weight: Priority weight, no need to pay attention
domain: Identifier for the calling party, returns the custom string passed in the request, for easier troubleshooting
trace_id: Announcement ID, returns the custom string passed in the request, used for requesting announcement status or interruption
is_success: Whether the priority check was successful, generally true, does not mean it will play, for example, passing an incorrect or non-existent file name will still return true, only returns true if there is a higher priority content being announced, such as a fault alarm
error_message: Error message
estimated_duration: Invalid field, no need to pay attention, cannot estimate playback duration
Example Script
examples/agent/play_media_file.sh
Notes
Supports standard 44-byte header Linear PCM wav files, other header formats and compressed formats are not supported, recommend using 24kHz, 16-bit, mono PCM files
If an incorrect or non-existent file name is passed, it will silently fail without playing, and is_success will return true
Port number 59201 can still be used, it will automatically forward to 59301
7.5.4 TTS/Audio File Playback Status Query RPC Interface
TTSStatusType_InQue: In the broadcast queue, not yet started
TTSStatusType_NOTInQue: No such text in the broadcast queue, and not broadcasting, enters this state after the broadcast ends
The rest of the fields are invalid and do not need to be concerned
Example Script
examples/agent/tts_status_topic.py
Notes
The ROS2 message type for this is ros2_plugin_proto/msg/RosMsgWrapper, which requires sourcing prebuilt/ros2_plugin_proto_aarch64/share/ros2_plugin_proto/local_setup.bash before use.
This interface will only publish if the interaction mode is set to normal or voice_face. There will be no messages in only_voice mode.
audio_volume: Volume level, a numeric value between 0-100, Note: Do not adjust the volume beyond 70, as exceeding this range may cause the speaker to operate beyond its rated capacity, leading to damage
If you do not want to use the audio playback capability provided by the above agent (which calls the atomic capabilities provided by hal_audio at the bottom layer), and instead wish to use the speaker with underlying libraries such as pyaudio/alsasound for audio playback, you need to disable the hal_audio module. The method is as follows:
Back up the /agibot/software/v0/entry/bin/cfg/run_agibot.yaml on ORIN.
Modify the default_apps section, remove the hal_audio module, and then restart the robot.
After restarting, you can use the following devices for playback. Please implement the program call yourself. For audio channel and logical device configurations, refer to the /etc/asound.conf file on ORIN.
Note: The volume setting of the robot’s speaker must not exceed 70%. If the volume exceeds this range, the speaker will be overdriven after being amplified by the amplifier, causing damage to the speaker.