Class Voice

Inheritance Relationships

Base Types

Class Documentation

class Voice : public hri::FeatureTracker, public std::enable_shared_from_this<Voice>

Public Functions

Voice(ID id, NodeInterfaces node_interfaces, rclcpp::CallbackGroup::SharedPtr callback_group, const tf2::BufferCore &tf_buffer, const std::string &reference_frame)
virtual ~Voice()
inline std::optional<bool> isSpeaking() const

Returns speech is currently detected in this voice, ie, whether the person is currently speaking.

inline std::optional<std::string> speech() const

Returns the last recognised final sentence.

inline std::optional<std::string> incrementalSpeech() const

Returns the last recognised incremental sentence.

inline std::optional<std::string> locale() const

Returns the last recognised speech locale.

inline void onSpeaking(std::function<void(bool)> callback)

Registers a callback function, to be invoked everytime speech is detected.

See also:

inline void onSpeech(std::function<void(const std::string&, const std::string&)> callback)

Registers a callback function, to be invoked everytime a full speech is detected.

Only final sentences for this voice are returned, for instance at the end of a sentence. The callback takes two arguments:

  1. the recognised speech text,

  2. the locale.

See also: Voice::onIncrementalSpeech for incremental feedback

inline void onSpeech(std::function<void(const std::string&)> callback)

Deprecated:

Use void onSpeech(std::function<void(const std::string &, const std::string &)> callback).

inline void onIncrementalSpeech(std::function<void(const std::string&, const std::string&)> callback)

Registers a callback function, to be invoked everytime speech any speech is detected.

The callback will be triggered every time the speech recogniser returns a result, even if it is not the final result. The callback takes two arguments:

  1. the recognised speech text,

  2. the locale.

See also: Voice::onSpeech for final feedback

inline void onIncrementalSpeech(std::function<void(const std::string&)> callback)

Deprecated:

Use void onSpeech(std::function<void(const std::string &, const std::string &)> callback).