Skip to content

Commit 268eff1

Browse files
committed
rename node
1 parent 56cebc0 commit 268eff1

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

examples/ros2/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# WhisperTRT - ROS2 Node
2+
3+
This example includes a ROS2 node for interfacing with WhisperTRT.
4+
5+
It includes the full pipeline, including connecting to a microphone, and outputs recognized speech
6+
segments on the ``/speech`` topic.
7+
8+
| Name | Description | Default |
9+
|------|-------------|---------|
10+
| model | The Whisper model to use. | "small.en" |
11+
| backend | The Whisper backend to use. | "whisper_trt" |
12+
| cache_dir | Directory to cache the built models. | None |
13+
| vad_window | Number of audio chunks to use in max-filter window for voice activity detection. | 5 |
14+
| mic_device_index | The microphone device index. | None |
15+
| mic_sample_rate | The microphone sample rate. | 16000 |
16+
| mic_channels | The microphone number of channels. | 6 |
17+
| mic_bitwidth | The microphone bitwidth. | 2 |
18+
| speech_topic | The topic to publish speech segments to. | "/speech" |

examples/ros2/asr_node.py renamed to examples/ros2/whisper_trt_node.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
from rclpy.node import Node
2525
from std_msgs.msg import String
2626
from rcl_interfaces.msg import ParameterDescriptor
27-
from asr_pipeline import ASRPipeline
27+
from whisper_trt_pipeline import WhisperTRTPipeline
2828

2929

30-
class AsrNode(Node):
30+
class WhisperTRTNode(Node):
3131
def __init__(self):
32-
super().__init__('AsrNode')
32+
super().__init__('WhisperTRTNode')
3333

3434
self.declare_parameter("model", "small.en")
3535
self.declare_parameter("backend", "whisper_trt")
@@ -66,7 +66,7 @@ def handle_asr(text):
6666
self.speech_publisher.publish(msg)
6767
logger.info("published " + text)
6868

69-
self.pipeline = ASRPipeline(
69+
self.pipeline = WhisperTRTPipeline(
7070
model=self.get_parameter("model").value,
7171
vad_window=self.get_parameter("vad_window").value,
7272
backend=self.get_parameter("backend").value,
@@ -87,7 +87,7 @@ def start_asr_pipeline(self):
8787

8888
def main(args=None):
8989
rclpy.init(args=args)
90-
node = AsrNode()
90+
node = WhisperTRTNode()
9191

9292
node.start_asr_pipeline()
9393

examples/ros2/asr_pipeline.py renamed to examples/ros2/whisper_trt_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def transcribe(self, audio):
301301
self.asr_callback(text)
302302

303303

304-
class ASRPipeline:
304+
class WhisperTRTPipeline:
305305

306306
def __init__(self,
307307
model: str = "small.en",
@@ -389,7 +389,7 @@ def handle_vad_end():
389389
def handle_asr(text):
390390
print("asr done: " + text)
391391

392-
pipeline = ASRPipeline(
392+
pipeline = WhisperTRTPipeline(
393393
model=args.model,
394394
backend=args.backend,
395395
cache_dir=args.cache_dir,

0 commit comments

Comments
 (0)