Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Humble v1.5.0 Release #147

Merged
merged 84 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
e474f37
removed launch redundancy
mhubii Dec 29, 2023
29dfa20
RViz -> RViZ
mhubii Dec 29, 2023
3864a9d
RViZ -> RViz
mhubii Dec 29, 2023
7ff671e
read robot description from robot state publisher
mhubii Jan 3, 2024
a4a331e
added color scheme
mhubii Jan 3, 2024
a11c5ce
improved log
mhubii Jan 3, 2024
ef2d53c
updated namespace
mhubii Jan 3, 2024
d25bf2f
added comment
mhubii Jan 3, 2024
1c9dabb
replaced foxglove with rviz
mhubii Jan 3, 2024
1e200b5
documentation update
mhubii Jan 3, 2024
e3ed295
added re-write hints
mhubii Jan 4, 2024
f41901b
added world robot transform
mhubii Jan 4, 2024
79ad6b3
added connection check on rclcpp::ok exit
mhubii Jan 5, 2024
753e081
changed to info
mhubii Jan 5, 2024
68ce728
removed typo
mhubii Jan 5, 2024
96c1994
adding ros2 control node event handler https://github.com/ros-control…
mhubii Jan 5, 2024
5d460b0
added stream for simpler logs
mhubii Jan 5, 2024
6333ac9
FAIL -> ERROR
mhubii Jan 5, 2024
e02444b
added demos
mhubii Jan 5, 2024
acb0157
updated mail
mhubii Jan 5, 2024
a050f68
added improved error handling
mhubii Jan 5, 2024
72d1290
improved error output
mhubii Jan 5, 2024
492a9fd
added control mode to on state change
mhubii Jan 5, 2024
ff451a7
removed control mode output from state change
mhubii Jan 5, 2024
8113222
removed event handler ros2_control_node
mhubii Jan 10, 2024
4aab14f
merge humble
mhubii Feb 27, 2024
460543a
updated header
mhubii Feb 27, 2024
c276753
added draft
mhubii Feb 27, 2024
84bda8f
fixed readme
mhubii Feb 27, 2024
64b5521
Merge branch 'humble' into dev-humble-launch
mhubii Mar 4, 2024
c8ac049
Merge branch 'humble' into dev-humble-fri-msgs
mhubii Mar 4, 2024
a26d314
added linting
mhubii Mar 13, 2024
1dd97f7
formatted https://github.com/lbr-stack/lbr_fri_ros2_stack/pull/147
mhubii Mar 13, 2024
8444ff2
Merge branch 'humble' into dev-humble-launch
mhubii Mar 15, 2024
f26b518
udpated doc
mhubii Mar 15, 2024
ceee114
Merge branch 'humble' into dev-humble-launch
mhubii Mar 24, 2024
1ec871e
added a source
mhubii Apr 4, 2024
e3fd16f
re-named demos in accordance to ros 2 control
mhubii Apr 4, 2024
1eef8bd
added a note
mhubii Apr 9, 2024
2554ff4
Merge branch 'humble' into dev-humble-launch
mhubii May 8, 2024
45354ec
demo re-structure
mhubii May 8, 2024
1a4cb51
cartesian impedance control draft
mhubii May 8, 2024
92b1c99
updated robot description source
mhubii May 8, 2024
ac7b6de
updated demos
mhubii May 9, 2024
0b82943
fixed formatting
mhubii May 9, 2024
14e8a7c
added new prefixes
mhubii May 9, 2024
5c20aa8
velocity limit check via previous position
mhubii May 9, 2024
79f8e32
Merge branch 'humble' into dev-humble-fri-msgs
mhubii May 9, 2024
e6d4821
Merge branch 'dev-humble-fri-msgs' into dev-humble-launch
mhubii May 9, 2024
2f74b03
delet app, msgs, fri_vendor
mhubii May 9, 2024
ee70180
updated repos
mhubii May 9, 2024
62f76ae
fixed link
mhubii May 9, 2024
3b3cee0
added fri-1.11
mhubii May 9, 2024
2a6f58e
centralized launch mixins
mhubii May 9, 2024
053a69c
support fri 2.x
mhubii May 9, 2024
2911a86
user warning
mhubii May 9, 2024
4f99e92
added commanding active condition
mhubii May 9, 2024
754161c
catch rclcpp::ok
mhubii May 9, 2024
ff8582b
fri 2.x support
mhubii May 9, 2024
dd17a0e
init catch
mhubii May 9, 2024
749edf2
added initial client command mode de-couple
mhubii May 10, 2024
d57a5a5
added some more temporary examples
mhubii May 10, 2024
7e9ee55
fri 2.x support
mhubii May 10, 2024
ae1616e
updated system interface for new clients
mhubii May 10, 2024
971eac1
fixed nan init
mhubii May 10, 2024
da5ece7
fri 2.x support
mhubii May 10, 2024
2c6ac59
remove temporary tests from build
mhubii May 10, 2024
d7b7497
fri 2.x support
mhubii May 11, 2024
9f95c41
msgs -> idl
mhubii May 11, 2024
f7d1c58
update docker for new fri source
mhubii May 11, 2024
54a905a
new sensor source
mhubii May 11, 2024
769ae8e
moved urdf parameters to yaml
mhubii May 11, 2024
1a89992
.urdf.xacro -> .xacro (redundancy)
mhubii May 11, 2024
8591808
updated tests
mhubii May 11, 2024
8f06496
fixed open loop
mhubii May 11, 2024
47e2e35
updated admittance params
mhubii May 12, 2024
7de7e77
initial doc re-structure
mhubii May 12, 2024
2ff0716
clean up references
mhubii May 12, 2024
3f1136d
clean titles
mhubii May 12, 2024
115035d
trigger build test commit
mhubii May 12, 2024
87c2f78
webhhok test commit
mhubii May 12, 2024
2ba408d
removed redundant quick start
mhubii May 12, 2024
8100e25
updated doc
mhubii May 13, 2024
5a4fd86
updating doc
mhubii May 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- humble
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

