Skip to content

Instantly share code, notes, and snippets.

@OAkyildiz
Last active December 12, 2017 23:01
Show Gist options
  • Save OAkyildiz/43107f3a0d65d2a2b350b129a6d309ff to your computer and use it in GitHub Desktop.
Save OAkyildiz/43107f3a0d65d2a2b350b129a6d309ff to your computer and use it in GitHub Desktop.
Bash scripts to create ROS workspaces and packages using python-catkin-tools.
#!/bin/bash
# create signed packages using caktin_tools' create quickly
# set the env. variables below or modify acordingly
# if you are running a different ROS distro, modify that as well.
if [ -z "$EMAIL" ] || [ -z "$NAME" ] ; then
echo "Set NAME and EMAIL variables, or modify the script.
This script was writen to create signed, licensed packages quickly using
caktin_tools' create ."
exit 1
fi
PKG_NAME="$1"
if [ -z "$PKG_NAME" ]; then
echo "Please specify package name."
exit 1
fi
catkin create pkg -l MIT -a '$EMAIL' '$MYNAME' --rosdistro kinetic $PKG_NAME
#!/bin/bash
# Create a Catkin Workspace
# Usage make-ws.sh dirName, add to your path
# based on setupCatkinWorkspace.sh (https://github.com/jetsonhacks/installROSTX2/blob/master/setupCatkinWorkspace.sh)
# improved with catkin tools (https://catkin-tools.readthedocs.io/en/latest/#)
source /opt/ros/kinetic/setup.bash
DEFAULTDIR=~/ros_ws
WS_DIR="$1"
if [ ! -z "$WS_DIR" ]; then
DEFAULTDIR=~/"$WS_DIR"
fi
if [ -e "$DEFAULTDIR" ] ; then
echo "$DEFAULTDIR already exists; no action taken"
exit 1
else
echo "Creating Catkin Workspace: $DEFAULTDIR"
fi
echo "$DEFAULTDIR"/src
mkdir -p "$DEFAULTDIR"/src
#use catkin_tools if installed, else fall back to catkin
if apt -qq list python-catkin-tools 2>/dev/null | grep -q installed; then
cd "$DEFAULTDIR"
catkin init
catkin build
else
cd "$DEFAULTDIR"/src
catkin_init_workspace
cd "$DEFAULTDIR"
catkin_make
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment