Skip to content

Commit

Permalink
Adding quick-start tutorials and making simple starting better. (Stog…
Browse files Browse the repository at this point in the history
  • Loading branch information
destogl authored Aug 6, 2022
1 parent 7487f53 commit f8b8714
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 41 deletions.
35 changes: 0 additions & 35 deletions docs/getting_started/index.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The opinions and proposals stated here are merely related to the authors' experi
.. toctree::
:hidden:

getting_started/index.rst
tutorials/index.rst
guidelines/index.rst
use-cases/index.rst
docker/index.rst
Expand Down
12 changes: 12 additions & 0 deletions docs/tutorials/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
===========
Tutorials
===========

These tutorials will quickly get you using the ROS Team Workspace.

.. toctree::
:maxdepth: 2
:numbered:

quick-start.rst
setting_up_rtw.rst
80 changes: 80 additions & 0 deletions docs/tutorials/quick-start.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
==================================
Quick start with RosTeamWorkspace
==================================
.. _tutorial-quick-start:

This tutorial show use of RosTeamWorkspace for very common use-cases that can be done without permanent changes to your environment.
First you have to clone and source the workspace and then continue with the use-case you are interested in:

.. toctree::
:maxdepth: 1


Clone and source the RosTeamWorkspace
---------------------------------------
.. code-block:: bash
git clone https://github.com/StoglRobotics/ros_team_workspace.git
source ros_team_workspace/setup.bash
Create new package in an existing workspace
--------------------------------------------------------
For more details check :ref:`use-case description <uc-new-package>`.

.. code-block:: bash
source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>
create-new-package <my_new_package_name> "Some cool description of the package." # follow the instructions
cd .. && colcon build --symlink-install # to compile your newly created package
Create robot description package
-------------------------------------------------
For more details check :ref:`use-case description <uc-setup-robot-description>`.

.. code-block:: bash
source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<package_name>
setup-robot-description <my_cool_robot_name> <package_name>
Create robot bringup package
-----------------------------------------------
For more details check :ref:`use-case description <uc-setup-robot-bringup>`.

.. code-block:: bash
source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<package_name>
setup-robot-bringup <my_cool_robot_name> <package_name>
Setup ros2_control control hardware
-------------------------------------------------
For more details check :ref:`use-case description <uc-setup-ros2-control-hardware>`.

.. code-block:: bash
source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<package_name>
ros2_control_setup-hardware-interface-package <control_hardware_file_name>
Setup ros2_control controller
-----------------------------------------------
For more details check :ref:`use-case description <uc-setup-ros2-controller>`.

.. code-block:: bash
source <path to your ROS workspace>/install/setup.bash
cd <src folder of your ROS workspace>/<package_name>
ros2_control_setup-controller-package <controller_file_name>
47 changes: 47 additions & 0 deletions docs/tutorials/setting_up_rtw.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
============================
Setting up RosTeamWorkspace
============================
.. _tutorial-setting-up-rtw:

To start using RosTeamWS framework clone the repository to any location using:

.. code-block:: bash
git clone https://github.com/StoglRobotics/ros_team_workspace.git
Source the ``setup.bash``` in the top folder of RosTeamWorkspace:

.. code-block:: bash
source ros_team_workspace/setup.bash
Execute the following to configure the RosTeamWorkspace permanently.

**ATTENTION**: The following will work only if RosTeamWorkspace is checked out in ``/opt/RosTeamWS/ros_ws_rolling/src/`` folder! We are working on fixing this. The progress can se followed in `this issue <https://github.com/StoglRobotics/ros_team_workspace/issues/51>`_.

Add auto-sourcing of configuration to your ``.bashrc`` file by adding following lines to its end using your favorite text editor (e.g., ``vim`` or ``nano``):

.. code-block:: bash
if [ -f ~/.ros_team_ws_rc ]; then
. ~/.ros_team_ws_rc
fi
Copy ``templates/.ros_team_ws_rc`` file to your home folder using

.. code-block:: bash
cp ros_team_workspace/templates/.ros_team_ws_rc ~/
and adjust the following values using your favorite text editor:

- ``<PATH TO ros_team_workspace>`` - with a path to the framework folder

Now you are ready to

- :ref:`setup your first workspace <uc-setup-workspace>`
- :ref:`quick-start <tutorial-quick-start>`
- or :ref:`other use-cases <uc-index>`.
2 changes: 1 addition & 1 deletion scripts/setup-robot-bringup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ read -p "If correct press <ENTER>, otherwise <CTRL>+C and start the script again
RM_FOLDERS=("include" "src")

for FOLDER in "${RM_FOLDERS[@]}"; do
if [ -d $FOLDER && ! "$(ls -A $FOLDER )" ]; then
if [[ -d $FOLDER && ! "$(ls -A $FOLDER )" ]]; then
rm -r $FOLDER
fi
done
Expand Down
5 changes: 3 additions & 2 deletions setup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ setup_script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pw
# Load RosTeamWS defines
source $setup_script_own_dir/scripts/_RosTeamWs_Defines.bash

# Set default paths
framework_default_paths $DEFAULT_ROS_DISTRO

# Load Team defines
source $setup_script_own_dir/scripts/_Team_Defines.bash

Expand All @@ -11,5 +14,3 @@ source $setup_script_own_dir/scripts/_RosTeamWs_Docker_Defines.bash

# Set main path where source.bash is defined
RosTeamWS_FRAMEWORK_MAIN_PATH="$(RosTeamWS_script_own_dir)/../"

framework_default_paths $DEFAULT_ROS_DISTRO
81 changes: 79 additions & 2 deletions templates/.ros_team_ws_rc
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,95 @@ TEAM_REPOSITORY_SERVER="https://github.com"

TEAM_PRIVATE_CONFIG_PATH=""

source <Path to ros_team_workspace>/setup.bash
source <PATH TO ros_team_workspace>/setup.bash

# User specific setup / variables

#export CYCLONEDDS_URI='<CycloneDDS><Domain><General><NetworkInterfaceAddress>ADD_HERE_INTERFACE_NAME</NetworkInterfaceAddress></General></Domain></CycloneDDS>'

export ROS_DOMAIN_ID=46 # Set your Domain ID if you are in a network with multiple computers
export ROS_DOMAIN_ID=ID # Set your Domain ID if you are in a network with multiple computers

# Logging setup
# export RCUTILS_LOGGING_CONFIG_FILE="/home/deniss/workspace/ros2_logging_config"
#export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})" # Custom logging format
export RCUTILS_COLORIZED_OUTPUT=1
#export RCUTILS_LOGGING_USE_STDOUT=1 # force all logging output to stdout


# BEGIN: Stogl Robotics custom setup for nice colors and showing ROS workspace

# Check this out: https://www.shellhacks.com/bash-colors/
export TERMINAL_COLOR_NC='\e[0m' # No Color
export TERMINAL_COLOR_BLACK='\e[0;30m'
export TERMINAL_COLOR_GRAY='\e[1;30m'
export TERMINAL_COLOR_RED='\e[0;31m'
export TERMINAL_COLOR_LIGHT_RED='\e[1;31m'
export TERMINAL_COLOR_GREEN='\e[0;32m'
export TERMINAL_COLOR_LIGHT_GREEN='\e[1;32m'
export TERMINAL_COLOR_BROWN='\e[0;33m'
export TERMINAL_COLOR_YELLOW='\e[1;33m'
export TERMINAL_COLOR_BLUE='\e[0;34m'
export TERMINAL_COLOR_LIGHT_BLUE='\e[1;34m'
export TERMINAL_COLOR_PURPLE='\e[0;35m'
export TERMINAL_COLOR_LIGHT_PURPLE='\e[1;35m'
export TERMINAL_COLOR_CYAN='\e[0;36m'
export TERMINAL_COLOR_LIGHT_CYAN='\e[1;36m'
export TERMINAL_COLOR_LIGHT_GRAY='\e[0;37m'
export TERMINAL_COLOR_WHITE='\e[1;37m'

export TERMINAL_BG_COLOR_BLACK='\e[40m'
export TERMINAL_BG_COLOR_GRAY='\e[1;40m'
export TERMINAL_BG_COLOR_RED='\e[41m'
export TERMINAL_BG_COLOR_LIGHT_RED='\e[1;41m'
export TERMINAL_BG_COLOR_GREEN='\e[42m'
export TERMINAL_BG_COLOR_LIGHT_GREEN='\e[1;42m'
export TERMINAL_BG_COLOR_BROWN='\e[43m'
export TERMINAL_BG_COLOR_YELLOW='\e[1;43m'
export TERMINAL_BG_COLOR_BLUE='\e[44m'
export TERMINAL_BG_COLOR_LIGHT_BLUE='\e[1;44m'
export TERMINAL_BG_COLOR_PURPLE='\e[45m'
export TERMINAL_BG_COLOR_LIGHT_PURPLE='\e[1;45m'
export TERMINAL_BG_COLOR_CYAN='\e[46m'
export TERMINAL_BG_COLOR_LIGHT_CYAN='\e[1;46m'
export TERMINAL_BG_COLOR_LIGHT_GRAY='\e[47m'
export TERMINAL_BG_COLOR_WHITE='\e[1;47m'

if [ -n "$SSH_CLIENT" ]; then text="-ssh-session"
fi

function parse_vc_branch_and_add_brackets {
gitbranch=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`

if [[ "$gitbranch" != '' ]]; then
echo "<${gitbranch}"
# else
# echo "<no-git-branch"
fi
}

function set_ros_workspace_color {
if [[ -n ${ROS_WS} ]]; then

if [[ $PWD == *"${ROS_WS}"* ]]; then
color=${TERMINAL_COLOR_CYAN}
else
color=${TERMINAL_BG_COLOR_RED}
fi

echo -e "${color}"
fi
}

function parse_ros_workspace {
if [[ -n ${ROS_WS} ]]; then

echo "[${ROS_WS##*/}]"
fi
}

export PS1="\[${TERMINAL_COLOR_LIGHT_GRAY}\]"'[\t]\['"\[${TERMINAL_COLOR_LIGHT_GREEN}\]"'\u\['"\[${TERMINAL_COLOR_LIGHT_GRAY}\]"'@\['"\[${TERMINAL_COLOR_BROWN}\]"'\h\['"\[${TERMINAL_COLOR_YELLOW}\]"'${text}\['"\[${TERMINAL_COLOR_LIGHT_GRAY}\]"':'"\["'$(set_ros_workspace_color)'"\]"'$(parse_ros_workspace)\['"\[${TERMINAL_COLOR_GREEN}\]"'$(parse_vc_branch_and_add_brackets)>\['"\[${TERMINAL_COLOR_LIGHT_PURPLE}\]"'\W\['"\[${TERMINAL_COLOR_LIGHT_PURPLE}\]"'$\['"\[${TERMINAL_COLOR_NC}\]"'\[\e[m\] '

# END: Stogl Robotics custom setup for nice colors and showing ROS workspace


# WORKSPACES

0 comments on commit f8b8714

Please sign in to comment.