Skip to content

Commit

Permalink
Merge pull request #376 from reidchristopher/march2022_training_updates
Browse files Browse the repository at this point in the history
March2022 training updates
  • Loading branch information
jdlangs committed Jun 27, 2022
2 parents e3cbc89 + fb70de1 commit f77e952
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repositories:
version: master
Universal_Robots_ROS2_Driver:
type: git
url: https://github.com/jrgnicho/Universal_Robots_ROS2_Driver.git
version: feature-allow-using-init-positions-file
url: https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver.git
version: foxy
ur_msgs:
type: git
url: https://github.com/destogl/ur_msgs.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repositories:
version: master
Universal_Robots_ROS2_Driver:
type: git
url: https://github.com/jrgnicho/Universal_Robots_ROS2_Driver.git
version: feature-allow-using-init-positions-file
url: https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver.git
version: foxy
ur_msgs:
type: git
url: https://github.com/destogl/ur_msgs.git
Expand Down
15 changes: 12 additions & 3 deletions gh_pages/_downloads/ros-industrial-training-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ rosdep update
# Install Qt Creator with ROS plugin
# NOTE: no way (yet?) to do headless QT IFW install. Do this last, but will require user action
if [[ $DISPLAY && ! -d ~/QtCreator ]]; then
QTFILE=qtcreator-ros-bionic-latest-online-installer.run
wget -q https://qtcreator-ros.datasys.swri.edu/downloads/installers/bionic/$QTFILE
QTFILE=qtcreator-ros-bionic-latest-offline-installer.run
wget -q --no-check-certificate https://qtcreator-ros.datasys.swri.edu/downloads/installers/bionic/$QTFILE
chmod u+x $QTFILE
./$QTFILE
rm $QTFILE
Expand All @@ -54,8 +54,17 @@ fi
gsettings set org.gnome.desktop.session idle-delay 0

if [ $IS_AWS -eq 1 ]; then
# setup firefox shortcuts
xdg-icon-resource install --novendor --context apps --size 256 ~/industrial_training/gh_pages/_downloads/web_shortcuts/ros-i.png
xdg-icon-resource install --novendor --context apps --size 128 ~/industrial_training/gh_pages/_downloads/web_shortcuts/rosorg.png
xdg-icon-resource install --novendor --context apps --size 128 ~/industrial_training/gh_pages/_downloads/web_shortcuts/ros2.png

sudo desktop-file-install ~/industrial_training/gh_pages/_downloads/web_shortcuts/ros-i.desktop
sudo desktop-file-install ~/industrial_training/gh_pages/_downloads/web_shortcuts/rosorg.desktop
sudo desktop-file-install ~/industrial_training/gh_pages/_downloads/web_shortcuts/ros2.desktop

sudo apt install -y gnome-terminal gedit
gsettings set org.gnome.shell favorite-apps "['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.gedit.desktop']"
gsettings set org.gnome.shell favorite-apps "['firefox.desktop', 'ros-i.desktop', 'ros2.desktop', 'rosorg.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.gedit.desktop', 'QtProject-qtcreator-ros-latest.desktop']"
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"

# replace PS1 prompt var with "ROS Distro" prompt
Expand Down
8 changes: 8 additions & 0 deletions gh_pages/_downloads/web_shortcuts/ros-i.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Version=1.0
Name=ROS Industrial Training
Exec=firefox https://industrial-training-master.readthedocs.io/en/foxy/
Icon=ros-i
Terminal=false
Type=Application
Categories=Network;WebBrowser;
Binary file added gh_pages/_downloads/web_shortcuts/ros-i.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions gh_pages/_downloads/web_shortcuts/ros2.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Version=1.0
Name=ROS 2 Documentation
Exec=firefox http://docs.ros.org/en/foxy/index.html
Icon=ros2
Terminal=false
Type=Application
Categories=Network;WebBrowser;
Binary file added gh_pages/_downloads/web_shortcuts/ros2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions gh_pages/_downloads/web_shortcuts/rosorg.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Version=1.0
Name=ROS.org
Exec=firefox https://ros.org
Icon=rosorg
Terminal=false
Type=Application
Categories=Network;WebBrowser;
Binary file added gh_pages/_downloads/web_shortcuts/rosorg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions gh_pages/_source/prerequisites/The-Linux-Terminal.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

