Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuebel committed Aug 28, 2024
0 parents commit 896befa
Show file tree
Hide file tree
Showing 163 changed files with 13,317 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.jar filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
setup:
runs-on: ubuntu-latest
container: moveit/moveit:noetic-release
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup ROS workspace and dependencies
run: |
mkdir src
ls --almost-all --ignore .catkin_tools --ignore build --ignore devel --ignore src | xargs mv -t src
git clone --depth 1 https://YOUR_GITHUB_TOKEN@github.com/YOUR_USERNAME/ros-devcontainer.git /ros_devcontainer
cd /ros_devcontainer &;&; ls --almost-all | xargs mv -n -t ${GITHUB_WORKSPACE} &;&; cd ${GITHUB_WORKSPACE}
sed -i 's/https:\/\/git-ce\./https:\/\/YOUR_GITHUB_TOKEN\@github.com\//g' src/.rosinstall
wstool update -t src
. .devcontainer/postCreate.sh
build:
needs: setup
runs-on: ubuntu-latest
container: moveit/moveit:noetic-release

steps:
- name: Checkout code
uses: actions/checkout@v2

# Reuse the setup job's workspace state by caching it.
- name: Cache catkin workspace directories
uses: actions/cache@v2
with:
path: |
.catkin_tools
build
devel
key: ${{ runner.os }}-build-${{ github.sha }}

# Run the actual build commands.
- name: Build with catkin tools
run: catkin build --summarize --no-status --force-color

# Upload artifacts (if needed)
# Note that GitHub Actions handles artifacts differently than GitLab CI.
# You may need to add additional steps here to upload and store artifacts.

linting_and_tests:
needs: build
runs-on: ubuntu-latest
container: moveit/moveit:noetic-release

steps:
- name: Checkout code
uses: actions/checkout@v2

# Reuse the previous job's workspace state by caching it.
- name: Cache catkin workspace directories
uses: actions/cache@v2
with:
path: |
.catkin_tools
build
devel
key: ${{ runner.os }}-build-${{ github.sha }}

# Source the setup.bash script before running tests.
- name: Source setup.bash and run catkin_lint
run: |
source devel/setup.bash
catkin_lint -W2 --pkg lbrmed_bringup —pkg lbrmed_control —pkg lbrmed_description —pkg lbrmed_hw_fri —pkg lbrmed_moveit_config —pkg lbrmed_msgs
# Run catkin tests.
- name: Run Catkin Tests
run: |
source devel/setup.bash
catkin test –no-deps lbrmed_bringup lbrmed_control lbrmed_description lbrmed_hw_fri lbrmed_moveit_config lbrmed_msgs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
51 changes: 51 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
stages:
- build
- test
- release

default:
before_script:
# move this repo to src of catkin workspace, .catkin_tools, build and devel spaces are passed as artifacts - do not move!
- mkdir src
- ls --almost-all --ignore .catkin_tools --ignore build --ignore devel --ignore src | xargs mv -t src
# setup the workspace as ROS Devcontainer
- git clone --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@git-ce.rwth-aachen.de/g-med-irt-robotik/ros-devcontainer.git /ros_devcontainer
- cd /ros_devcontainer && ls --almost-all | xargs mv -n -t ${CI_PROJECT_DIR} && cd ${CI_PROJECT_DIR}
# configure gitlab token before cloning dependencies
- sed -i 's/https:\/\/git-ce\./https:\/\/gitlab-ci-token:\$\{CI_JOB_TOKEN\}\@git-ce\./g' src/.rosinstall
- wstool update -t src
# load remaining dependencies and setup catkin config
- . .devcontainer/postCreate.sh

cache:
# Good practice
key: ${CI_COMMIT_REF_SLUG}
# Caching might improve CI speed
paths:
- .catkin_tools
- build
- devel
image: $CI_REGISTRY/g-med-irt-robotik/ros-devcontainer/master:noetic-moveit

catkin_tools_build:
stage: build
script:
- catkin build --summarize --no-status --force-color
artifacts:
name: "$CI_JOB_NAME"
paths:
- .catkin_tools
- build
- devel

