[🤔 ROS2?] /asr/set_locale#

Caution

This documentation page has been auto-generated.

It may be missing some details.

/asr/set_locale Quick Facts

Category

💬 Communication

Message type

i18n_msgs/action/SetLocale

Sets the current language of the vosk speech recognition (ASR) engine. Returns immediately if the required language is already loaded.

See asr_howto and internationalization for details.

Quick snippets#

Send a goal from the command-line#
$ ros2 action send_goal /asr/set_locale i18n_msgs/action/SetLocale # press Tab to complete the message prototype

How to use in your code#

Call the action from a Python script#
#!/usr/bin/env python

import rclpy
from rclpy.action import ActionClient
from rclpy.node import Node

from i18n_msgs.action import SetLocale

class SetLocaleActionClient(Node):

    def __init__(self):
        super().__init__('asr_set_locale_client')
        self._action_client = ActionClient(self, SetLocale, '/asr/set_locale')

    def send_goal(self, a, b):
        goal_msg = SetLocale.Goal()

        # TODO: adapt to the action's parameters
        # check https://github.com/pal-robotics/i18n_msgs/tree/humble-devel/action/SetLocale.action
        # for the possible goal parameters
        # goal_msg.a = a
        # goal_msg.b = b

        self._action_client.wait_for_server()

        return self._action_client.send_goal_async(goal_msg)

if __name__ == '__main__':
    rclpy.init(args=args)

    action_client = SetLocaleActionClient()

    # TODO: adapt to your action's parameters
    future = action_client.send_goal(a, b)

    rclpy.spin_until_future_complete(action_client, future)

    rclpy.shutdown()