Installing and Configuring Your ROS Environment


1.Managing Your Environment

  • f you are ever having problems finding or using your ROS packages make sure that you have your environment properly setup. A good way to check is to ensure that environment variables like ROS_ROOT and ROS_PACKAGE_PATH are set:
    $ printenv | grep ROS
    
  • If you just installed ROS from apt on Ubuntu then you will have setup.sh files in /opt/ros/<distro>/ and you could source them like so:
    $ source /opt/ros/<distro>/setup.bash
    
  • Using the short name of your ROS distribution instead of <distro>
  • If you installed ROS Kinetic, that would be:
    $ source /opt/ros/kinetic/setup.bash
    

2.Create a ROS Workspace

  1. Let's create a catkin workspace:
    $ mkdir -p ~/catkin_ws/src
    $ cd ~/catkin_ws/src
    $ catkin_init_workspace
    
  2. Even though the workspace is empty (there are no packages in the 'src' folder, just a single CMakeLists.txt link) you can still "build" the workspace:
    $ cd ~/catkin_ws/
    $ catkin_make
    
  3. The catkin_make command is a convenience tool for working with catkin workspaces. If you look in your current directory you should now have a 'build' and 'devel' folder. Inside the 'devel' folder you can see that there are now several setup.sh files. Sourcing any of these files will overlay this workspace on top of your environment. To understand more about this see the general catkin documentation: catkin. Before continuing source your new setup.sh file:
    $ source devel/setup.bash
    
  4. To make sure your workspace is properly overlayed by the setup script, make sure ROS_PACKAGE_PATH environment variable includes the directory you're in.
    $ echo $ROS_PACKAGE_PATH /home/youruser/catkin_ws/src:/opt/ros/kinetic/share:/opt/ros/kinetic/stacks
    

results matching ""

    No results matching ""