Speaker
This module controls the speaker. It exposes commands to play system sounds indentified by an ID) and wav files.
Note
Sound ids between 0x107 and 0x12A corresponds to three octaves of piano notes, from C1=0x107 to B3=0x12A.
Parameter
-
parameter speaker.enabled bool [Default:
false
]
Subscribers
- subscription cmd_sound robomaster_msgs/msg/SpeakerCommand.
The command stops or start playing a system sound or a wav file for a number of times. Message field
control
select the command:0: stop playing the sound with id
sound_id
, if any is playing.1: start playing the sound with id
sound_id
, stop playing any other sound.2: start playing the sound with id
sound_id
, without stop playing other sounds.
When
file
is not empty, the driver plays it, ignoringsound_id
. The file is loaded through FTP the first time it is played and assigned asound_id
between 0xE0 and 0xEA for successive uses.It exposes a similar interface as play with the difference that multiple sounds can be played at the same time and sounds can be selectively stopped.
Action Servers
- action server play robomaster_msgs/action/PlaySound
The action wraps
rm:robomaster.robot.Robot.play_sound()
to play a system sound or a wav file for a number of times. Whenfile
is not empty, the driver plays it, ignoringsound_id
. The file is loaded through FTP the first time it is played and assigned asound_id
between 0xE0 and 0xEA for successive uses.Action feedback contains the progress and the repetition count. The action terminates once all repetitions have been played.
The action exposes a similar interface as cmd_sound: use the action if you want to be notified when the sound finishes playing. Contrary to cmd_sound, the action play does not allow to play multiple sounds at the same time and to start a playing a new sound, you need to cancel the action.