# ros 2 ci: https://github.com/marketplace/actions/ros-2-ci-action
# doc: https://ubuntu.com/blog/ros-2-ci-with-github-actions
Expand All @@ -15,10 +15,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
fri_version: [1.11, 1.14, 1.15, 1.16, 2.5]
steps:
- uses: ros-tooling/[email protected]
- uses: ros-tooling/[email protected]
with:
package-name: lbr_fri_ros2_stack
target-ros2-distro: humble
vcs-repo-file-url: https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/repos.yaml
vcs-repo-file-url: https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/dev-humble-launch/lbr_fri_ros2_stack/repos-fri-${{ matrix.fri_version }}.yaml
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
# lbr_fri_ros2_stack
![Build status](https://github.com/lbr-stack/lbr_fri_ros2_stack/actions/workflows/build.yml/badge.svg?branch=humble) ![GitHub](https://img.shields.io/github/license/lbr-stack/lbr_fri_ros2_stack)
[![Build status](https://github.com/lbr-stack/lbr_fri_ros2_stack/actions/workflows/build.yml/badge.svg?branch=humble)](https://github.com/lbr-stack/lbr_fri_ros2_stack/actions)
[![License](https://img.shields.io/github/license/lbr-stack/lbr_fri_ros2_stack)](https://github.com/lbr-stack/lbr_fri_ros2_stack/tree/humble?tab=Apache-2.0-1-ov-file#readme)
[![Documentation Status](https://readthedocs.org/projects/lbr-stack/badge/?version=latest)](https://lbr-stack.readthedocs.io/en/latest/?badge=latest)
[![status](https://joss.theoj.org/papers/c43c82bed833c02503dd47f2637192ef/status.svg)](https://joss.theoj.org/papers/c43c82bed833c02503dd47f2637192ef)
[![JOSS](https://joss.theoj.org/papers/c43c82bed833c02503dd47f2637192ef/status.svg)](https://joss.theoj.org/papers/c43c82bed833c02503dd47f2637192ef)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

ROS 2 packages for the KUKA LBR, including communication to the real robot via the Fast Robot Interface ([FRI](https://github.com/lbr-stack/fri)) and [Gazebo](http://gazebosim.org/) simulation support. Included are the `iiwa7`, `iiwa14`, `med7`, and `med14`.

<body>
<table>
<tr>
<th align="left" width="25%">LBR IIWA7 R800</th>
<th align="left" width="25%">LBR IIWA14 R820</th>
<th align="left" width="25%">LBR Med7 R800</th>
<th align="left" width="25%">LBR Med14 R820</th>
<th align="left" width="25%">LBR IIWA 7 R800</th>
<th align="left" width="25%">LBR IIWA 14 R820</th>
<th align="left" width="25%">LBR Med 7 R800</th>
<th align="left" width="25%">LBR Med 14 R820</th>
</tr>
<tr>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/iiwa7_r800.png" alt="LBR IIWA7 R800"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/iiwa14_r820.png" alt="LBR IIWA14 R820"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/med7_r800.png" alt="LBR Med7 R800"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/med14_r820.png" alt="LBR Med14 R820"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/iiwa7_r800.png" alt="LBR IIWA 7 R800"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/iiwa14_r820.png" alt="LBR IIWA 14 R820"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/med7_r800.png" alt="LBR Med 7 R800"></td>
<td align="center"><img src="https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/doc/img/foxglove/med14_r820.png" alt="LBR Med 14 R820"></td>
</tr>
</table>
</body>

## Documentation
Full documentation available [here](https://lbr-stack.readthedocs.io/en/latest).
Full documentation available on [Read the Docs](https://lbr-stack.readthedocs.io/en/latest).

## Quick Start
1. Install ROS 2 development tools
Expand All @@ -35,20 +37,22 @@ Full documentation available [here](https://lbr-stack.readthedocs.io/en/latest).
2. Create a workspace, clone, and install dependencies

```shell
source /opt/ros/humble/setup.bash
export FRI_CLIENT_VERSION=1.15
mkdir -p lbr-stack/src && cd lbr-stack
vcs import src --input https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/repos.yaml
vcs import src --input https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/repos-fri-${FRI_CLIENT_VERSION}.yaml
rosdep install --from-paths src -i -r -y
```

> [!NOTE]
> FRI client is cloned from [fri](https://github.com/lbr-stack/fri) and must be available as branch, refer [README](https://github.com/lbr-stack/fri?tab=readme-ov-file#contributing).

3. Build

```shell
colcon build --symlink-install --cmake-args -DFRI_CLIENT_VERSION=1.15 --no-warn-unused-cli # replace by your FRI client version
colcon build --symlink-install
```

> [!NOTE]
> FRI client is added as external CMake project via [fri_vendor](https://github.com/lbr-stack/fri_vendor) and must be available as branch, refer [README](https://github.com/lbr-stack/fri?tab=readme-ov-file#contributing).

4. Launch the simulation via

```shell
Expand All @@ -63,7 +67,7 @@ Full documentation available [here](https://lbr-stack.readthedocs.io/en/latest).
> [!TIP]
> List all arguments for the launch file via `ros2 launch lbr_bringup bringup.launch.py -s`

Now, run the [demos](https://lbr-fri-ros2-stack-doc.readthedocs.io/en/humble/lbr_fri_ros2_stack/lbr_demos/doc/lbr_demos.html). To get started with the real robot, checkout the [Documentation](https://lbr-stack.readthedocs.io/en/latest) above.
Now, run the [demos](https://lbr-stack.readthedocs.io/en/latest/lbr_fri_ros2_stack/lbr_demos/doc/lbr_demos.html). To get started with the real robot, checkout the [Hardware Setup](https://lbr-stack.readthedocs.io/en/latest/lbr_fri_ros2_stack/lbr_fri_ros2_stack/doc/hardware_setup.html).

## Citation
If you enjoyed using this repository for your work, we would really appreciate ❤️ if you could cite it, as it helps us to continue offering support.
Expand Down
5 changes: 1 addition & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ FROM ros:humble-ros-base-jammy
# change default shell to bash
SHELL ["/bin/bash", "-c"]

# set environment variables
ARG FRI_CLIENT_VERSION=1.15

# upgrade packages
RUN apt-get update
RUN apt-get upgrade -y
Expand All @@ -19,7 +16,7 @@ RUN rosdep install -i --from-paths src --rosdistro ${ROS_DISTRO} -y

# "--symlink-install" allows the code in the locally mounted volume ./src to be adjusted without rebuilding
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --symlink-install --cmake-args -DFRI_CLIENT_VERSION=${FRI_CLIENT_VERSION} --no-warn-unused-cli
colcon build --symlink-install

# source the workspace
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
Expand Down
2 changes: 1 addition & 1 deletion docker/container_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ xhost +

docker rm lbr_stack_container

docker build --build-arg FRI_CLIENT_VERSION=$1 -t lbr_stack_container .
docker build -t lbr_stack_container .

docker run -it \
--network host \
Expand Down
7 changes: 4 additions & 3 deletions docker/doc/docker.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Docker
docker
======
To run the ``lbr_fri_ros2_stack`` in a Docker container, follow the instructions below.

Expand All @@ -12,16 +12,17 @@ To run the ``lbr_fri_ros2_stack`` in a Docker container, follow the instructions

.. code-block:: bash

export FRI_CLIENT_VERSION=1.15 # replace by your FRI client version
mkdir -p lbr-stack/src && cd lbr-stack
vcs import src --input https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/repos.yaml
vcs import src --input https://raw.githubusercontent.com/lbr-stack/lbr_fri_ros2_stack/humble/lbr_fri_ros2_stack/repos-fri-${FRI_CLIENT_VERSION}.yaml

#. Copy the Dockerfile and the container scripts to the ``lbr-stack`` directory. Build and start the container

.. code-block:: bash

cp -r src/lbr_fri_ros2_stack/docker/* .
chmod +x container_build.sh
sudo ./container_build.sh 1.15 # replace by your FRI client version
sudo ./container_build.sh

#. Inside the container, launch e.g. simulation via (might require re-launch after Gazebo launched first time)

Expand Down
3 changes: 2 additions & 1 deletion lbr_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)

install(
DIRECTORY config launch
DESTINATION share/${PROJECT_NAME}
)

# Launch mixins
ament_python_install_package(${PROJECT_NAME})
ament_python_install_package(launch_mixins)

ament_package()
67 changes: 19 additions & 48 deletions lbr_bringup/doc/lbr_bringup.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,5 @@
LBR Bringup
lbr_bringup
===========
The ``lbr_fri_ros2_stack`` is designed for research **and** deployment. It runs standalone, with ``ros2_control``, and thus also with ``MoveIt 2``. Details are described in below sections

- :ref:`ROS 2 Control and MoveIt 2 Launch`
- :ref:`Standalone Launch`

Users may also refer to :ref:`Software Architecture` for a better understanding of the underlying ``lbr_fri_ros2`` package.

.. note::
For the real robot, make sure you have followed :ref:`Robot Setup` first.

.. warning::
On the real robot, do always execute in ``T1`` mode first.

General Information on the FRI
------------------------------
The ``FRI`` lets the user select a ``FRI control mode`` and a ``FRI client command mode``. When running the ``LBRServer``:

- .. dropdown:: Select ``FRI control mode``

.. thumbnail:: ../../lbr_fri_ros2_stack/doc/img/controller/raw/lbr_server_control_mode.png

- .. dropdown:: Select ``FRI client command mode``

.. thumbnail:: ../../lbr_fri_ros2_stack/doc/img/controller/raw/lbr_server_client_command_mode.png

The ``FRI control mode`` specifies the mode in which the robot is controlled, and the ``FRI client command mode`` specifies the commands that the user sends.

ROS 2 Control and MoveIt 2 Launch
---------------------------------
The ``lbr_bringup`` works for the simulation and the real robot. Run:

.. code:: bash
Expand All @@ -42,44 +13,44 @@ The ``lbr_bringup`` works for the simulation and the real robot. Run:
.. note::
For a list of available parameters, call ``ros2 launch lbr_bringup bringup.launch.py -s``.

When using the real robot
When using the real robot, select ``sim:=false`` and

.. dropdown:: Launch the ``LBRServer`` application on the ``KUKA smartPAD``

.. thumbnail:: ../../lbr_demos/doc/img/applications_lbr_server.png

and select:
Select

- ``FRI send period``: ``10 ms``
- ``IP address``: ``your configuration``
- ``FRI control mode``: ``POSITION_CONTROL`` or ``JOINT_IMPEDANCE_CONTROL`` (will put the robot into a compliant mode)
- ``FRI client command mode``: ``POSITION``

Make sure that the ``update_rate`` in `lbr_controllers.yaml <https://github.com/lbr-stack/lbr_fri_ros2_stack/tree/humble/lbr_ros2_control/config/lbr_controllers.yaml>`_ is greater or equal ``100`` (``FRI send period``).
Users may also refer to :ref:`Software Architecture` for a better understanding of the underlying ``lbr_fri_ros2`` package.

For using other ``FRI send period``, also change the ``sample_time`` in the `lbr_system_interface.xacro <https://github.com/lbr-stack/lbr_fri_ros2_stack/blob/humble/lbr_ros2_control/config/lbr_system_interface.xacro>`_ (automated in the future).
.. note::
For the real robot, make sure you have followed :doc:`Hardware Setup <../../lbr_fri_ros2_stack/doc/hardware_setup>` first.

Standalone Launch
-----------------
Standalone launch is great for research. Only the the real robot is supported. It can be launched through:
.. warning::
On the real robot, do always execute in ``T1`` mode first.

.. code:: bash
General Information on the FRI
------------------------------
The ``FRI`` lets the user select a ``FRI control mode`` and a ``FRI client command mode``. When running the ``LBRServer``:

ros2 launch lbr_fri_ros2 app.launch.py \
model:=iiwa7 # [iiwa7, iiwa14, med7, med14] \
robot_name:=lbr # any robot name
- .. dropdown:: Select ``FRI control mode``

This runs the :lbr_fri_ros2:`AppComponent <lbr_fri_ros2::AppComponent>`, which creates 2 topics, ``/robot_name/command`` for commands and ``/robot_name/state``. See :ref:`LBR Demos FRI ROS 2` for more examples and :ref:`LBR FRI ROS 2` for more documentation.
.. thumbnail:: ../../lbr_fri_ros2_stack/doc/img/controller/raw/lbr_server_control_mode.png

.. note::
For a list of available parameters, call ``ros2 launch lbr_fri_ros2 app.launch.py -s``.
- .. dropdown:: Select ``FRI client command mode``

.. thumbnail:: ../../lbr_fri_ros2_stack/doc/img/controller/raw/lbr_server_client_command_mode.png

The ``FRI control mode`` specifies the mode in which the robot is controlled, and the ``FRI client command mode`` specifies the commands that the user sends.

Troubleshooting
---------------
Noisy Execution
~~~~~~~~~~~~~~~
Three main causes:

- Frequency: Make sure the ``ros2_control_node`` runs at the same or a higher rate of the ``FRI send period``, change ``update_rate`` in `lbr_controllers.yaml <https://github.com/lbr-stack/lbr_fri_ros2_stack/tree/humble/lbr_ros2_control/config/lbr_controllers.yaml>`_.
- Standalone noise: Smoothing might be required, see :ref:`LBR Demos FRI ROS 2`.
- Frequency: Make sure the ``ros2_control_node`` frequency and the ``FRI send period`` are compatible, consider changing ``update_rate`` in `lbr_controllers.yaml <https://github.com/lbr-stack/lbr_fri_ros2_stack/tree/humble/lbr_ros2_control/config/lbr_controllers.yaml>`_.
- Realtime priority: Set real time priority in ``code /etc/security/limits.conf``, add the line: ``user - rtprio 99``, where user is your username.
6 changes: 2 additions & 4 deletions lbr_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, RegisterEventHandler
from launch.actions import IncludeLaunchDescription
from launch.conditions import IfCondition, UnlessCondition
from launch.event_handlers import OnIncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch_mixins.lbr_description import LBRDescriptionMixin
from launch_ros.substitutions import FindPackageShare

from lbr_description import LBRDescriptionMixin, RVizMixin


def generate_launch_description() -> LaunchDescription:
ld = LaunchDescription()
Expand Down
5 changes: 2 additions & 3 deletions lbr_bringup/launch/move_group.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from launch import LaunchContext, LaunchDescription, LaunchDescriptionEntity
from launch.actions import OpaqueFunction
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution

from lbr_bringup import LBRMoveGroupMixin
from lbr_description import LBRDescriptionMixin, RVizMixin
from launch_mixins.lbr_bringup import LBRMoveGroupMixin
from launch_mixins.lbr_description import LBRDescriptionMixin, RVizMixin


def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
Expand Down
35 changes: 15 additions & 20 deletions lbr_bringup/launch/real.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@
from launch import LaunchContext, LaunchDescription, LaunchDescriptionEntity
from launch.actions import DeclareLaunchArgument, OpaqueFunction, RegisterEventHandler
from launch.conditions import IfCondition
from launch.event_handlers import OnProcessExit, OnProcessStart
from launch.event_handlers import OnProcessStart
from launch.substitutions import (
AndSubstitution,
LaunchConfiguration,
NotSubstitution,
PathJoinSubstitution,
)

from lbr_bringup import LBRMoveGroupMixin
from lbr_description import LBRDescriptionMixin, RVizMixin
from lbr_ros2_control import LBRROS2ControlMixin
from launch_mixins.lbr_bringup import LBRMoveGroupMixin
from launch_mixins.lbr_description import LBRDescriptionMixin, RVizMixin
from launch_mixins.lbr_ros2_control import LBRROS2ControlMixin


def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
ld = LaunchDescription()

robot_description = LBRDescriptionMixin.param_robot_description(sim=False)
ros2_control_node = LBRROS2ControlMixin.node_ros2_control(
robot_description=robot_description
world_robot_tf = [0, 0, 0, 0, 0, 0] # keep zero

# robot state publisher
robot_state_publisher = LBRROS2ControlMixin.node_robot_state_publisher(
robot_description=robot_description, use_sim_time=False
)
ld.add_action(robot_state_publisher)

# ros2 control node
ros2_control_node = LBRROS2ControlMixin.node_ros2_control()
ld.add_action(ros2_control_node)

# joint state broad caster and controller on ros2 control node start
Expand Down Expand Up @@ -52,17 +58,6 @@ def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
)
ld.add_action(controller_event_handler)

# robot state publisher on joint state broadcaster spawn exit
robot_state_publisher = LBRROS2ControlMixin.node_robot_state_publisher(
robot_description=robot_description, use_sim_time=False
)
robot_state_publisher_event_handler = RegisterEventHandler(
OnProcessExit(
target_action=joint_state_broadcaster, on_exit=[robot_state_publisher]
)
)
ld.add_action(robot_state_publisher_event_handler)

# MoveIt 2
ld.add_action(LBRMoveGroupMixin.arg_allow_trajectory_execution())
ld.add_action(LBRMoveGroupMixin.arg_capabilities())
Expand All @@ -77,7 +72,7 @@ def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
robot_name = LaunchConfiguration("robot_name").perform(context)
ld.add_action(
LBRDescriptionMixin.node_static_tf(
tf=[0, 0, 0, 0, 0, 0], # keep zero
tf=world_robot_tf,
parent="world",
child=PathJoinSubstitution(
[
Expand Down Expand Up @@ -144,7 +139,7 @@ def launch_setup(context: LaunchContext) -> List[LaunchDescriptionEntity]:
# RViz event handler
rviz_event_handler = RegisterEventHandler(
OnProcessStart(
target_action=robot_state_publisher, on_start=[rviz_moveit, rviz]
target_action=joint_state_broadcaster, on_start=[rviz_moveit, rviz]
)
)
ld.add_action(rviz_event_handler)
Expand Down
Loading
Loading