ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How i change the existing package with programme to what i need?

asked 2016-09-21 02:21:34 -0500

lolz733 gravatar image

updated 2016-09-23 04:11:02 -0500

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 <iostream> #include <sstream> #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; }

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2016-09-23 03:48:34 -0500

DinnerHowe gravatar image

updated 2016-09-23 05:19:31 -0500

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?

edit flag offensive delete link more

Comments

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

lolz733 gravatar image lolz733  ( 2016-09-23 03:54:05 -0500 )edit

"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.

lolz733 gravatar image lolz733  ( 2016-09-23 03:55:55 -0500 )edit

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

DinnerHowe gravatar image DinnerHowe  ( 2016-09-23 05:12:07 -0500 )edit

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

DinnerHowe gravatar image DinnerHowe  ( 2016-09-23 05:14:13 -0500 )edit

err then why does the original package uses catkin_make_isolated?

lolz733 gravatar image lolz733  ( 2016-09-23 07:39:22 -0500 )edit

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

DinnerHowe gravatar image DinnerHowe  ( 2016-09-23 10:43:53 -0500 )edit

Question Tools

Stats

Asked: 2016-09-21 02:21:34 -0500

Seen: 207 times

Last updated: Sep 23 '16