catkin_lint:
stage: test
script:
- source devel/setup.bash
- catkin_lint -W2 --pkg lbrmed_bringup --pkg lbrmed_control --pkg lbrmed_description --pkg lbrmed_hw_fri --pkg lbrmed_moveit_config --pkg lbrmed_msgs

catkin_tools_run_tests:
stage: test
script:
- source devel/setup.bash
- catkin test --no-deps lbrmed_bringup lbrmed_control lbrmed_description lbrmed_hw_fri lbrmed_moveit_config lbrmed_msgs
8 changes: 8 additions & 0 deletions .rosinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- git:
local-name: cartesian_controllers
uri: https://github.com/fzi-forschungszentrum-informatik/cartesian_controllers.git
version: ros1
- git:
local-name: ros_control_boilerplate
uri: https://github.com/Tuebel/ros_control_boilerplate.git
version: combined_robot_hw_draft
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2020, Institute of Automatic Control - RWTH Aachen University
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# KUKA LBR MED STACK
ROS package for the Kuka LBR MED R820 (14kg)
We support
- commanding the robot hardware via the KUKA FRI interface and `ros_control`.
- kinematic simulations, Gazebo was never stable enough for contact rich tasks.
- MoveIt support for the hardware and simulation.

- A kinematic simulation environment and the robot hardware.
However, contact forces tend to be unstable.

Please look at the READMEs in the specific hardware packages.
**When using the real robot, always keep a safe distance and set up your safety configuration as required**.

# Install
## Create a catkin workspace
* Create a catkin workspace folder (e.g. ~/catkin_workspace)
* Create a src folder in that workspace (e.g. ~/catkin_workspace/src)
* Initialize the catkin workspace (e.g. `cd ~/catkin_workspace && catkin init`)

