|
@@ -15,9 +15,7 @@ namespace snowboy_wakeup
|
|
|
std::string pre_param = "play -q --multi-threaded ";
|
|
|
std::string all_param;
|
|
|
|
|
|
- //!
|
|
|
//! \brief The HotwordDetectorNode class Wraps the C++ 11 Snowboy detector in a ROS node
|
|
|
- //!
|
|
|
class HotwordDetectorNode
|
|
|
{
|
|
|
public:
|
|
@@ -26,7 +24,6 @@ namespace snowboy_wakeup
|
|
|
|
|
|
bool initialize()
|
|
|
{
|
|
|
-
|
|
|
std::string resource_filename;
|
|
|
if (!nh_p_.getParam("resource_filename", resource_filename))
|
|
|
{
|
|
@@ -73,40 +70,28 @@ namespace snowboy_wakeup
|
|
|
private:
|
|
|
ros::NodeHandle nh_;
|
|
|
|
|
|
- //!
|
|
|
//! \brief nh_p_ Local nodehandle for parameters
|
|
|
- //!
|
|
|
ros::NodeHandle nh_p_;
|
|
|
|
|
|
ros::Subscriber audio_sub_;
|
|
|
ros::Publisher hotword_pub_;
|
|
|
|
|
|
- //!
|
|
|
//! \brief dynamic_reconfigure_server_ In order to online tune the sensitivity and audio gain
|
|
|
- //!
|
|
|
dynamic_reconfigure::Server<SnowboyReconfigureConfig> dynamic_reconfigure_server_;
|
|
|
|
|
|
- //!
|
|
|
//! \brief detector_ C++ 11 Wrapped Snowboy detect
|
|
|
- //!
|
|
|
HotwordDetector detector_;
|
|
|
|
|
|
-
|
|
|
- //!
|
|
|
//! \brief reconfigureCallback Reconfigure update for sensitiviy and audio level
|
|
|
//! \param cfg The updated config
|
|
|
- //!
|
|
|
void reconfigureCallback(SnowboyReconfigureConfig cfg, uint32_t)
|
|
|
{
|
|
|
detector_.configure(cfg.sensitivity, cfg.audio_gain);
|
|
|
- ROS_INFO("SnowboyROS (Re)Configured");
|
|
|
+ ROS_INFO("SnowboyROS ReConfigured callback init");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //!
|
|
|
//! \brief audioCallback Audio stream callback
|
|
|
//! \param msg The audo data
|
|
|
- //!
|
|
|
void audioCallback(const audio_common_msgs::AudioDataConstPtr& msg)
|
|
|
{
|
|
|
if (msg->data.size() != 0)
|
|
@@ -127,7 +112,7 @@ namespace snowboy_wakeup
|
|
|
if (result == 1 || btn_click == 1)
|
|
|
{
|
|
|
btn_click = 0;
|
|
|
- ROS_DEBUG("wakeUp detected!");
|
|
|
+ ROS_INFO("wakeUp detected!");
|
|
|
hotword_msg.data = 1;
|
|
|
hotword_pub_.publish(hotword_msg);
|
|
|
system(all_param.data());
|