andyblarblar / ros2_tts

0 stars 1 forks source link

Hi, I am building up a ROS2 Create3 bot. I built your ros2_tts module.. How do I use it ? #1

Closed jerrynsr closed 2 years ago

jerrynsr commented 2 years ago

Hi, I have ROS2 Galactic running on a RPI4 inside the payload area of my Create3. The Create 3 works with all the irobot ROS examples. How do I use your ros2_tts module ? What speach synthesizer do I need to install ? Festival ?

andyblarblar commented 2 years ago

Just install the pip requirements file in the node, as far as I'm aware this should install everything you need. I'm using espeak under the hood, so you may need to install that manually. The node is insanly simple right now (this was mostly a joke, to be honest). It hosts a service 'tts_speak' which takes this message type. Simply send the service that message with the words you want it to say, and it will say them. Thats really it for now, so I would encourage hacking around with it if you want, there's definitly a lot of potential, I'm just working on other projects atm.

On another note, I don't belive the create 3 speaker just takes audio, so you'll either need to connect a speaker to the pi or hack together some sort of audio decomposer to send waveforms to their ROS2 sound service.

jerrynsr commented 2 years ago

I'm getting there. My problem was I didn't install ros2_tts in my create3_ws profile. After I did that and ran colcon I can see the service with ros2 see ros2 service type /tts_speak: tts_interfaces/srv/TtsSpeak

What is the syntax I need to use to send a message to the service ?

I am trying to send to the service using this syntax: ros2 service call /tts_speak tts_interfaces/srv/TtsSpeak "{Hello }"

It results with an error: the passed service type is invalid

When I verify the service type it looks fine: ros2 service type /tts_speak tts_interfaces/srv/TtsSpeak

andyblarblar commented 2 years ago

I actually got stuck on this while writing this node, the ros2 docs don't explain this command well

What you're missing is that call argument is itself YAML, so it needs to be formatted like this: ros2 service call /tts_speak tts_interfaces/srv/TtsSpeak "{msg: {words: 'Im made of metal, my circuits gleam, I am perpetual, I keep the country clean'}}"

Look at the interface and then at that string and the structure should be pretty obvious if you've used JSON before. The formatting is pretty specific though, so keep those spaces in check.

FYI you also need to have the ws sourced in the terminal where you call from, else it will just say the interface is wrong. Ran into this issue while writing this up lol.

jerrynsr commented 2 years ago

That's what it was. Here's what I have working so far on the Create3. Joystick control for training the bot. basically use one button on a gamepad to start ros2 bag record, guide the robot to a target.., a round trip, stop rosw bag record. usb camera stream from the RPI4 to my linux desktop through ssh -X.
Later on I plan on using the ros2 bag playback. When a Blink camera triggers and IFTTT event the Create3 bot will go to the closest room to the outdoor camera and bark like a dog. That's the first test. I'm saving up for an Oak D Lite now. Thanks a lot for ros2_tts,