## Cloning the repository
We use [`git-lfs`](https://packagecloud.io/github/git-lfs/install) which should be installed before cloning.
Otherwise, you might get errors when the STL files of the robot or the jar files are being loaded.

For the Sunrise Project you have two ways to proceed:
* (a) Clone the repository into the src folder of the catkin workspace
* (b) (preferable) Clone the repository into a separate folder (e.g. ~/git-repos) and symlink it (e.g. `ln -s ~/git-repos/kuka_MED_Stack ~/catkin_workspace/src`, the target of the symlink must be an absolute path)

## Installing Dependencies
In the catkin workspace, run the following commands to install all workspace and system dependencies.
```bash
wstool init src
wstool merge -t src src/lbrmed-stack/.rosinstall
wstool update -t src
rosdep install --from-paths src --ignore-src -r -y
```

## Building the workspace
To build the packages in parallel, we use the [catkin_tools](https://catkin-tools.readthedocs.io/en/latest/installing.html). After installing them, run:
```bash
cd ~/catkin_workspace
catkin build
```

# LBR MED Stack - Package Organization
*Reference: https://roboticsbackend.com/package-organization-for-a-ros-stack-best-practices/#Simulation_with_Gazebo*

* lbrmed: Metapackage (optional)
* [lbrmed_bringup](./lbrmed_bringup): Main entry point launch files for this robot application, including Parameters and Configuration files. Good starting point to setup your own robot.
* [lbrmed_control](./lbrmed_control): Custom controllers for the LBR Med, e.g., a kind of admittance controller and integration of the FZI cartesian controllers.
* [lbrmed_description](./lbrmed_description): All files that are necessary for visualization (URDFs, Meshes, test launch files, ...)
* [lbrmed_hw_fri](./lbrmed_hw_fri/) (recommended): Implements the `hardware_interface::RobotHW` which can be used by ROS control using the FRI real-time interface.
* [lbrmed_moveit_config](./lbrmed_moveit_config): Default MoveIt configuration for without an end-effector, created with the MoveIt wizard.
* [lbrmed_msgs](./lbrmed_msgs): All custom messages, services and actions for this robot
* [lbrmed_ros_java](./lbrmed_ros_java): Transfer this code to the robot via the Sunrise Workbench. Add your own station setup and safety configuration!
22 changes: 22 additions & 0 deletions fri/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2021 Martin Huber
Copyright (c) 2022 Institute of Automatic Control - RWTH Aachen University

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
111 changes: 111 additions & 0 deletions fri/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
Based on https://github.com/lbr-stack/fri

# Fast Robot Interface
The Fast Robot Interface (FRI) library allows for hard real time communication to the KUKA LBR Med, see KUKA's [paper](http://www.best-of-robotics.org/pages/publications/KUKA_FRI_from_WS_Proceedings_ICRA2010.pdf). This folder contains the C++ client side library to setup the UDP connection to the LBR Med. However, hard real time is only supported if the FRI is compiled on a real time OS.
## Build and Installation
Other than what KUKA provides, our FRI comes with CMake support. This allows for cross-platform compatability, therefore, the [Cross Platform Build and Installation](#cross-platform-build-and-installation) instructions are the same for Linux and Windows. However, the prerequisites are differntly obtained. How to obtain the prerequisites is explained in [Linux Prerequisites](#linux-prerequisites) and [Windows Prerequisites](#windows-prerequisites), respectively.
### Linux Prerequisites
Skip any of these if already satisfied.
* Install Git. In a terminal, run `sudo apt install git`
* Install CMake. In a terminal, run `sudo apt install cmake`
### Windows Prerequisites
Skip any of these if already satisfied.
* Install the new Windows Terminal. Search for `Microsoft Store` in Start and open it. Therein, search for `Windows Terminal`, and install it
* Install Chocolatey by following the [instructions](https://chocolatey.org/install)
* Install Git. In an administrative Windows Terminal, run `choco install git`.
* Install CMake. In an administrative Windows Terminal, run `choco install cmake`. Add CMake to your Path. Therefore, search for `Edit the system environment variables` in Start, and open it. Open `Environment Variables...`, and double click on `Path` under System variables. Click on `New`, and add `C:\Program Files\CMake\bin` (usually CMake is installed there, might differ)
### Cross Platform Build and Installation
Clone this repository
```shell
git clone https://github.com/KCL-BMEIS/FastRobotInterface.git
```
Build and install the FRI library
```shell
cd FastRobotInterface
mkdir build
cd build
cmake ..
cmake --build . --config Release --target install # builds and installs the FRI library in Release mode
```
## Usage
The FRI comes with [example apps](#example-apps). These apps require some [prerequisites](#prerequisites) that are explained below.
### Prerequisites
Follow the [Build and Installation](#build-and-installation) instructions for your OS. Install [Sunrise Workbench](#sunrise-workbench) on your computer. This step requires Windows as OS.
#### Sunrise Workbench
Sunrise Workbench is KUKA's Java IDE that allows you to program the LBR Med.
* Download it from the [RViM shared folder](https://emckclac.sharepoint.com/:u:/s/MT-BMEIS-RVIM/ETBf6gp3Ko5EvtJVziR8MZ4BLdeX8ysF13jTVmVreq0iZA?e=XJyagD)
* Extract the .zip file and run the Sunrise Workbench Setup
* Follow the install instructions
### Example Apps
Exemplary applications for the C++ client side are located inside the [apps](https://github.com/KCL-BMEIS/FastRobotInterface/tree/master/apps) folder. Each of these apps has a Java equivalent for the server side.
#### Connect Laptop
* Connect your laptop, therefore, establish an Ethernet connection to connector X66 at the KUKA controller
* The KUKA controller's default IP is 172.31.1.147. Configure the same network on your laptop, therefore
* On Windows
* Search for `View network connections` in Start and open it
* Right click on the Ethernet connection and open `Properties`
* Double click Internet Protocol Version 4 (TCP/IPv4) and set the IP address to `172.31.1.148` and the Subnet mask to `255.255.0.0`
* On Ubuntu 16 (might differ for other Linux distributions)
* Search for `System Settings` and open it
* Go to Network -> Wired -> Options
* Go to the IPv4 Settings tab and set the IP address to `172.31.1.148` and the Netmask to `255.255.0.0`
#### Server Side - KUKA Controller
You will have to follow the instructions in [Connect Laptop](#connect-laptop). The FRI has to be installed on the controller. Therefore, the [Sunrise Workbench](#sunrise-workbench) IDE is used.
* Open the Sunrise Workbench
* Create a new project, therefore
* Click File -> New -> Sunrise project
* Leave the default IP (172.31.1.147) and click Next
* Give your project a name, e.g. FRI and click Next
* Select LBR Med 7 R800 and click Next
* Under Media Flange, select Medien-Flansch Inside elektrisch, and click Next
* Click Finish (might take some time). Select RoboticsAPI Application, and press Next
* Click Finish
* Setup the KUKA controller, therefore
* Double click the StationSetup.cat under FRI in the Package Explorer and add the LBR Med 7 R800 to the Topolgy (below left)
* Remove the LBR_Med_7_R800_2, which has no Media Flange, and which we are not using (below right)
<figure>
<p align="center"><img src="img/sunrise_workbench_fri_topology_highlighted.png" width="45%" height="45%" hspace="20"><img src="img/sunrise_workbench_fri_topology_remove_2_highlighted.png" width="45%" height="45%" hspace="20"></p>
<figcaption></figcaption>
</figure>
* In the Software tab, make sure that the checker boxes for the FRI extensions are selected (below left)
* In the Configurations tab, make sure that the IP is set to 172.31.1.147 (below right)
* Save the StationSetup.cat via `Ctrl + s`
<figure>
<p align="center"><img src="img/sunrise_workbench_fri_software_highlighted.png" width="45%" height="45%" hspace="20"><img src="img/sunrise_workbench_fri_configuration_highlighted.png" width="45%" height="45%" hspace="20"></p>
<figcaption></figcaption>
</figure>
* In the Installation tab, click Install (below left)
* Synchronize your project with the KUKA controller (below right)
<figure>
<p align="center"><img src="img/sunrise_workbench_fri_installation_highlighted.png" width="45%" height="45%" hspace="20"><img src="img/sunrise_workbench_fri_synchronize_highlighted.png" width="45%" height="45%" hspace="20"></p>
<figcaption></figcaption>
</figure>
#### Client Side - Laptop
You will have to follow the instructions in [Connect Laptop](#connect-laptop), and make sure that the FRI was installed to the KUKA controller, according to [Server Side - KUKA Controller](#server-side---kuka-controller). The client side requires to build the [apps](https://github.com/KCL-BMEIS/FastRobotInterface/tree/master/apps), which requires that the FRI was installed according to [Build and Installation](#build-and-installation). Then, open a terminal and do
```shell
cd apps
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH='path/to/lib' .. # on Windows this should be 'C:\Program Files (x86)\FastRobotInterface'
# on Linux this should be '/usr/local'
cmake --build . --config Release # builds the apps in Release mode
```
#### Run the Apps
To run one of the example [apps](https://github.com/KCL-BMEIS/FastRobotInterface/tree/master/apps), they have to be started on the smartHMI (KUKA's smartpad), as well as on the laptop.
* On the smartHMI
* Select an Application (left below), e.g. the LBRJointSineOverlay
* Press one of the enabling switches half way (grey buttons on the back of the smartHMI). The joint control A1-A7 will light up (center below)
* Press and hold the play button (below right), and the enabling switch
<br><br>
<figure>
<p align="center"><img src="img/select_app_highlighted.png" width="25%" height="25%" hspace="20"><img src="img/joint_sine_overlay_enable_highlighted.png" width="25%" height="25%" hspace="20"><img src="img/joint_sine_overlay_running_highlighted.png" width="25%" height="25%" hspace="20"></p>
<figcaption></figcaption>
</figure>
* On the laptop open a terminal, and run

```shell
cd apps/build # on Linux
cd apps/build/Release # on Windows
./lbrjointsineoverlay
```
The robot should now be controlled by your Laptop, well done 😄! For open questions please leave an [Issue](https://github.com/KCL-BMEIS/FastRobotInterface/issues).
Loading

0 comments on commit 896befa

Please sign in to comment.