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

How to always load a parameter (without adding it to every launch file)

asked 2018-08-25 11:00:23 -0600

knxa gravatar image

updated 2018-08-26 03:55:01 -0600

gvdhoorn gravatar image

ROS melodic is introducing a new parameter /rosout_disable_topics_generation. It seems this does something I have wanted for long: omitting the (often long) topics list in the rosout messages.

Can I have some sort of global setup so any roscore will set /rosout_disable_topics_generation to True? I want to avoid that every launch file chain must somewhere include a <param> tag that sets this parameter.

edit retag flag offensive close merge delete

Comments

I'm confused: are you starting multiple masters?

gvdhoorn gravatar image gvdhoorn  ( 2018-08-25 14:09:27 -0600 )edit

No, but I can see my title wasn't chosen well. Sorry.

I just want this parameter to be set no matter which roslaunch file I run, for any rostest etc., without having to define it multiple places.

knxa gravatar image knxa  ( 2018-08-25 17:05:32 -0600 )edit

Updated your title. Couldn't really come up with something 'catchy', but this at least covers the question better I believe.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-26 03:56:32 -0600 )edit

As to the question I don't believe that is currently supported. Not officialy anyway.

Edit: you might take a look at wiki/roscore. Editing roscore.xml might be a way to get this in there, but that file is managed by your pkg manager by default. I don't ..

gvdhoorn gravatar image gvdhoorn  ( 2018-08-26 03:56:50 -0600 )edit

.. know whether you can provide an override for it. See ros/ros_comm/tools/roslaunch/resources/roscore.xml for the default contents.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-26 04:03:49 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-08-26 04:09:00 -0600

gvdhoorn gravatar image

updated 2018-08-26 04:39:30 -0600

I don't know of any environment variable (or a similar piece of infrastructure) that you could use for this, but perhaps using the support for loading roscore.xml from /etc/ros could be used for this.

roscore will try to load that file from /etc/ros first, and if that fails, default to the file in the roslaunch package (which will be in /opt/ros/$distro/share). See ros/ros_comm/tools/roslaunch/src/roslaunch/config.py, lines 78 to 84.

I've not tested this, but you could copy the default file to /etc/ros and then add the parameter there.


Edit: apparently the value of ROS_ETC_DIR on my machine (Xenial, Kinetic) is /opt/ros/kinetic/etc/ros instead of /etc/ros.

In any case: adding a parameter to /opt/ros/kinetic/etc/ros/roscore.xml makes it part of the 'default' set of parameters that get set for every roscore launch. Do read the wiki page I linked in my comment for some more information about that file though.

It would have been ideal if /etc/ros was also searched, as that would allow per-machine or per-deployment configuration. I seem to remember some discussion a few years ago about exactly this, but can't find it right now.

edit flag offensive delete link more

Comments

I confirm that it works by adding

<param name="rosout_disable_topics_generation" value="True" />

to

/opt/ros/melodic/etc/ros/roscore.xml

I agree that it would be nice if I could add this to a non-package controlled file.

knxa gravatar image knxa  ( 2018-08-28 06:35:08 -0600 )edit

Well, as I wrote, I remember there being quite a bit of discussion about this, and remember Clearpath being involved in it. Seeing as they have quite a few deployment scenarios where this would come in handy, I can imagine it's actually possible. I just can't remember.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-28 06:37:33 -0600 )edit

Just found that the environment var ROS_ETC_DIR controls where roscore will look for the roscore.xml file. So with this I can have my own version of roscore.xml and just point to that location.

knxa gravatar image knxa  ( 2019-03-05 03:44:46 -0600 )edit

I'd actually considered that when posting my answer, see the last Edit.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-05 03:46:20 -0600 )edit

Hmmm you're right, sorry I overlooked that.

knxa gravatar image knxa  ( 2019-03-05 03:58:50 -0600 )edit

No problem.

ROS_ETC_DIR can definitely be part of a solution.

Might pay to take a look at a (recent) Clearpath system (Husky, Heron). They tend to use this sort of setup often.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-05 04:04:06 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-08-25 11:00:23 -0600

Seen: 1,133 times

Last updated: Aug 26 '18