Rosanswers logo

Hi , i am a newbie in ros and currently i am trying to rebuild a programme that came with the package. But how do i do that anyone have any idea? i am currently using rospeex to do voice recognition and answer. Initially i though that all that i was required to do was to change the source cpp file for the English version. After i did that , i rebuild it by using the catkin_build_isolated. However , despite that me changing the programme of the source code and using the catkin_build_isolated. The programme didnt change itself like it still only react to the two words " what time" while i tried to change it to "the time" just to see if the programme would actually be able to change. However it seems like its not possible. Anyone mind telling me where went wrong was it the fact that i used catkin_make_isolated ? because thats what the website actually says to use to compile the programme. Anyone have any suggestion or any ways in which i should do to be able to change the programme ?

I have made another file using their file as reference and apparently it keeps not getting any response from the server as the program uses the server of either google or national institute of information and communication technology.

I have tried to get the api key for google and manage to get one and adding it in and despite that i still get errors. while using the nict's server did not give me any response at all and instead a timeout.

Anyone have suggestions?

the cpp file from the package

#include #include #include <boost/regex.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <ros/ros.h> #include “rospeex_if/rospeex.h”

static rospeex::Interface interface;

void sr_response( const std::string& msg ) { using boost::posix_time::ptime; using boost::posix_time::second_clock; std::string msg_tr(msg); std::cerr << "you said : " << msg << std::endl; std::transform(msg_tr.begin(), msg_tr.end(), msg_tr.begin(), ::tolower);

boost::regex time_reg(".*what time.+"); 
if ( boost::regex_match(msg_tr, time_reg) )

{ std::string text = ""; ptime now = second_clock::local_time(); std::stringstream ss; ss << "It's " << now.time_of_day().hours() << ":" << now.time_of_day().minutes() << "."; text = ss.str(); std::cerr << "rospeex reply : " << text << std::endl; interface.say(text, "en", "nict"); } }

int main( int argc, char** argv ) { ros::init(argc, argv, "sr_ss_demo");

interface.init(); interface.registerSRResponse( sr_response ); interface.setSPIConfig("en", "nict"); ros::spin(); return 0; }

Originally posted by lolz733 on ROS Answers with karma: 11 on 2016-09-21

Post score: 0


1 Answer 1


Rosanswers logo

could you make your question clearer?

or if I understand it right, you wanna ask changing a cpp file from a package and building it in ROS?

Originally posted by DinnerHowe with karma: 188 on 2016-09-23

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by lolz733 on 2016-09-23:
yes thats what i want to do , however when i did that it seems as though as i did not manage to change how the program work. Because what the example that rospeex gives essentially is to detect the word "what time" and give the time output. But what i tried to do is to make it such that it detect

Comment by lolz733 on 2016-09-23:
"the time" instead of "what time" to check if i can actually change the program but it turns out that i can't. So i need to know why i can't change what the program.

Comment by DinnerHowe on 2016-09-23:
firstly, you need configure your CMakeLists.txt and package.xml

read this and this 6.0

after that go to your workspace

cd ~/you_catkin_ws

then, catkin_make and source it

Comment by DinnerHowe on 2016-09-23:
or alternately, you can use python for easy.

in ROS python code does not need to figure and make every time you changing your package

Comment by lolz733 on 2016-09-23:
err then why does the original package uses catkin_make_isolated?

Comment by DinnerHowe on 2016-09-23:
Once pkg has completed downloading the packages and resolving the dependencies you are ready to build the catkin packages. We will use the catkin_make_isolatedcommand because there are both catkin and plain cmake packages in the base install


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.