Skip to content

Commit

Permalink
Merge pull request #40 from kroshu/feature/rox_driver
Browse files Browse the repository at this point in the history
Feature/rox driver
  • Loading branch information
Svastits authored Dec 21, 2022
2 parents 5bf5c38 + cd610b3 commit dfeb653
Show file tree
Hide file tree
Showing 51 changed files with 2,949 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/industrial_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
BUILDER: colcon
ANALYZER: sonarqube
TEST_COVERAGE: true
UPSTREAM_WORKSPACE: 'github:kroshu/kroshu_ros2_core#master'
UPSTREAM_WORKSPACE: 'github:kroshu/kroshu_ros2_core#master github:kroshu/kuka_simulators#main'
CMAKE_ARGS: '-DMOCK_FRI=ON'
ROS_DISTRO: foxy
ROS_DISTRO: humble
env:
CCACHE_DIR: /github/home/.ccache # Directory for ccache (and how we enable ccache in industrial_ci)
EVENT_NAME: ${{ github.event_name }}
Expand Down
64 changes: 57 additions & 7 deletions doc/wiki/Home.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Welcome to the ROS2 KUKA Sunrise driver project!
# Welcome to the ROS2 KUKA drivers project!

## KUKA Sunrise driver (FRI)

Expand Down Expand Up @@ -66,14 +66,64 @@ The following features of the FRI are exposed to ROS2:

## KUKA KSS driver (RSI)

The other project in the repo centers on the development of a ROS2 driver for KSS robots through Robot Sensor Interface (RSI). It is in an experimental state, with only joint angle states and commands available. The structure of the driver is similiar to that of the Sunrise driver and the same interfaces are opened, so the same joint controller can be used to move robots. Howewer this controller should be improved, as it allows big torques that stop the robot for machine protection reasons.
Another project in the repo centers on the development of a ROS2 driver for KSS robots through Robot Sensor Interface (RSI). It is in an experimental state, with only joint angle states and commands available. The structure of the driver is similiar to that of the Sunrise driver and the same interfaces are opened, so the same joint controller can be used to move robots. Howewer this controller should be improved, as it allows big torques that stop the robot for machine protection reasons.

## KUKA RoX driver (ECI)

The third project in the repo is the driver for iiQKA robots.

### Architecture

The driver uses the ros2_control framework, so a variaty of controllers are supported and it can be easily integrated into moveit. It consists of a realtime component for controlling the robot via UDP (ROS2 hardware interface) and a non-realtime one for lifecycle management of the controllers and the hardware interface. The driver supports a control cycle time of 4 milliseconds, but the round-trip time of one cycle should not exceed 3 milliseconds, as above that the packets are considered lost. Therefore it is advised to run the driver on a realtime-capable Linux machine (with the PRREMPT_RT patch applied). After a few lost packets the connection is considered not stable enough and external control is ended.

The driver depends on some KUKA-specific packages, which are only available with the real robot, but setting the MOCK_HW_ONLY flag in the hardware_interface enables the usage of the driver in a simulated way, so that motion planning problems can be tried out with the same components running.
Two additional packages (not listed in package.xml) must be installed with apt:
- libnanopb-dev
- libgrpc++-dev

### Setup

The configuration files for the IP adresses are not used yet, so one has to edit the IP adresses in the hardware interface manually:
- modify the IP address at rox_hardware_interface.cpp L42 to the IP of your controller
- modify the IP address at rox_hardware_interface.hpp L98 to the IP of your ROS2 client machine
Besides, the setting of scheduling priorities must be allowed for your user (extend /etc/security/limits.conf with "username - rtprio 98")

### Usage

The usage of the driver is quite simple, one has to start the launch file in the package to start all required nodes (it also starts an rviz node for visualisation, which can be commented out if not needed):

**`ros2 launch kuka_rox_hw_interface startup.launch.py`**

After all components have started successfully, the system needs to be configured and activated to start external control:

**`ros2 lifecycle set robot_manager configure`**

## Contact

