0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

trouble with roscd command when using colcon build on ROS1

Last updated at Posted at 2020-05-09

Though colcon isn't designed for ROS1 system, I'd like to jump to package location like roscd and build package like catkin tools.

Here is a temporary solution, please copy and paste that to .bashrc

COLCON_ROOT=/home/user/colcon_ws

function colconcd () {
    local prefix path str arr
    prefix=${1%/}
    if [ $prefix ]; then
        path=`roscd ${prefix} && pwd`
        str=`cat $path/cmake/${prefix}Config.cmake | grep src | xargs`
        arr=(${str// / })
        cd ${arr[1]%")"}
    else
        cd $COLCON_ROOT
    fi
}

function colcon-build () {
    local path
    path=`pwd`
    if [ $1 ]; then
        cd $COLCON_ROOT
        colcon build --packages-select ${1%/}
        cd $path
    else
        cd $COLCON_ROOT
        colcon $COLCON_ROOT/build
        cd $path
    fi
}

complete -F "_roscomplete_sub_dir" -o "nospace" "colconcd"
complete -F "_roscomplete_sub_dir" -o "nospace" "colcon-build"

colconcd command works like roscd and you can build specific package anywhere in work space with colcon-build.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?