robomaster_ros
robomaster_ros copied to clipboard
the action server failed to start: robomaster_msgs.action.PlaySound, "play"
the speaker.py: cmd_sound cannot play the wav file. I tried demo1.wav.
the below code skipped msg.file. just only passed three parameters to the function play:
self.play(sound_id=msg.sound_id, times=msg.times, control=msg.control)
by using these new code robomaster s1 can play a wav file:
if msg.file and msg.control:
self.api.play_audio(msg.file).wait_for_completed()
else:
self.play(sound_id=msg.sound_id, times=msg.times, control=msg.control)
Maybe it's not the best way to play a wav file, Can someone give me any suggestion?
and the action server play didn't start, I only can find /play/_action/cancel_goal in rqt service caller , but the command: ros2 action list can find /play, strange !!!
**_self._sound_action_server = rclpy.action.ActionServer(
node, robomaster_msgs.action.PlaySound, "play", self.execute_play_sound,
goal_callback=self.new_speaker_goal_callback,
cancel_callback=self.cancel_callback, callback_group=cbg)_**