What exactly does setup.bash do?

asked 2020-09-14 11:21:25 -0500

byteofprash gravatar image

updated 2020-09-16 05:01:54 -0500

I understand the setup.bash file calls the setup.sh which inturn sets the environmental variables.

But I think it does more than that. Because when I check the printenv and see all the environmental variable that are setup after sourcing the setup.bash, I tried setting these variables manually. But I am not still not able to locate the packages after this. But however after sourcing the setup.sh I can locate the packages. Is there a way to replicate the behaviour of the setup.sh file?

EDIT:

My problem:

  • I have a docker container with ROS and cartographer installed in it. When I source the setup.bash I can find all the packages installed such cartographer_ros and hence I can do a roslaunch with my launch file.
  • I change the parameters of a lua file (which is read by the launch file) to run cartographer with different parameters.
  • The changed parameters are reflected only when I source my setup.bash of my workspace again.

My Question:

  • Why is that I have to source the setup.bash again? Despite all the environment vars being set

  • As I am launching my cartographer instance through a webapp, I have to source the setup.bash from my python app. How do I achieve that?

Sorry if I've had multiple questions into a single entry.

Thanks.

edit retag flag offensive close merge delete

Comments

@byteofprash can I ask you what do you want exactly? Is just information or you want this information to do something. So to avoid an xy problem can you be more precisse on what you want to do? Thanks.

Weasfas gravatar image Weasfas  ( 2020-09-16 04:50:46 -0500 )edit

@Weasfas Thanks for the comment. I've edited my question to further elaborate on my problem. Thanks

byteofprash gravatar image byteofprash  ( 2020-09-16 05:02:37 -0500 )edit

Well I am not an expert on ROS infraestructure but for the first question I would say that you have to source every time you perform a change to reflect those changes on the whole environment. To answer the second question I would say jut simply, by code, or by adding to the start of the App a call to the script. It is really like executing a script from code. Maybe this and this posts are relatable and useful.

Weasfas gravatar image Weasfas  ( 2020-09-17 04:33:19 -0500 )edit