1. The window will have a single line, which looks like this:

`ros-industrial@ros-i-melodic-vm:~$`
`ros-industrial@ros-i-foxy-vm:~$`

1. This is called the prompt, where you enter commands. The prompt, by default, provides three pieces of information:

1. _ros-industrial_ is the login name of the user you are running as.
1. _ros-i-melodic-vm_ is the host name of the computer.
1. _ros-i-foxy-vm_ is the host name of the computer.
1. ~ is the directory in which the terminal is currently in. (More on this later).

1. Close the terminal window by typing `exit` or clicking on the red 'x' in the window's titlebar.
Expand Down Expand Up @@ -64,7 +64,7 @@
1. Enter `pwd` into the terminal.
* This will show you the full path of the directory you are working in.
1. Enter `cd new` into the terminal.
* The prompt should change to `ros-industrial@ros-i-melodic-vm:~/ex0.3/new$`.
* The prompt should change to `ros-industrial@ros-i-foxy-vm:~/ex0.3/new$`.
* Typing `pwd` will show you now in the directory `/home/ros-industrial/ex0.3/new`.
1. Enter `cd ..` into the terminal.
* In the [previous exercise](Exploring-the-Linux-File-System.md), we noted that `..` is the parent folder.
Expand Down
2 changes: 1 addition & 1 deletion gh_pages/_source/session1/ros2/0-ROS-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ We believe we have a good installation of ROS but let's test it to make sure.

1. If you switch back to the "foxy" ROS2 distribution, you'll notice that your environment is stil polluted with some variables from the ROS1 "noetic" distribution. To prevent confusion, it can be helpful to always start with a fresh terminal window rather than switching between distributions in the same terminal window.

