Skip to content

Commit

Permalink
Updated docs structure. Hardening of aliases and setup scripts (Stogl…
Browse files Browse the repository at this point in the history
…Robotics#11)

* Updated docs structure. Hardening of aliases and setup scripts

* Add updated files

* Update CI config

* Revert make page to work
  • Loading branch information
destogl authored Apr 7, 2021
1 parent 6a5076a commit 949648b
Show file tree
Hide file tree
Showing 29 changed files with 567 additions and 163 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/docs-sphinx-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ on:
branches:
- rolling
schedule:
# Run every morning to detect flakiness and broken dependencies
# Run every day to detect flakiness and broken dependencies
- cron: '23 5 * * *'

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ammaraskar/sphinx-action@master
- uses: ros-controls/control.ros.org-deployment-scripts@master
with:
docs-folder: 'docs/'
pre-build-command: "apt-get update -y && apt-get install -y python3-pip && pip3 install sphinx_rtd_theme"
install_extensions: false
3 changes: 2 additions & 1 deletion docs/use-cases/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Check the repository and PRs for other, undocumented use-cases.
:maxdepth: 1
:glob:

*
operating_system/*
ros_packages/*
ros2_control/*
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ Setup a new Workspace

This use-case describes how to setup a new ROS workspace using scripts from the ROS Team Workspace (RosTeamWS) framework.


Script for Creating Workspace
==============================

`setup-ros-workspace` accepts ros distro name workspace suffix and workspace folder as parameters.
All three parameters are optional.

Expand All @@ -18,6 +14,5 @@ All three parameters are optional.
setup-ros-workspace ROS_DISTRO WS_SUFFIX WS_FOLDER
The script creates...


The script creates in the ``$HOME/<WS_FOLDER>`` a new ROS workspace with name ``ros_ws_<ROS_DISTRO>_<WS_SUFFIX>``.
Default value for ``<WS_FOLDER>`` is "workspace".
4 changes: 2 additions & 2 deletions docs/use-cases/ros2_control/setup_controller.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=======================================================
ros2_control: Setup contorller package
ros2_control: Setup controller package
=======================================================
.. _uc-setup-ros2-contorller:
.. _uc-setup-ros2-controller:

This use-case describes how to set up a controller for the ros2_control framework using scripts from ROS Team Workspace (RosTeamWS) framework.

Expand Down
File renamed without changes.
File renamed without changes.
84 changes: 74 additions & 10 deletions scripts/_RosTeamWs_Defines.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ function RosTeamWS_script_own_dir {
echo "$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
}

# TODO(denis): add this into setup.bash
function RosTeamWS_setup_aliases {

# ROS
alias rosd="cd \$ROS_WS"
alias rosds="cd \$ROS_WS/src"
alias rosdb="cd \$ROS_WS/build"
}

function RosTeamWS_setup_ros1_exports {

export ROSCONSOLE_FORMAT='[${severity}] [${walltime}: ${logger}] [${node}@${file}.${function}:${line}]: ${message}'
Expand All @@ -27,6 +36,10 @@ export ROSCONSOLE_CONFIG_FILE='~/workspace/ros_ws/rosconsole.config'

function RosTeamWS_setup_ros1_aliases {

# ROS
alias rosdd="cd \$ROS_WS/devel"

# Catkin
alias cb="catkin build"

}
Expand All @@ -40,16 +53,21 @@ function RosTeamWS_setup_ros2_exports {

function RosTeamWS_setup_ros2_aliases {

# ROS
alias rosdi="cd \$ROS_WS/install"

# COLCON
alias cb="colcon_build"
alias cbr="colcon_build_release"
alias cbup="colcon build --symlink-install --packages-up-to"
alias cbup="colcon_build_up_to"

alias ct="colcon_test"
alias ctup="colcon test --packages-up-to"
alias ctup="colcon_test_up_to"

alias ctr="colcon test-result"
alias ctres="colcon_test_results"

alias ca="colcon_all"
alias caup="colcon_all_up_to"
}


Expand All @@ -59,18 +77,43 @@ function colcon_helper_ros2 {
print_and_exit "This should never happen. Check your helpers definitions!"
fi

cd $ROS_WS

CMD="$1"
if [ -z "$2" ]; then
$CMD
else
$CMD --packages-select $2
fi

cd -
}

function colcon_helper_ros2_up_to {
if [ -z "$1" ]; then
print_and_exit "This should never happen. Check your helpers definitions!"
fi

cd $ROS_WS

CMD="$1"
if [ -z "$2" ]; then
print_and_exit "You should provide package for this command!"
else
$CMD --packages-up-to $2
fi

cd -
}

function colcon_build {
colcon_helper_ros2 "colcon build --symlink-install" "$*"
}

function colcon_build_up_to {
colcon_helper_ros2_up_to "colcon build --symlink-install" "$*"
}

function colcon_build_release {
colcon_helper_ros2 "colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release" "$*"
}
Expand All @@ -79,10 +122,30 @@ function colcon_test {
colcon_helper_ros2 "colcon test" "$*"
}

function colcon_test_up_to {
colcon_helper_ros2_up_to "colcon test" "$*"
}

function colcon_test_results {
cd $ROS_WS
if [ -z "$1" ]; then
colcon test-result
else
colcon test-result | grep "$*"
fi
cd -
}

function colcon_all {
colcon_build "$*"
colcon_test "$*"
ctr
colcon_test_results "$*"
}

function colcon_all_up_to {
colcon_build_up_to "$*"
colcon_test_up_to "$*"
colcon_test_results "$*"
}

## END: Default Framework Definitions
Expand Down Expand Up @@ -162,12 +225,13 @@ function compile_and_source_package {
fi
bn=`basename "$PWD"`
path=$bn
while [[ "$bn" != "src" ]]; do
cd ..
bn=`basename "$PWD"`
path="$bn/$path"
done
cd ..
# while [[ "$bn" != "src" ]]; do
# cd ..
# bn=`basename "$PWD"`
# path="$bn/$path"
# done
# cd ..
cd $ROS_WS
colcon build --symlink-install --packages-up-to $pkg_name
source install/setup.bash
if [[ "$test" == "yes" ]]; then
Expand Down
10 changes: 6 additions & 4 deletions scripts/_Team_Defines.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ TEAM_LICENSE="Apache License 2.0"

TEAM_REPOSITORY_SERVER="https://github.com"

# TODO(denis): implement here support for internal repos
# TEAM_INTERNAL_ASSETS="/opt/RosTeamWS/assets/"
TEAM_PRIVATE_CONFIG_PATH=""

# Define a path to a repository with your internal assets and configurations
TEAM_INTERNAL_ASSETS="/opt/RosTeamWS/assets/"

## END: definitions

Expand All @@ -44,15 +46,15 @@ check_ros_distro $DEFAULT_ROS_DISTRO

# BEGIN: Define aliases for standard internal functions

alias setup_aliases=RosTeamWS_setup_aliases

alias setup_ros1_exports=RosTeamWS_setup_ros1_exports

alias setup_ros1_aliases=RosTeamWS_setup_ros1_aliases

alias setup_ros2_exports=RosTeamWS_setup_ros2_exports

alias setup_ros2_aliases=RosTeamWS_setup_ros2_aliases


# END: Define aliases for standard functions


Expand Down
31 changes: 23 additions & 8 deletions scripts/environment/setup.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
usage='setup.bash "ros_distro" "ros_ws_suffix" "workspace_folder"'

# Load Framework defines
# script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
# source $script_own_dir/../_RosTeamWs_Defines.bash
script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
source $script_own_dir/../_RosTeamWs_Defines.bash
source $script_own_dir/../_Team_Defines.bash

# ros distribution name will be set in $ros_distro
check_ros_distro $1
Expand All @@ -21,22 +22,34 @@ fi

unset CMAKE_PREFIX_PATH
unset ROS_PACKAGE_PATH
unset COLCON_WS
unset ROS_WS

if [[ $ros_version == 1 ]]; then

setup_aliases
setup_ros1_exports
setup_ros1_aliases

source ~/$ws_folder/ros_ws_$ros_distro$ws_suffix/devel/setup.bash
source `rospack find intelligent_robotic_automation`/scripts/environment/ros_setup.bash
WS_FOLDER="$HOME/$ws_folder/ros_ws_$ros_distro$ws_suffix"

if [ ! -d "$WS_FOLDER" ]; then
print_and_exit print_and_exit "'$WS_FOLDER_1' does not exist. Can not find ROS workspace!"
fi

export ROS_WS=$WS_FOLDER
source "$WS_FOLDER/devel/setup.bash"

echo ""
echo "RosTeamWS: Sourced file: $WS_FOLDER/devel/setup.bash"


elif [[ $ros_version == 2 ]]; then

setup_aliases
setup_ros2_exports
setup_ros2_aliases

/opt/rti.com/rti_connext_dds-5.3.1/setenv_ros2rti.bash
# /opt/rti.com/rti_connext_dds-5.3.1/setenv_ros2rti.bash
# export LANG=de_DE.UTF-8
WS_FOLDER=""
WS_FOLDER_1="$HOME/$ws_folder/ros_ws_$ros_distro$ws_suffix"
Expand All @@ -46,10 +59,12 @@ elif [[ $ros_version == 2 ]]; then
elif [ -d "$WS_FOLDER_2" ]; then
WS_FOLDER=$WS_FOLDER_2
else
print_and_exit "Neither '$WS_FOLDER_1' nor 'WS_FOLDER_2' exist. Can not find ROS workspace!"
print_and_exit "Neither '$WS_FOLDER_1' nor '$WS_FOLDER_2' exist. Can not find ROS workspace!"
fi

export COLCON_WS=$WS_FOLDER
export ROS_WS=$WS_FOLDER
# TODO: COLCON_WS is deprecated!!
export COLCON_WS=$ROS_WS
source "$WS_FOLDER/install/setup.bash"

echo ""
Expand Down
Loading

0 comments on commit 949648b

Please sign in to comment.