diff --git a/README.md b/README.md index 2fd84c6..a544a9c 100644 --- a/README.md +++ b/README.md @@ -3,53 +3,36 @@ The scripts here assume that you have an account on github (which is free at git You will need "git" installed on your machine to use these scripts. If "git" is not already installed on your machine, it can be installed with: -`sudo apt-get --yes --force-yes install git` +> `sudo apt-get --yes --force-yes install git` --- ### Getting the scripts and making them executable To run these scripts, clone learning_ros_setup_scripts anywhere on your computer by typing the following in any directory: -`git clone https://github.com/wsnewman/learning_ros_setup_scripts.git` +> `git clone https://github.com/wsnewman/learning_ros_setup_scripts.git` Once you have the files, change the directory to `learning_ros_setup_scripts` by typing: -`cd learning_ros_setup_scripts` +> `cd learning_ros_setup_scripts` After this, make the scripts executable by typing: -`chmod +x *.sh` +> `chmod +x *.sh` ### ROS Setup -For ROS Melodic use this line: (System needs to be 18.04) -`./install_ros_and_tools_melodic.sh` -(or `bash install_ros_and_tools_melodic.sh`) - -For other versions of install script, please refer to the respective folders for the install scripts. +Install ROS and other useful tools +> `./install_ros_and_tools.sh` +> +> or +> +> `bash install_ros_and_tools.sh` ### Workstation Setup -To setup your ROS workspace for ROS Melodic, use the `setup_workspace_learning_ros_melodic.sh` script. You will need to pass your +To setup your ROS workspace, use the `setup_workspace_learning_ros.sh` script. You will need to pass your github username and email as arguments to the script: -`./setup_workspace_learning_ros_melodic.sh github_username github@email.com` -(or `bash setup_workspace_learning_ros_melodic.sh github_username github@email.com`) +> `./setup_workspace_learning_ros.sh github_username github@email.com` +> +> or +> +> `bash setup_workspace_learning_ros.sh github_username github@email.com` + where github_username is your username on github, and github@email.com is your e-mail address associated with your github account. - -### Setting up STDR simulation for ROS Noetic - -First install qt4 and make it default -``` -sudo add-apt-repository ppa:rock-core/qt4 -sudo apt-get update -sudo apt-get install libqtcore4 qt4-qmake libqt4-dev -export QT_SELECT=4 -``` -make sure it is the active environment by running -```qtchooser -print-env``` -then install the map_server -```sudo apt install ros-noetic-map-server``` -Then clone and compile the stdr_simulator package -``` -cd ~/ros_ws/src -git clone https://github.com/stdr-simulator-ros-pkg/stdr_simulator.git -cd .. -rosdep install --from-paths src --ignore-src --rosdistro noetic -catkin_make -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4 -``` diff --git a/indigo/setup_workspace_learning_ros_indigo.sh b/indigo/setup_workspace_learning_ros_indigo.sh deleted file mode 100644 index 1deef83..0000000 --- a/indigo/setup_workspace_learning_ros_indigo.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# Learning ROS - Workspace setup script -# v 0.26 -# Wyatt Newman and Luc Bettaieb - -echo "Setting up workspace." - -USERNAME=$1 -EMAIL=$2 - -if [ "$USERNAME" != "" ] || [ "$EMAIL" != "" ]; -then - source /opt/ros/indigo/setup.bash - echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc - rosdep update - - mkdir -p ~/ros_ws/src - - cd ~/ros_ws/src && catkin_init_workspace - cd ~/ros_ws && catkin_make - - git config --global user.name "$USERNAME" - git config --global user.email "$EMAIL" - - cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_external_packages.git - cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros.git - - # Cloning STDR is only necessary because of a bug in the current ROS binary release - # This prevents spawning a new robot on the screen. See this bug report for more information: - # https://github.com/stdr-simulator-ros-pkg/stdr_simulator/issues/195 - - cd ~/ros_ws/src && git clone https://github.com/stdr-simulator-ros-pkg/stdr_simulator.git - - cd ~/ros_ws && catkin_make - cd ~/ros_ws && catkin_make install - - echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc - echo "alias cs_create_pkg='~/ros_ws/src/learning_ros_external_packages/cs_create_pkg.py'" >> ~/.bashrc - echo "export ROS_WORKSPACE='$HOME/ros_ws'" >> ~/.bashrc - - source ~/.bashrc - -else - echo "USAGE: ./setup_workspace_learning_ros your_github_username your_email@email.com" - -fi - -echo "[!!!] NB: You must still manually add your ROS_IP to your ~/.bashrc. Do this by checking your IP with hostname -I or ifconfig and then adding export ROS_IP='x.x.x.x' to your ~/.bashrc." diff --git a/install_ros_and_tools.sh b/install_ros_and_tools.sh new file mode 100755 index 0000000..3e6956d --- /dev/null +++ b/install_ros_and_tools.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Figure out what Ubuntu this is to get the correct ROS +source /etc/os-release + +if [[ $ID != "ubuntu" ]]; then + echo "This script only works for Ubuntu." + exit +elif [[ -z $UBUNTU_CODENAME ]]; then + echo "It appears that there is an problem identifying which Ubuntu this is." + exit +elif [[ $UBUNTU_CODENAME == "focal" ]]; then + ROS_VERS="noetic" +elif [[ $UBUNTU_CODENAME == "bionic" ]]; then + ROS_VERS="melodic" +elif [[ $UBUNTU_CODENAME == "xenial" ]]; then + ROS_VERS="kinetic" +elif [[ $UBUNTU_CODENAME == "trusty" ]]; then + ROS_VERS="indigo" +else + echo "$PRETTY_NAME is currently unsupported" + exit +fi + +scripts/install_ros_and_tools_$ROS_VERS.sh $@ + +source /opt/ros/$ver/setup.bash +echo "source /opt/ros/$ver/setup.bash" >> ~/.bashrc +rosdep update + +mkdir -p $CONFIG_WS/src +cd $CONFIG_WS/src + +# Get Baxter and STDR repositories +if [[ $ROS_VERS == "noetic" ]]; then + git clone -b noetic_devel https://github.com/cwru-eecs-275/stdr_simulator.git + git clone -b noetic_devel https://github.com/cwru-eecs-275/baxter_simulator.git + git clone -b noetic_devel https://github.com/cwru-eecs-275/baxter_interface.git + git clone -b noetic_devel https://github.com/cwru-eecs-275/baxter_tools.git +elif [[$ROS_VERS == 'melodic' ]]; then + git clone -b melodic_devel https://github.com/cwru-eecs-275/stdr_simulator.git + git clone https://github.com/EmaroLab/baxter_simulator.git + git clone https://github.com/cwru-eecs-275/baxter_interface.git + git clone https://github.com/cwru-eecs-275/baxter_tools.git +else + sudo apt-get install -y ros-$ver-stdr-simulator + git clone https://github.com/RethinkRobotics/baxter_simulator.git + git clone https://github.com/RethinkRobotics/baxter_interface.git + git clone https://github.com/RethinkRobotics/baxter_tools.git +fi +git clone https://github.com/RethinkRobotics/baxter_common.git + + +# Ensure that all dependencies are installed (at least the declared ones). +rosdep install --from-paths src --ignore-src -r -y + +cd $CONFIG_WS +catkin_make +sudo -- /bin/bash -c "source /opt/ros/$ver/setup.bash; catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/$ver install" >/dev/null diff --git a/kinetic/setup_workspace_learning_ros_kinetic.sh b/kinetic/setup_workspace_learning_ros_kinetic.sh deleted file mode 100644 index 0176c1a..0000000 --- a/kinetic/setup_workspace_learning_ros_kinetic.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Learning ROS - Workspace setup script -# v 0.26 -# Wyatt Newman and Luc Bettaieb - -echo "Setting up workspace." - -USERNAME=$1 -EMAIL=$2 - -if [ "$USERNAME" != "" ] || [ "$EMAIL" != "" ]; -then - source /opt/ros/kinetic/setup.bash - echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc - rosdep update - - mkdir -p ~/ros_ws/src - - cd ~/ros_ws/src && catkin_init_workspace - cd ~/ros_ws && catkin_make - - git config --global user.name "$USERNAME" - git config --global user.email "$EMAIL" -#https://github.com/wsnewman/learning_ros_kinetic.git -#https://github.com/wsnewman/learning_ros_external_packages_kinetic.git - cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_kinetic.git - cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_external_pkgs_kinetic.git - - # Cloning STDR is only necessary because of a bug in the current ROS binary release - # This prevents spawning a new robot on the screen. See this bug report for more information: - # https://github.com/stdr-simulator-ros-pkg/stdr_simulator/issues/195 - - # cd ~/ros_ws/src && git clone https://github.com/stdr-simulator-ros-pkg/stdr_simulator.git - - echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc - source ~/.bashrc - - cd ~/ros_ws && catkin_make - cd ~/ros_ws && catkin_make install - - - echo "alias cs_create_pkg='~/ros_ws/src/learning_ros_external_pkgs_kinetic/cs_create_pkg.py'" >> ~/.bashrc - echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc - echo "export ROS_WORKSPACE='$HOME/ros_ws'" >> ~/.bashrc - # echo "export ROS_IP=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'`" >> ~/.bashrc - - - -else - echo "USAGE: ./setup_workspace_learning_ros your_github_username your_email@email.com" - -fi - -echo "[!!!] NB: You must still manually add your ROS_IP to your ~/.bashrc. Do this by checking your IP with hostname -I or ifconfig and then adding export ROS_IP='x.x.x.x' to your ~/.bashrc." diff --git a/melodic/setup_workspace_learning_ros_melodic.sh b/melodic/setup_workspace_learning_ros_melodic.sh deleted file mode 100644 index 483a2a8..0000000 --- a/melodic/setup_workspace_learning_ros_melodic.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# Learning ROS - Workspace setup script -# v 0.40 -# Wyatt Newman and Luc Bettaieb -# Updated by Frank (Chude Qian) - -echo "Setting up workspace." - -USERNAME=$1 -EMAIL=$2 - -if [ "$USERNAME" != "" ] || [ "$EMAIL" != "" ]; -then - source /opt/ros/melodic/setup.bash - echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc - rosdep update - - mkdir -p ~/ros_ws/src - - cd ~/ros_ws/src && catkin_init_workspace - cd ~/ros_ws && catkin_make - - git config --global user.name "$USERNAME" - git config --global user.email "$EMAIL" - - #https://github.com/wsnewman/learning_ros_kinetic.git - #https://github.com/wsnewman/learning_ros_external_packages_kinetic.git - #cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_kinetic.git - #cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_external_pkgs_kinetic.git - - # Cloning STDR is only necessary because of a bug in the current ROS binary release - # This prevents spawning a new robot on the screen. See this bug report for more information: - # https://github.com/stdr-simulator-ros-pkg/stdr_simulator/issues/195 - - # cd ~/ros_ws/src && git clone https://github.com/stdr-simulator-ros-pkg/stdr_simulator.git - - echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc - source ~/.bashrc - - cd ~/ros_ws && catkin_make - cd ~/ros_ws && catkin_make install - - - echo "alias cs_create_pkg='~/ros_ws/src/learning_ros_external_pkgs_kinetic/cs_create_pkg.py'" >> ~/.bashrc - echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc - echo "export ROS_WORKSPACE='$HOME/ros_ws'" >> ~/.bashrc - # echo "export ROS_IP=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'`" >> ~/.bashrc - - - -else - echo "USAGE: ./setup_workspace_learning_ros your_github_username your_email@email.com" - -fi - -echo "[!!!] NB: You must still manually add your ROS_IP to your ~/.bashrc. Do this by checking your IP with hostname -I or ifconfig and then adding export ROS_IP='x.x.x.x' to your ~/.bashrc." diff --git a/rosdep.sh b/rosdep.sh deleted file mode 100644 index 95f49f2..0000000 --- a/rosdep.sh +++ /dev/null @@ -1 +0,0 @@ -# broken: ros-noetic-controller-manager-tests diff --git a/indigo/install_ros_and_tools_indigo.sh b/scripts/install_ros_and_tools_indigo.sh old mode 100644 new mode 100755 similarity index 100% rename from indigo/install_ros_and_tools_indigo.sh rename to scripts/install_ros_and_tools_indigo.sh diff --git a/kinetic/install_ros_and_tools_kinetic.sh b/scripts/install_ros_and_tools_kinetic.sh old mode 100644 new mode 100755 similarity index 100% rename from kinetic/install_ros_and_tools_kinetic.sh rename to scripts/install_ros_and_tools_kinetic.sh diff --git a/melodic/install_ros_and_tools_melodic.sh b/scripts/install_ros_and_tools_melodic.sh old mode 100644 new mode 100755 similarity index 100% rename from melodic/install_ros_and_tools_melodic.sh rename to scripts/install_ros_and_tools_melodic.sh diff --git a/install_ros_and_tools_noetic.sh b/scripts/install_ros_and_tools_noetic.sh similarity index 100% rename from install_ros_and_tools_noetic.sh rename to scripts/install_ros_and_tools_noetic.sh diff --git a/setup_workspace_learning_ros.sh b/setup_workspace_learning_ros.sh new file mode 100755 index 0000000..25a19de --- /dev/null +++ b/setup_workspace_learning_ros.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +# Learning ROS - Workspace setup script +# v 0.50 +# Wyatt Newman and Luc Bettaieb +# Updated by Frank (Chude Qian) +# Updated by Greg Lee + +function main(){ + ros_config + + echo "Setting up workspace." + + USERNAME=$1 + EMAIL=$2 + + ROS_WS="~/ros_ws" + + if [ "$USERNAME" != "" ] || [ "$EMAIL" != "" ]; + then + # Setup up GIT globally for the user + git config --global user.name "$USERNAME" + git config --global user.email "$EMAIL" + + source /opt/ros/$ver/setup.bash + echo "source /opt/ros/$ver/setup.bash" >> ~/.bashrc + rosdep update + + mkdir -p $ROS_WS/src + cd $ROS_WS/src + + # Get Learning ROS repositories + if [[ $ROS_VERS == "noetic" ]]; then + git clone -b noetic_devel https://github.com/wsnewman/learning_ros.git + elif [[$ROS_VERS == 'melodic' ]]; then + git clone -b melodic_devel https://github.com/wsnewman/learning_ros.git + else + git clone -melodic_devel https://github.com/wsnewman/learning_ros.git + fi + + git clone https://github.com/wsnewman/learning_ros_external_packages.git + + # Ensure that all dependencies are installed (at least the declared ones). + rosdep install --from-paths src --ignore-src -r -y + + cd $ROS_WS + catkin_make + + # Make cs_create_pkg work always + mkdir ~/bin + cp $ROS_WS/src/learning_ros_external_packages/cs_create_pkg.py ~/bin + echo "alias cs_create_pkg='~/bin/cs_create_pkg.py'" >> ~/.bashrc + # This is only used in two places in the Learning ROS packages and that code can be updated to ros::getPath(). + echo "export ROS_WORKSPACE='$ROS_WS'" >> ~/.bashrc + + else + echo "USAGE: ./setup_workspace_learning_ros your_github_username your_email@email.com" + + fi + + echo "[!!!] NB: You must still manually add your ROS_IP to your ~/.bashrc. Do this by checking your IP with hostname -I or ifconfig and then adding export ROS_IP='x.x.x.x' to your ~/.bashrc." +} + +function ros_config() { + # Setup ROS + if [ ${#ROS_PACKAGE_PATH} -lt 1 ]; then + ROS_VERS=($(ls /opt/ros)) + if [ ${#ROS_VERS[@]} -gt 1 ] + then + # Should remove unsupported versions from the choice + select ver in ${ROS_VERS[@]}; do break; done + source /opt/ros/$ver/setup.bash + elif [ ${#ROS_VERS[@]} -eq 0 ] + then + if [ -d /opt/ros ] + then + echo "The ROS installation is corrupted." + else + echo "ROS has not been installed." + fi + exit + else + ver=$ROS_VERS + source /opt/ros/$ver/setup.bash + fi + + if [ ${#ROS_PACKAGE_PATH} -lt 1 ] + then + echo "ROS $ver appears misconfigured. It may not be installed or there may be another issue." + exit + fi + else + ver=$ROS_DISTRO + fi +} + + +main \ No newline at end of file diff --git a/setup_workspace_learning_ros_noetic.sh b/setup_workspace_learning_ros_noetic.sh deleted file mode 100644 index d93a186..0000000 --- a/setup_workspace_learning_ros_noetic.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Learning ROS - Workspace setup script -# v 0.40 -# Wyatt Newman and Luc Bettaieb -# Updated by Frank (Chude Qian) - -echo "Setting up workspace." - -USERNAME=$1 -EMAIL=$2 - -if [ "$USERNAME" != "" ] || [ "$EMAIL" != "" ]; -then - source /opt/ros/noetic/setup.bash -# echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc - rosdep update - - ROS_BASE=~/ros/noetic/ros_ws - mkdir -p $ROS_BASE/src - - cd $ROS_BASE/src && catkin_init_workspace - cd $ROS_BASE && catkin_make - - git config --global user.name "$USERNAME" - git config --global user.email "$EMAIL" - - # Cloning STDR is necessary for noetic and bug in the current ROS binary release - # https://github.com/stdr-simulator-ros-pkg/stdr_simulator/issues/195 - - cd $ROS_BASE/src - git clone https://github.com/rojas70/stdr_simulator.git - - # Change to the noetic-devel branch - git checkout noetic-devel - - echo "source ~/ros/noetic/ros_ws/devel/setup.bash" >> ~/.bashrc - source ~/.bashrc - - cd ~/$ROS_BASE && catkin_make - cd ~/$ROS_BASE && catkin_make install - - - echo "alias cs_create_pkg='~/ros/noetic/ros_ws/src/learning_ros_external_pkgs_noetic/cs_create_pkg.py'" >> ~/.bashrc - echo "source ~/ros_ws/devel/setup.bash" >> ~/.bashrc - echo "export ROS_WORKSPACE='$HOME/ros_ws'" >> ~/.bashrc - # echo "export ROS_IP=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'`" >> ~/.bashrc - -else - echo "USAGE: ./setup_workspace_learning_ros your_github_username your_email@email.com" - -fi - -#echo "[!!!] NB: You must still manually add your ROS_IP to your ~/.bashrc. Do this by checking your IP with hostname -I or ifconfig and then adding export ROS_IP='x.x.x.x' to your ~/.bashrc."