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

Do you have to run /devel/setup.bash in a workspace before running any node?

asked 2018-10-13 16:02:18 -0500

jburns gravatar image

I implemented a simple talker and listener node inside of a self created package. When I was first getting them to run successfully, I noticed a weird pattern. I ran "roscore" in my first terminal. Then I ran my "talker" node. It stated that the package was not found. I ran the /devel/setup.bash, and reran the talker node. This time it successfully started publishing on a topic. I had to do the same to run my listener node in the third console.

Important Facts: - Both nodes are in the same package - All commands ran from within top level of workspace

I am just wondering if it is normal to run this development setup script before starting a node. Please let me know when I should be expected to run this file.

My feeling is that I have something configured wrong in my package descriptors (CMakeList, xml Manifest). But I want to know if this is expected.

Thank you, Jack

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-10-13 16:04:41 -0500

gvdhoorn gravatar image

updated 2018-10-13 16:05:09 -0500

No, you don't need to run the file, you need to source it.

See #q251292 for some more info on what that does.

My feeling is that I have something configured wrong in my package descriptors (CMakeList, xml Manifest).

No, I don't believe so.

edit flag offensive delete link more

Comments

So this means that every time you open a new terminal we must source this setup script if we want to access packages from that workspace?

jburns gravatar image jburns  ( 2018-10-13 17:49:49 -0500 )edit

That seems to be what is required. I understand the functionality of the script, but I was confused about is as a 'dependency'. Much appreciated!

jburns gravatar image jburns  ( 2018-10-13 17:52:08 -0500 )edit

re: always source: yes, that is a requirement. Otherwise the environment isn't setup and things won't work.

Many users have only a single workspace though and in those cases you could consider adding the source /path/to/your/catkin_ws/devel/setup.bash to your .bashrc (if you're using Bash).

gvdhoorn gravatar image gvdhoorn  ( 2018-10-14 01:13:08 -0500 )edit

Could you please mark the question as answered by ticking the checkmark (✓) to the left of the answer if you feel it has been answered? Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2018-10-14 01:13:17 -0500 )edit

Question Tools

Stats

Asked: 2018-10-13 16:02:18 -0500

Seen: 292 times

Last updated: Oct 13 '18