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

Provide parameters to OpenCV C++ program in ROS from external file

asked 2013-03-16 08:23:36 -0600

KarthikMurugan gravatar image

updated 2013-03-16 08:26:52 -0600

I want to write a program using OpenCV C++ interface in ROS. I want to provide parameters used by the program from external file(not sure which format will be apt).

Say, I use the threshold function in the program, instead of changing the threshold value each time in the program,make and then run, I want the program to fetch the threshold value from a file so that if I wish to change any value, I could do it in the external file.

I want this because I think it will be helpful to a third-person who can just change the various parameters in the file and observe the result rather than opening the program, change values,make and run (Sometimes the third person may not be a programmer and just wishes to see the results, in that case he would not know the technicalities of where to change parameters in the program)

I am new to ROS. I am using Fuerte. Is there any way to do this in ROS ??

Thank you

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-03-16 08:58:08 -0600

Chad Rockey gravatar image

More specifically, check out roslaunch and the ability to import parameters via yaml files.

And a sample of how to include the parameters:

So after you change the file, you only need to run in the command line: "roslaunch package something.launch"

edit flag offensive delete link more



This is definitely the best approach. You can also specify command-line args to launch files, allowing you to specify the YAML (config) file to use each time you launch the node. Also, you can load a set of default values from a YAML file and use cmd-line args to override indiv. params at runtime.

Jeremy Zoss gravatar image Jeremy Zoss  ( 2013-03-17 19:29:17 -0600 )edit

answered 2013-03-16 08:55:02 -0600

dornhege gravatar image

ROS provides functionality for exactly that purpose. The Paramter Server. Have a look at that.

edit flag offensive delete link more

Question Tools


Asked: 2013-03-16 08:23:36 -0600

Seen: 716 times

Last updated: Mar 16 '13