Ask Your Question
0

Compiling and Running C++ scripts in ROS Indigo

asked 2017-02-09 00:15:41 -0500

user_123 gravatar image

I have written three C++ codes for one server and two clients using C++. Now I want to compile and run these scripts in ROS. I have the beginner_tutorials package as created in the tutorial. I have kept those scripts in the src directory under beginner_tutorials. But after doing catkin_make it is not getting compiled. Moreover, I have to provide command-line arguments while running those programs. I am not sure how to do that also. If anyone can help me with the steps to do it in Ubuntu 14.04. Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-02-09 01:32:10 -0500

mgruhler gravatar image

There should be plenty of examples on the wiki. Also, it helps if you are familiar with CMake, as you need to adapt the CMakeLists.txt.

Below a list of links that should answer all your questions:

Passing in command line arguments is done just like for any other C++ program. This also works with rosrun

rosrun my_package my_node my_arg1 ...

edit flag offensive delete link more

Comments

Thank you,I have gone through the tutorial once more and edited the CMakeLists.txt. It is working fine with rosrun now.

user_123 gravatar imageuser_123 ( 2017-02-10 03:44:06 -0500 )edit
1

answered 2017-02-09 01:30:10 -0500

Akif gravatar image

Please go over ROS beginner tutorials starting from scratch.

Especially, Creating a ROS Package and Building a ROS Package parts will help. You need to set your CMakeLists.txt file to build properly.

edit flag offensive delete link more

Comments

Thank you,I have gone through the tutorial once more and edited the CMakeLists.txt. It is working fine with rosrun now.

user_123 gravatar imageuser_123 ( 2017-02-10 03:44:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-02-09 00:15:41 -0500

Seen: 3,491 times

Last updated: Feb 09 '17