Go to the documentation of this file.
18 #include <picovoice_msgs/GetKeywordAction.h>
26 using namespace picovoice_msgs;
31 :
RecognizerNode(
"porcupine",
"get_keyword", parameters), keywords_directory_(keywords_directory)
38 if (goal.keywords.empty())
40 throw std::runtime_error(
"No keywords specified");
44 for (
const auto& keyword : goal.keywords)
78 catch (
const std::exception& e)
80 ROS_FATAL(
"PorcupineNode exception: %s", e.what());
std::string pathFromUrl(const std::string &url, const std::string &extension, const std::string &directory)
pathFromUrl Get a file path from an url
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
std::string model_path_
model_path_ Path to the Picovoice model parameters
PorcupineNode(const PorcupineRecognizerData::Parameters ¶meters, const std::string &keywords_directory)
void updateParameters(const GetKeywordGoal &goal, PorcupineRecognizerData::Parameters ¶meters) override
std::string keywords_directory_
int main(int argc, char **argv)
std::map< std::string, std::string > keywords_
keywords_ Map from a keyword names to a keyword.ppn paths
std::string defaultResourceUrl()
defaultResourcePath Get the default resource path
T param(const std::string ¶m_name, const T &default_val) const
void updateResult(const PorcupineRecognizerData::Result &result, GetKeywordResult &action_result) override
bool is_understood_
is_understood_ Whether the recognizer understood a keyword
std::string keyword_name_
keyword_name_ Detected keyword name