whisper_ros: whisper.cpp for ROS 2
Loading...
Searching...
No Matches
whisper_node.hpp
Go to the documentation of this file.
1// MIT License
2
3// Copyright (c) 2023 Miguel Ángel González Santamarta
4
5// Permission is hereby granted, free of charge, to any person obtaining a copy
6// of this software and associated documentation files (the "Software"), to deal
7// in the Software without restriction, including without limitation the rights
8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9// copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21// SOFTWARE.
22
23#ifndef WHISPER_NODE_HPP
24#define WHISPER_NODE_HPP
25
26#include <memory>
27
28#include <std_msgs/msg/float32_multi_array.hpp>
29#include <std_srvs/srv/empty.hpp>
30
31#include "whisper_msgs/msg/transcription.hpp"
32#include "whisper_msgs/srv/set_grammar.hpp"
33#include "whisper_msgs/srv/set_init_prompt.hpp"
35
36namespace whisper_ros {
37
39
40public:
42
45
46private:
47 rclcpp::Publisher<whisper_msgs::msg::Transcription>::SharedPtr publisher_;
48 rclcpp::Subscription<std_msgs::msg::Float32MultiArray>::SharedPtr
50
51 rclcpp::Service<whisper_msgs::srv::SetGrammar>::SharedPtr
53 rclcpp::Service<std_srvs::srv::Empty>::SharedPtr reset_grammar_service_;
54 rclcpp::Service<whisper_msgs::srv::SetInitPrompt>::SharedPtr
56 rclcpp::Service<std_srvs::srv::Empty>::SharedPtr reset_init_prompt_service_;
57
58 void vad_callback(const std_msgs::msg::Float32MultiArray::SharedPtr msg);
60 const std::shared_ptr<whisper_msgs::srv::SetGrammar::Request> request,
61 std::shared_ptr<whisper_msgs::srv::SetGrammar::Response> response);
63 const std::shared_ptr<std_srvs::srv::Empty::Request> request,
64 std::shared_ptr<std_srvs::srv::Empty::Response> response);
66 const std::shared_ptr<whisper_msgs::srv::SetInitPrompt::Request> request,
67 std::shared_ptr<whisper_msgs::srv::SetInitPrompt::Response> response);
69 const std::shared_ptr<std_srvs::srv::Empty::Request> request,
70 std::shared_ptr<std_srvs::srv::Empty::Response> response);
71};
72
73} // namespace whisper_ros
74
75#endif
Definition whisper_base_node.hpp:38
Definition whisper_node.hpp:38
WhisperNode()
Definition whisper_node.cpp:32
void set_grammar_service_callback(const std::shared_ptr< whisper_msgs::srv::SetGrammar::Request > request, std::shared_ptr< whisper_msgs::srv::SetGrammar::Response > response)
Definition whisper_node.cpp:91
rclcpp::Publisher< whisper_msgs::msg::Transcription >::SharedPtr publisher_
Definition whisper_node.hpp:47
rclcpp::Service< whisper_msgs::srv::SetInitPrompt >::SharedPtr set_init_prompt_service_
Definition whisper_node.hpp:55
void reset_init_prompt_service_callback(const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
Definition whisper_node.cpp:120
rclcpp::Service< whisper_msgs::srv::SetGrammar >::SharedPtr set_grammar_service_
Definition whisper_node.hpp:52
rclcpp::Service< std_srvs::srv::Empty >::SharedPtr reset_grammar_service_
Definition whisper_node.hpp:53
rclcpp::Subscription< std_msgs::msg::Float32MultiArray >::SharedPtr subscription_
Definition whisper_node.hpp:49
void vad_callback(const std_msgs::msg::Float32MultiArray::SharedPtr msg)
Definition whisper_node.cpp:84
void reset_grammar_service_callback(const std::shared_ptr< std_srvs::srv::Empty::Request > request, std::shared_ptr< std_srvs::srv::Empty::Response > response)
Definition whisper_node.cpp:102
rclcpp::Service< std_srvs::srv::Empty >::SharedPtr reset_init_prompt_service_
Definition whisper_node.hpp:56
void set_init_prompt_service_callback(const std::shared_ptr< whisper_msgs::srv::SetInitPrompt::Request > request, std::shared_ptr< whisper_msgs::srv::SetInitPrompt::Response > response)
Definition whisper_node.cpp:112
void activate_ros_interfaces()
Definition whisper_node.cpp:36
void deactivate_ros_interfaces()
Definition whisper_node.cpp:63
Definition whisper.hpp:45