Main Page
Namespaces
Classes
Files
File List
src
julius_ros
audio_transport.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# Copyright: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>
4
5
import
rospy
6
import
struct
7
from
julius_ros.transport
import
SocketTransport
8
from
audio_common_msgs.msg
import
AudioData
9
10
11
class
AudioTransport
(
SocketTransport
):
12
def
__init__
(self, host, port, max_retry, topic_name):
13
super(AudioTransport, self).
__init__
(host, port, max_retry)
14
self.
topic_name
= topic_name
15
self.
sub_audio
=
None
16
17
def
start
(self):
18
self.
sub_audio
= rospy.Subscriber(self.
topic_name
, AudioData, self.
audio_cb
)
19
super(AudioTransport, self).
start
()
20
21
def
join
(self):
22
super(AudioTransport, self).
join
()
23
if
self.
sub_audio
:
24
self.sub_audio.unregister()
25
26
def
audio_cb
(self, msg):
27
header = struct.pack(
'i'
, len(msg.data))
28
self.
send
(header + msg.data)
julius_ros.audio_transport.AudioTransport.sub_audio
sub_audio
Definition:
audio_transport.py:15
julius_ros.transport
Definition:
transport.py:1
julius_ros.audio_transport.AudioTransport.__init__
def __init__(self, host, port, max_retry, topic_name)
Definition:
audio_transport.py:12
julius_ros.transport.SocketTransport.send
def send(self, data)
Definition:
transport.py:112
julius_ros.audio_transport.AudioTransport.join
def join(self)
Definition:
audio_transport.py:21
julius_ros.transport.SocketTransport
Definition:
transport.py:11
julius_ros.audio_transport.AudioTransport
Definition:
audio_transport.py:11
julius_ros.audio_transport.AudioTransport.audio_cb
def audio_cb(self, msg)
Definition:
audio_transport.py:26
julius_ros.audio_transport.AudioTransport.start
def start(self)
Definition:
audio_transport.py:17
julius_ros.audio_transport.AudioTransport.topic_name
topic_name
Definition:
audio_transport.py:14
julius_ros
Author(s): Yuki Furuta
autogenerated on Wed Jul 10 2019 03:47:05