Skip to content

Commit

Permalink
Feature/launch testing (kroshu#43)
Browse files Browse the repository at this point in the history
* ci tests for iisy

* fix rviz config files

* add test launch files

* add test_depend

* launch_ros dep

---------

Co-authored-by: Aron Svastits <[email protected]>
  • Loading branch information
Svastits and Aron Svastits authored Jan 4, 2024
1 parent 84c68fe commit 46fba30
Show file tree
Hide file tree
Showing 18 changed files with 347 additions and 76 deletions.
5 changes: 5 additions & 0 deletions kuka_agilus_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ find_package(xacro REQUIRED)
install(DIRECTORY config launch meshes urdf
DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
find_package(launch_testing_ament_cmake)
add_launch_test(test/test_kr_agilus.py)
endif()

ament_package()
8 changes: 4 additions & 4 deletions kuka_agilus_support/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@
<author>G.A. vd. Hoorn (TU Delft Robotics Institute)</author>
<author>Brett Hemes (3M)</author>
<maintainer email="[email protected]">G.A. vd. Hoorn (TU Delft Robotics Institute)</maintainer>
<maintainer email="antal.marci@gmail.com">Marton Antal</maintainer>
<maintainer email="svastits1@gmail.com">Áron Svastits</maintainer>
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>

<depend>xacro</depend>
<depend>launch_ros</depend>

<exec_depend>joint_state_publisher_gui</exec_depend>
<exec_depend>kuka_resources</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rviz2</exec_depend>

<test_depend>launch_testing_ament_cmake</test_depend>

<export>
<architecture_independent/>
<build_type>ament_cmake</build_type>
Expand Down
55 changes: 55 additions & 0 deletions kuka_agilus_support/test/test_kr_agilus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2024 Áron Svastits
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

import launch
import launch.actions
import launch_testing.actions
import launch_testing.markers
import pytest
import os

from launch.launch_description_sources.python_launch_description_source import PythonLaunchDescriptionSource # noqa: E501
from launch.actions.include_launch_description import IncludeLaunchDescription
from ament_index_python.packages import get_package_share_directory


def list_test_launch_files():
files = [f for f in os.listdir(get_package_share_directory(
'kuka_agilus_support')+'/launch/') if f.endswith('.py')]
return files


# Launch all of the robot visualisation launch files one by one
@pytest.mark.launch_test
@launch_testing.markers.keep_alive
@launch_testing.parametrize('test_file', list_test_launch_files())
def generate_test_description(test_file):
list_test_launch_files()
return launch.LaunchDescription([
IncludeLaunchDescription(PythonLaunchDescriptionSource(
[get_package_share_directory('kuka_agilus_support'),
'/launch/', test_file])),
launch_testing.actions.ReadyToTest()
])


class TestModels(unittest.TestCase):

def test_read_stdout(self, proc_output):
# Check for frames defined by ROS-Industrial
proc_output.assertWaitFor('got segment base', timeout=5)
proc_output.assertWaitFor('got segment flange', timeout=5)
proc_output.assertWaitFor('got segment tool0', timeout=5)
5 changes: 5 additions & 0 deletions kuka_cybertech_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ find_package(xacro REQUIRED)
install(DIRECTORY config launch meshes urdf
DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
find_package(launch_testing_ament_cmake)
add_launch_test(test/test_kr_cybertech.py)
endif()

ament_package()
6 changes: 3 additions & 3 deletions kuka_cybertech_support/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>

<depend>xacro</depend>
<depend>launch_ros</depend>

<exec_depend>joint_state_publisher_gui</exec_depend>
<exec_depend>kuka_resources</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rviz2</exec_depend>

<test_depend>launch_testing_ament_cmake</test_depend>

<export>
<architecture_independent/>
<build_type>ament_cmake</build_type>
Expand Down
55 changes: 55 additions & 0 deletions kuka_cybertech_support/test/test_kr_cybertech.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2024 Áron Svastits
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

import launch
import launch.actions
import launch_testing.actions
import launch_testing.markers
import pytest
import os

from launch.launch_description_sources.python_launch_description_source import PythonLaunchDescriptionSource # noqa: E501
from launch.actions.include_launch_description import IncludeLaunchDescription
from ament_index_python.packages import get_package_share_directory


def list_test_launch_files():
files = [f for f in os.listdir(get_package_share_directory(
'kuka_cybertech_support')+'/launch/') if f.endswith('.py')]
return files


# Launch all of the robot visualisation launch files one by one
@pytest.mark.launch_test
@launch_testing.markers.keep_alive
@launch_testing.parametrize('test_file', list_test_launch_files())
def generate_test_description(test_file):
list_test_launch_files()
return launch.LaunchDescription([
IncludeLaunchDescription(PythonLaunchDescriptionSource(
[get_package_share_directory('kuka_cybertech_support'),
'/launch/', test_file])),
launch_testing.actions.ReadyToTest()
])


class TestModels(unittest.TestCase):

def test_read_stdout(self, proc_output):
# Check for frames defined by ROS-Industrial
proc_output.assertWaitFor('got segment base', timeout=5)
proc_output.assertWaitFor('got segment flange', timeout=5)
proc_output.assertWaitFor('got segment tool0', timeout=5)
8 changes: 6 additions & 2 deletions kuka_lbr_iisy_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ find_package(ament_cmake REQUIRED)
find_package(urdf REQUIRED)
find_package(xacro REQUIRED)

#xacro_add_files(TARGET xacro urdf/lbr_iisy3_r760.urdf.xacro OUTPUT lbr_iisy3_r760.urdf INSTALL DESTINATION urdf)

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


if(BUILD_TESTING)
find_package(launch_testing_ament_cmake)
add_launch_test(test/test_lbr_iisy.py)
endif()

ament_package()
5 changes: 0 additions & 5 deletions kuka_lbr_iisy_support/launch/test_lbr_iisy3_r760.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch_ros.actions import Node
import xacro
import os
from ament_index_python.packages import get_package_share_directory


def generate_launch_description():

Expand All @@ -36,7 +32,6 @@ def generate_launch_description():
"use_fake_hardware:=true",
]
)
# robot_description_content = xacro.process_file(os.path.join(get_package_share_directory('kuka_lbr_iisy_support'), 'urdf', 'lbr_iisy3_r760.urdf.xacro'))

robot_description = {'robot_description': robot_description_content}

Expand Down
9 changes: 5 additions & 4 deletions kuka_lbr_iisy_support/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@
<version>0.1.0</version>
<description>Package containing models of KUKA LBR iisy family</description>
<author>Aron Svastits</author>
<maintainer email="[email protected]"></maintainer>
<maintainer email="[email protected]">Áron Svastits</maintainer>
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>

<depend>xacro</depend>
<depend>launch_ros</depend>

<exec_depend>joint_state_publisher_gui</exec_depend>
<exec_depend>kuka_resources</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rviz2</exec_depend>

<test_depend>launch_testing_ament_cmake</test_depend>

<export>
<architecture_independent/>
<build_type>ament_cmake</build_type>
Expand Down
55 changes: 55 additions & 0 deletions kuka_lbr_iisy_support/test/test_lbr_iisy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2024 Áron Svastits
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

import launch
import launch.actions
import launch_testing.actions
import launch_testing.markers
import pytest
import os

from launch.launch_description_sources.python_launch_description_source import PythonLaunchDescriptionSource # noqa: E501
from launch.actions.include_launch_description import IncludeLaunchDescription
from ament_index_python.packages import get_package_share_directory


def list_test_launch_files():
files = [f for f in os.listdir(get_package_share_directory(
'kuka_lbr_iisy_support')+'/launch/') if f.endswith('.py')]
return files


# Launch all of the robot visualisation launch files one by one
@pytest.mark.launch_test
@launch_testing.markers.keep_alive
@launch_testing.parametrize('test_file', list_test_launch_files())
def generate_test_description(test_file):
list_test_launch_files()
return launch.LaunchDescription([
IncludeLaunchDescription(PythonLaunchDescriptionSource(
[get_package_share_directory('kuka_lbr_iisy_support'),
'/launch/', test_file])),
launch_testing.actions.ReadyToTest()
])


class TestModels(unittest.TestCase):

def test_read_stdout(self, proc_output):
# Check for frames defined by ROS-Industrial
proc_output.assertWaitFor('got segment base', timeout=5)
proc_output.assertWaitFor('got segment flange', timeout=5)
proc_output.assertWaitFor('got segment tool0', timeout=5)
36 changes: 7 additions & 29 deletions kuka_lbr_iiwa_support/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
cmake_minimum_required(VERSION 3.5)
project(kuka_lbr_iiwa_support)

# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
project(kuka_lbr_iiwa_support)

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(urdf REQUIRED)
find_package(xacro REQUIRED)

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

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
find_package(launch_testing_ament_cmake)
add_launch_test(test/test_lbr_iiwa.py)
endif()

ament_package()
14 changes: 11 additions & 3 deletions kuka_lbr_iiwa_support/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<depend>xacro</depend>
<depend>launch_ros</depend>

<exec_depend>joint_state_publisher_gui</exec_depend>
<exec_depend>kuka_resources</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rviz2</exec_depend>

<test_depend>launch_testing_ament_cmake</test_depend>

<export>
<architecture_independent/>
<build_type>ament_cmake</build_type>
</export>
</package>
</package>
Loading

0 comments on commit 46fba30

Please sign in to comment.