# Change directory in ROS for all users

Hello,

I am working with executable files that are to be included in the main node file. But the problem is I can define the path in my PC and open a text file with or execute the file but it is not universal with my other team members which are part of the team.

I have the following commands:

os.chdir( "/home/user/epsilon/epsilon_catkin_ws/src/knowledge_source/sense_manager/pddl_files/")

os.system("./ff -p /home/user/epsilon/epsilon_catkin_ws/src/knowledge_source/sense_manager/pddl_files/ -o domain.pddl -f problem.pddl >

solution_path = "/home/user/epsilon/epsilon_catkin_ws/src/knowledge_source/sense_manager/pddl_files/solution.txt" solution_detail.txt")

Since the path are unique with my laptop, it will require changes by everyone. IS there a way to make the path definition universal? (The commands are part of the node and not he launch file)

I tried the following pattern but it does not work:

os.chdir( "$(find knowledge_source)/sense_manager/pddl_files/") knowledge_source is the name of the package Any recommendations? edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted It's a bad idea to rely on changing the current directory. It won't even work properly in some languages because of multithreading. Instead, you should use rosrun or roslaunch to start your nodes. Those utilities will find the right location within your workspace so you don't have to hard-code paths. As well, if you need configuration files or output locations, those can be specified as node parameters. more ## Comments Thanks for the input. But I am using **rosrun** to start the node and need these commands mentioned in the question for successful service calls in that node. The node is inside the find_knowledge_source package but when i write **( "$(find knowledge_source)/sense_manager/pddl_files//solution.txt")** , it is not able to find the directory

( 2020-04-12 20:54:29 -0500 )edit