Go to the documentation of this file.
32 template <
typename RecognizerDataType,
typename RecognizerType,
typename ActionType>
43 const typename RecognizerDataType::Parameters& parameters)
49 auto record_timeout = local_nh.
param(
"record_timeout", 300.);
52 throw std::runtime_error(
"~access_key not specified");
54 recognizer_.initialize(record_directory, record_timeout);
57 "Recognizer sensitivity", 0., 1.);
61 ROS_INFO(
"RecognizerNode(name=%s, action_name=%s, record_directory=%s, record_timeout=%.2f) initialized with "
63 name.c_str(), action_name.c_str(), record_directory.c_str(), record_timeout,
73 virtual void updateParameters(
const typename ActionType::_action_goal_type::_goal_type& goal,
74 typename RecognizerDataType::Parameters& parameters) = 0;
75 virtual void updateResult(
const typename RecognizerDataType::Result& result,
76 typename ActionType::_action_result_type::_result_type& action_result) = 0;
79 void executeCallback(
const typename ActionType::_action_goal_type::_goal_type::ConstPtr& goal)
81 typename ActionType::_action_result_type::_result_type action_result;
87 catch (
const std::exception& e)
89 std::string msg =
"Invalid goal: " + std::string(e.what());
100 catch (
const std::exception& e)
102 std::string msg =
"Could not configure recognizer: " + std::string(e.what());
122 catch (
const std::exception& e)
124 std::string msg =
"Recognize error: " + std::string(e.what());
void executeCallback(const typename ActionType::_action_goal_type::_goal_type::ConstPtr &goal)
ddynamic_reconfigure::DDynamicReconfigure dynamic_reconfigure_server_
bool getParam(const std::string &key, bool &b) const
RecognizerType recognizer_
virtual void updateResult(const typename RecognizerDataType::Result &result, typename ActionType::_action_result_type::_result_type &action_result)=0
actionlib::SimpleActionServer< ActionType > action_server_
bool isPreemptRequested()
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
std::string defaultRecordDirectory(const std::string &name)
defaultRecordDirectory Get the default record dir
virtual void updateParameters(const typename ActionType::_action_goal_type::_goal_type &goal, typename RecognizerDataType::Parameters ¶meters)=0
RecognizerNode(const std::string &name, const std::string &action_name, const typename RecognizerDataType::Parameters ¶meters)
RecognizerNode Recognizer node that exposes an action interface for a recognizer.
RecognizerDataType::Parameters parameters_
void setPreempted(const Result &result=Result(), const std::string &text=std::string(""))
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))
T param(const std::string ¶m_name, const T &default_val) const
std::string toString(const T &v)
constexpr double EXECUTE_PERIOD