If you have questions, suggestions or want to contribute, feel free to open an [issue](https://github.com/kroshu/ros2_kuka_sunrise/issues), start a [discussion](https://github.com/kroshu/ros2_kuka_sunrise/discussions) or drop an email to:
**`ros2 lifecycle set robot_manager activate`**

**Zoltán Rési**
On successful activation the robot controller and the driver start communication with a 4 ms cycle time, and it is possible to move the robot through the joint trajectory controller. The easiest way to achieve this is to start an rqt_joint_trajcectory controller and move the joints with cursors or one can also execute trajectories planned with moveit - an example of this can be found in kuka_sunrise_control/eci_demo package.

To stop external control, the components have to be deactivated with **`ros2 lifecycle set robot_manager deactivate`**

BEWARE, that this is a non-realtime process including lifecycle management, so the connection is not terminated immediately, in cases where an abrupt stop is needed, the safety stop of the SmartPad should be used!

It is also possible to use different controllers with some modifications in the launch and yaml files (for example ForwardCommandController, which forwards the commands send to a ROS2 topic towards the robot). In these cases, one has to make sure, that the commands sent to the robot are close to the current position, otherwise the machine protection will stop the robot movement.

### Issues

The driver is in an experimental state, with only joint position commands supported. We have encountered the following isses:
- If there is an error after starting the launch file, the process must be stopped and started again. This error is related to spawning the joint_trajectory controller and comes forth sporadically.
The logs are the following:

[spawner-4] Node not found

[ERROR] [spawner-4]: process has died [pid ..., exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_trajectory_controller -c /controller_manager -p .../kuka_rox_hw_interface/share/kuka_rox_hw_interface/config/joint_trajectory_controller_config.yaml --inactive --ros-args']

- If you activate and deactivate the robot manager node, the reactivation will fail, you must restart the whole process if you want to control the robot again



## Contact

GitHub: https://github.com/resizoltan
If you have questions, suggestions or want to contribute, feel free to open an [issue](https://github.com/kroshu/ros2_kuka_sunrise/issues) or start a [discussion](https://github.com/kroshu/ros2_kuka_sunrise/discussions).

Email: [email protected]
61 changes: 61 additions & 0 deletions kuka_driver_examples/eci_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
cmake_minimum_required(VERSION 3.5)
project(eci_demo)

# Common cmake code applied to all moveit packages
find_package(moveit_common REQUIRED)
moveit_package()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(moveit_common REQUIRED)
find_package(moveit_ros_planning_interface REQUIRED)
find_package(rosidl_default_runtime REQUIRED)
find_package(rclcpp REQUIRED)
find_package(moveit_visual_tools REQUIRED)
find_package(rviz_visual_tools REQUIRED)
find_package(moveit_msgs REQUIRED)

add_executable(moveit_circular src/MoveitCircular.cpp)
ament_target_dependencies(moveit_circular
moveit_ros_planning_interface
rclcpp
rviz_visual_tools
moveit_visual_tools
)

install(TARGETS moveit_circular
EXPORT export_${PROJECT_NAME}
DESTINATION lib/${PROJECT_NAME}
)
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
)
install(DIRECTORY config
DESTINATION share/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_cmake_copyright REQUIRED)
find_package(ament_cmake_cppcheck REQUIRED)
find_package(ament_cmake_pep257 REQUIRED)
find_package(ament_cmake_flake8 REQUIRED)
find_package(ament_cmake_cpplint REQUIRED)
find_package(ament_cmake_lint_cmake REQUIRED)
find_package(ament_cmake_uncrustify REQUIRED)
find_package(ament_cmake_xmllint REQUIRED)

ament_copyright()
ament_cppcheck(--language=c++)
ament_pep257()
ament_flake8()
ament_cpplint()
ament_lint_cmake()
ament_uncrustify()
ament_xmllint()
endif()

ament_package()
14 changes: 14 additions & 0 deletions kuka_driver_examples/eci_demo/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Any contribution that you make to this repository will
be under the Apache 2 License, as dictated by that
[license](http://www.apache.org/licenses/LICENSE-2.0.html):

~~~
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
~~~

Loading

0 comments on commit dfeb653

Please sign in to comment.