In a "bare" ROS install, you will need to run the "source" command on **every** new shell you open to have access to the ROS commands. If your project only uses a single distribution, it can be helpful to configure our `~/.bashrc` file to automatically source this setup file for each new terminal window. See [here](https://docs.ros.org/en/foxy/Tutorials/Configuring-ROS2-Environment.html#add-sourcing-to-your-shell-startup-script) for details. Since this class uses content in both ROS1 and ROS2, we have not configured this auto-sourcing behavior for your training PC.
In a "bare" ROS install, you will need to run the "source" command on **every** new shell you open to have access to the ROS commands. If your project only uses a single distribution, it can be helpful to configure our `~/.bashrc` file to automatically source this setup file for each new terminal window. See [here](https://docs.ros.org/en/foxy/Tutorials/Configuring-ROS2-Environment.html#add-sourcing-to-your-shell-startup-script) for details. If you will be using multiple ROS distributions on one machine, then you do NOT want this auto-sourcing behavior. The auto-sourcing will always source the same distribution, and sourcing another distribution after this can cause issues. This class uses multiple ROS distros (noetic for ROS1 and foxy for ROS2), so we have not configured this auto-sourcing behavior for your training PC.

1. Open a new terminal window and source the ROS2 "foxy" distribution. Experiment with terminal windows, sourcing, and checking your environment until you are comfortable with this concept.

Expand Down
58 changes: 15 additions & 43 deletions gh_pages/_source/session1/ros2/3-Creating-a-ROS-Package-and-Node.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,9 @@ Your goal is to create your first ROS node:
#include <rclcpp/rclcpp.hpp>
```

1. Add a main function (typical in c++ programs).
1. Add a main function (typical in c++ programs). The rest of our code will go inside this function.

``` c++
/**
** Simple ROS Node
**/
#include <rclcpp/rclcpp.hpp>

int main(int argc, char* argv[])
{
Expand All @@ -85,59 +81,35 @@ Your goal is to create your first ROS node:
1. Initialize the ROS CPP middleware interface (must be called once per process).
``` c++
/**
** Simple ROS Node
**/
#include <rclcpp/rclcpp.hpp>
int main(int argc, char* argv[])
{
// This must be called before anything else ROS-related
rclcpp::init(argc, argv);
}
// This must be called before anything else ROS-related
rclcpp::init(argc, argv);
```

1. Create a ROS node instance.

``` c++
/**
** Simple ROS Node
**/
#include <rclcpp/rclcpp.hpp>

int main(int argc, char* argv[])
{
// This must be called before anything else ROS-related
rclcpp::init(argc, argv);

// Create a ROS node
auto node = std::make_shared<rclcpp::Node>("vision_node");
}
auto node = std::make_shared<rclcpp::Node>("vision_node");
```

1. Print a "Hello World" message using ROS print tools.

``` c++
/**
** Simple ROS Node
**/
#include <rclcpp/rclcpp.hpp>
int main(int argc, char* argv[])
{
// This must be called before anything else ROS-related
rclcpp::init(argc, argv);
RCLCPP_INFO(node->get_logger(), "Hello, World!");
```
// Create a ROS node
auto node = std::make_shared<rclcpp::Node>("vision_node");
1. Do not exit the program automatically - keep the node alive.
RCLCPP_INFO(node->get_logger(), "Hello, World!");
}
``` c++
// Don't exit the program.
rclcpp::spin(node);
```

1. Do not exit the program automatically - keep the node alive.
The complete code should look like this:

``` c++
/**
** Simple ROS Node
**/
#include <rclcpp/rclcpp.hpp>

int main(int argc, char* argv[])
Expand Down Expand Up @@ -174,7 +146,7 @@ Your goal is to create your first ROS node:
* See [ament_cmake documentation](https://docs.ros.org/en/foxy/How-To-Guides/Ament-CMake-Documentation.html) for more details on common ROS2 CMakeLists rules.
* _You're allowed to spread most of the CMakeLists rules across multiple lines, which is often required when a target contains many source files or has many dependencies._

1. We've now told CMake about the _vision_node_ executable and how to build it, but to actually run it, the file must be *installed* along with all the other workspace outputs. Typically, the installation location will be the `install/` directory alongside the `src/` directory. Add the following lines to declare an installation rule for the _vision_node_ executable:
1. We've now told CMake about the _vision_node_ executable and how to build it, but to actually run it, the file must be *installed* along with all the other workspace outputs. Typically, the installation location will be the `install/` directory alongside the `src/` directory. Add the following lines after `ament_target_dependencies` but before `ament_package` into your CMakeLists.txt to declare an installation rule for the _vision_node_ executable:

``` cmake
# Mark executables for installation
Expand Down
2 changes: 1 addition & 1 deletion gh_pages/_source/session2/ros2/0-Services.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Your goal is to create a more intricate system of nodes:
### Service Client
1. Create a new node (inside the same `myworkcell_core` package), named `myworkcell_node.cpp`. This will eventually be our main "application node", that controls the sequence of actions in our Scan & Plan task. The first action we'll implement is to request the position of the AR target from the Vision Node's `LocalizePart` service we created above.
1. Create a new node (inside the `myworkcell_core/src` directory), named `myworkcell_node.cpp`. This will eventually be our main "application node", that controls the sequence of actions in our Scan & Plan task. The first action we'll implement is to request the position of the AR target from the Vision Node's `LocalizePart` service we created above.
1. Be sure to include the standard ros header as well as the header for the `LocalizePart` service:
Expand Down
10 changes: 7 additions & 3 deletions gh_pages/_source/session3/ros2/0-Intro-to-URDF.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,20 @@ Your goal is to describe a workcell that features:
install(DIRECTORY launch urdf DESTINATION share/${PROJECT_NAME}/)
```

1. It helps to visualize your URDF as you add links, to verify things look as expected. Run the following commands in separate terminals:
1. It helps to visualize your URDF as you add links, to verify things look as expected. Run a node that publishes the robot state based on your URDF.

```
ros2 run robot_state_publisher robot_state_publisher --ros-args -p robot_description:="`cat ~/ros2_ws/src/myworkcell_support/urdf/workcell.urdf`"
<in a separate terminal>
rviz2
```

_Note the syntax used to specify a starting parameter value to the node (`--ros-args -p param_name:=param_value`). Also the use of `cat file.urdf` to pass the file contents as a string._

Now run the visualization tool Rviz in a separate terminal.

```
rviz2
```

1. The default RViz setup only shows a minimal amount of info. You can add various Display elements to customize the display to show exactly what is needed. Inside RViz add a _RobotModel_ display and a _TF_ display using the button in the lower left. Expand the settings for the added _RobotModel_ display and select `/robot_description` for the field labeled _Description Topic_. Also make sure in the _Global Options_ that _Fixed Frame_ is set to `world`. Consider saving this configuration (File -> Save Config) to the default RViz config file, so you don't need to repeat these setup steps again later.

## Challenge Exercise
Expand Down
23 changes: 16 additions & 7 deletions gh_pages/_source/session3/ros2/0a-Intro-to-ROS1.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ This exercise is not part of the main "Scan-N-Plan" application. It helps gain
* You can use tab-completion in ROS1 just like you do in ROS2.
* You will get an error message "Failed to contact master" when trying to run the ROS1 node. Every ROS1 system needs a running master node. Use Ctrl-C to cancel the running node.

1. Start a master node using `roscore`. Then open a new terminal window, source the ROS1 environment, and re-run the test node.
1. Start a master node using `roscore`.

```
roscore
<in a new terminal window>
```

Then open a new terminal window, source the ROS1 environment, and re-run the test node.

```
source ~/ros1_ws/devel/setup.bash
rosrun roscpp_tutorials babbler
```
Expand All @@ -67,12 +70,15 @@ This exercise is not part of the main "Scan-N-Plan" application. It helps gain
rosnode info /babbler
```

1. Close the babbler node and launch another demo node that has parameter support. Experiment with setting parameter values to the ROS1 parameter server.
1. Close the babbler node and launch another demo node that has parameter support.

```
rosrun turtlesim turtlesim_node
```

<in a separate terminal window>
In another terminal, experiment with setting parameter values to the ROS1 parameter server.

```
rosparam list
rosparam set /turtlesim/background_g 255
```
Expand All @@ -84,8 +90,11 @@ This exercise is not part of the main "Scan-N-Plan" application. It helps gain

```
roslaunch roscpp_tutorials talker_listener.launch
<in a 2nd ROS1 terminal>
```

In a 2nd ROS1 terminal, vizualize the systems nodes with rqt_graph.

```
rosrun rqt_graph rqt_graph
```

Expand Down
6 changes: 3 additions & 3 deletions gh_pages/_source/session3/ros2/3-Build-a-MoveIt-Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ In this exercise, you will generate a MoveIt package for the UR5 workcell you bu

### Create a Base Package using the Setup Assistant

1. Open a NEW terminal and setup a ROS1 workspace to run the MoveIt Setup Assistant. Put copies of the required URDF packages (`ur_description`, `myworkcell_support`) inside this ROS1 workspace, to make them visible to the Setup Assistant:
1. Open a NEW terminal and setup your ROS1 workspace to run the MoveIt Setup Assistant. Put copies of the required URDF packages (`ur_description`, `myworkcell_support`) inside this ROS1 workspace, to make them visible to the Setup Assistant:

```
mkdir -p ~/ros1_ws/src
cp -r ~/industrial_training/exercises/3.3/ros1/src/ur_description ~/ros1_ws/src
cd ~/ros1_ws/src
git clone https://github.com/ros-industrial/universal_robot.git
cp -r ~/industrial_training/exercises/3.3/ros1/src/myworkcell_support ~/ros1_ws/src
<edit ~/ros1_ws/src/myworkcell_support/package.xml & CMakeLists.txt and remove all references to myworkcell_core>
Expand Down
37 changes: 19 additions & 18 deletions gh_pages/_source/session4/ros1/1-Descartes-Path-Planning.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,21 @@ Left to you are the details of:
1. Translating those paths into something Descartes can understand.

### Setup workspace
1. Clone the Descartes repository into your ROS1 workspace src/ directory.
1. Clone ROS1 versions of the Descartes and fake_ar_publisher repositories into your ROS1 workspace src/ directory. (Descartes does not currently have a ROS2 version).

```bash
cd ~/catkin_ws/src
cd ~/ros1_ws/src
git clone -b melodic-devel https://github.com/ros-industrial-consortium/descartes.git
git clone -b master https://github.com/ros-industrial/fake_ar_publisher.git
```

1. Clone the Universal Robot repository into your workspace src/ directory
```bash
git clone https://github.com/ros-industrial/universal_robot.git
```

1. Copy over the `ur5_demo_descartes` and the ROS1 version of `myworkcell_support` packages into your workspace src/ directory.
1. Copy over ROS 1 code to prep the workspace for completion of this exercise.

```bash
cp -r ~/industrial_training/exercises/4.1/ros1/src/ur5_demo_descartes .
cp -r ~/industrial_training/exercises/4.1/ros1/src/myworkcell_support .
cp -r ~/industrial_training/exercises/4.1/ros1/src/ur5_demo_descartes ~/ros1_ws/src
cp -r ~/industrial_training/exercises/4.1/ros1/src/myworkcell_moveit_config ~/ros1_ws/src
cp -r ~/industrial_training/exercises/4.0/ros1/src/myworkcell_support ~/ros1_ws/src
cp -r ~/industrial_training/exercises/4.0/ros1/src/myworkcell_core ~/ros1_ws/src
```

1. Copy over the `descartes_node_unfinished.cpp` into your core package's src/ folder and rename it `descartes_node.cpp`.
Expand Down Expand Up @@ -160,27 +158,30 @@ With the Descartes node completed, we now want to invoke its logic by adding a n
ROS_INFO("Done");
```

1. Build the project, to make sure there are no errors in the new `descartes_node`
1. Build the project to make sure there are no new errors

### Test Full Application

1. Create a new `setup.launch` file (in `workcell_support` package) that brings up everything except your workcell_node:

``` xml
<include file="$(find myworkcell_moveit_config)/launch/myworkcell_planning_execution.launch"/>
<node name="fake_ar_publisher" pkg="fake_ar_publisher" type="fake_ar_publisher_node" />
<node name="vision_node" type="vision_node" pkg="myworkcell_core" output="screen"/>
<node name="descartes_node" type="descartes_node" pkg="myworkcell_core" output="screen"/>
<?xml version="1.0" ?>
<launch>
<include file="$(find myworkcell_moveit_config)/launch/myworkcell_planning_execution.launch"/>
<node name="fake_ar_publisher" pkg="fake_ar_publisher" type="fake_ar_publisher_node" />
<node name="vision_node" type="vision_node" pkg="myworkcell_core" output="screen"/>
<node name="descartes_node" type="descartes_node" pkg="myworkcell_core" output="screen"/>
</launch>
```

1. Run the new setup file, then your main workcell node:
1. Run the new setup file, then your main workcell node. Don't forget to `source ~/ros1_ws/devel/setup.bash` in each terminal.

``` bash
roslaunch myworkcell_support setup.launch
rosrun myworkcell_core myworkcell_node
```

It's difficult to see what's happening with the rviz planning-loop always running. Disable this loop animation in rviz (Displays -> Planned Path -> Loop Animation), then rerun `myworkcell_node`.
It's difficult to see what's happening with the rviz planning-loop always running. Disable this loop animation in rviz (Displays -> MotionPlanning -> Planned Path -> Loop Animation), then rerun `myworkcell_node`.

### Hints and Help

Expand All @@ -189,4 +190,4 @@ Hints:
* In `makeDescartesTrajectorty(...)` we need to convert the relative tool poses into world coordinates using the “ref” pose.
* In `makeTolerancedCartesianPoint(...)` consider the following documentation for specific implementations of common joint trajectory points:
* <http://docs.ros.org/indigo/api/descartes_trajectory/html/>
* For additional help, review the completed reference code at `~/industrial_training/exercises/4.1/src`
* For additional help, review the completed reference code at `~/industrial_training/exercises/4.1/ros1/src`

0 comments on commit f77e952

Please sign in to comment.