Skip to content
Tomoya Itsuka edited this page Nov 12, 2019 · 2 revisions

tms_ur_speaker

This package is made for ros2_tms announce, SE, etc... It contains only one nodes.

Requirements

  • PC(or Raspi)
    • Ubuntu18.04
  • USB speaker

How to run

ros2 run tms_ur_speaker tms_ur_speaker_node

Service

There are two services available.

speaker_srv

This service can speech japanese text data,

ros2 service call speaker_srv tms_msg_ur.srv.SpeakerSrv '{"data": "こんにちは!"}'

and also play SE(local file). If you want to play local file, please set request.data "\<your_file_ path>".

ros2 service call speaker_srv tms_msg_ur.srv.SpeakerSrv '{"data": "\./wav/SE.wav"}'

speaker_wav_srv

This service can play wavefile from service request.data. Below is an example of a node that uses it.

class TestClientNode(Node):

    ...

    async def play_wave(self, filename):
        self.cli_speaker_wav = self.create_client(SpeakerWavSrv, 'speaker_wav_srv', callback_group=ReentrantCallbackGroup())
        while  not self.cli_speaker_wav.wait_for_service(1.0):
            self.get_logger().info('service "speaker_wav_srv" not found...')
        
        data = b''
        with open(filename,mode='rb') as f:
            data = f.read()

        self.get_logger().info('send request')
        req = SpeakerWavSrv.Request()

        datas = list(bytearray(data))
        for d in datas:
            req.data.append(d.to_bytes(1,"little"))
        
        await self.cli_speaker_wav.call_async(req)
        self.get_logger().info('end service')

    ...

ROS-TMS

Database

Task Scheduler

Robot Controller

Messages of ROS2-TMS

Sensor System

User Request

ROS-TMS Developer

Clone this wiki locally