19.2.7. Update Catkin Workspace

If you want to update already existing packages in the /ros_catkin_ws, you have to update the .rosinstall file and merge it with your current workspace with wstool.

Attention

We assume here that you haven’t added any new ROS packages by following the Install ROS Packages guide. If you have, these won’t be updated by following these steps.

  1. Change directory

    cd ~/ros_catkin_ws
    
  2. Update your .rosinstall file

    • First, move your existing rosinstall file (assuming noetic-ros_comm-perception-wet.rosinstall) so that it doesn’t get overwritten:

      mv -i noetic-ros_comm-perception-wet.rosinstall noetic-ros_comm-perception-wet.rosinstall.old
      
    • Generate new rosinstall file with same, but updated packages:

      rosinstall_generator ros_comm perception --rosdistro noetic --deps --wet-only --tar > noetic-ros_comm-perception-wet.rosinstall
      
    • You can compare the new rosinstall file to the old version to see which packages will be updated:

      diff -u noetic-ros_comm-perception-wet.rosinstall noetic-ros_comm-perception-wet.rosinstall.old
      
  3. Merge

    wstool merge -t src noetic-ros_comm-perception-wet.rosinstall
    
  4. Update

    wstool update -t src
    
  5. Build

    sudo catkin build --cmake-args -DCMAKE_BUILD_TYPE=Release