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

can I place catkin_ws folder outside ~

asked 2021-01-28 11:07:16 -0600

felixN gravatar image

Hi, I'm deploying the same ros code on several robots. Each computer (one per robot) has its own name (in the forme baseNameN where N is the number of the robot). So far, I have been creating my catkin workspaces in my home directory (~), as suggested in the tutorials.

The problem is that I have a few absolute paths in my code that I'm having trouble to get rid of. So the easiest solution would be to have /catkin_ws instead of ~/catkin_ws as base directory (of course with read write and execute permission). That way, the username non longer appears in the absolute paths.

Can I do it? Will it cause any problems to have my catkin_ws folder at the root instead of in home?

Thanks a lot in advance

Felix

edit retag flag offensive close merge delete

Comments

Theoretically that should work but I haven't tried. You can get rid of this user thing in your code with USERNAME environment variable. The same thing ofcourse can workout in script as well for example python

import os

os.environ.get('USERNAME')

You can also check an answer here on Stackoverflow

Tahir M. gravatar image Tahir M.  ( 2021-01-28 12:40:22 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-01-28 23:19:03 -0600

You can place your packages anywhere in your system. It doesn't have to be in your home (~) directory. The right way to "share" your packages would be to get rid of hard-coded paths and use relative paths using rospack and rospkg.

This page will give you examples to get relative paths using both python and c++.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-01-28 11:07:16 -0600

Seen: 217 times

Last updated: Jan 28 '21