Skip to content

Commit

Permalink
Implement and adapt RosSystem tests for the new attribute ComponentSt…
Browse files Browse the repository at this point in the history
…acks
  • Loading branch information
ipa-rwu authored and ipa-nhg committed Aug 26, 2021
1 parent e4f53e6 commit e9279c9
Show file tree
Hide file tree
Showing 15 changed files with 328 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
RosSystem { Name 'test_stacks'
RosComponentStacks (
ComponentStack {
name stack1
RosComponents (
ComponentInterface { name test_node
FromRosNode "test_pkg.test_node.test_node"
RosPublishers{ RosPublisher "scan" { RefPublisher "test_pkg.test_node.test_node.scan"} }
RosSubscribers{ RosSubscriber "power_state" { RefSubscriber "test_pkg.test_node.test_node.power_state"} }
RosSrvServers{ RosServiceServer "setBool" { RefServer "test_pkg.test_node.test_node.setBool"} }
RosSrvClients{ RosServiceClient "init" { RefClient "test_pkg.test_node.test_node.init"} }
RosParameters{ RosParameter "string_test" { RefParameter "test_pkg.test_node.test_node.string_test"},
RosParameter "bool_tets" { RefParameter "test_pkg.test_node.test_node.bool_tets"},
RosParameter "array_tets" { RefParameter "test_pkg.test_node.test_node.array_tets"},
RosParameter "base64_test" { RefParameter "test_pkg.test_node.test_node.base64_test"},
RosParameter "double_test" { RefParameter "test_pkg.test_node.test_node.double_test"},
RosParameter "int_test" { RefParameter "test_pkg.test_node.test_node.int_test"},
RosParameter "list_test" { RefParameter "test_pkg.test_node.test_node.list_test"}}},
ComponentInterface { name test_node2 NameSpace test2
FromRosNode "test_pkg.test_node.test_node"
RosPublishers { RosPublisher "scan" { RefPublisher "test_pkg.test_node.test_node.scan" } }
RosSubscribers { RosSubscriber "power_state" { RefSubscriber "test_pkg.test_node.test_node.power_state" } }
RosSrvServers { RosServiceServer "setBool" { RefServer "test_pkg.test_node.test_node.setBool" } }
RosSrvClients { RosServiceClient "init" { RefClient "test_pkg.test_node.test_node.init" } }
RosParameters { RosParameter "string_test" { RefParameter "test_pkg.test_node.test_node.string_test" } ,
RosParameter "bool_tets" { RefParameter "test_pkg.test_node.test_node.bool_tets" } ,
RosParameter "array_tets" { RefParameter "test_pkg.test_node.test_node.array_tets" } ,
RosParameter "base64_test" { RefParameter "test_pkg.test_node.test_node.base64_test" } ,
RosParameter "double_test" { RefParameter "test_pkg.test_node.test_node.double_test" } ,
RosParameter "int_test" { RefParameter "test_pkg.test_node.test_node.int_test" } ,
RosParameter "list_test" { RefParameter "test_pkg.test_node.test_node.list_test" }}})},
ComponentStack {
name stack2
RosComponents (
ComponentInterface { name test_nodea
RosPublishers { RosPublisher power_state { RefPublisher "test_pkg.test_node.test_node.power_state" } }
RosSubscribers { RosSubscriber scan { RefSubscriber "test_pkg.test_node.test_node.scan" } }
RosSrvServers { RosServiceServer init { RefServer "test_pkg.test_node.test_node.init" } }
RosSrvClients { RosServiceClient SetBool { RefClient "test_pkg.test_node.test_node.SetBool" }}}
)
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.3"
networks:
ros:
driver: bridge

services:
ros-master:
image: ros:melodic-ros-core
command: stdbuf -o L roscore
networks:
- ros

test_stacks_stack1:
image: "test_stacks_stack1:latest"
depends_on:
- ros-master
environment:
- "ROS_MASTER_URI=http://ros-master:11311"
- "ROS_HOSTNAME=stack1"
networks:
- ros
command: stdbuf -o L roslaunch test_stacks_stack1 stack1.launch --wait

test_stacks_stack2:
image: "test_stacks_stack2:latest"
depends_on:
- ros-master
environment:
- "ROS_MASTER_URI=http://ros-master:11311"
- "ROS_HOSTNAME=stack2"
networks:
- ros
command: stdbuf -o L roslaunch test_stacks_stack2 stack2.launch --wait


Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8.3)
project(test_stacks_stack1)

find_package(catkin REQUIRED)

catkin_package()


### INSTALL ###
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# syntax=docker/dockerfile:experimental
ARG SUFFIX=
ARG PREFIX=
FROM ros:melodic-ros-core as base
FROM ${PREFIX}builder${SUFFIX} as builder

FROM base as build
COPY . /root/ws/src/test_stacks_stack1/
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash build_workspace /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM build as test
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash test_workspace /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM build as install
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash install_workspace /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM install as full
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash install_depends /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM base as deploy
RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \
apt-get update -qq && \
/builder/workspace.bash install_depends /root/ws && \
rm -rf /var/lib/apt/lists/*
COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO

FROM deploy as launch
CMD ["roslaunch", "test_stacks_stack1", "stack1.launch"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<launch>

<node pkg="test_pkg" type="test_node" name="test_node" cwd="node" respawn="false" output="screen">
</node>
<node pkg="test_pkg" type="test_node" name="test_node2" ns="test2" cwd="node" respawn="false" output="screen">
</node>

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<package format="2">
<name>test_stacks_stack1</name>
<version>0.0.1</version>
<description>This package provides launch file for operating test_stacks_stack1</description>

<license>Apache 2.0</license>

<url type="website">http://wiki.ros.org/</url>


<maintainer email="[email protected]">Jane Doe</maintainer>
<author email="[email protected]">Jane Doe</author>

<buildtool_depend>catkin</buildtool_depend>
<exec_depend>test_pkg</exec_depend>
<!--test_depend>roslaunch</test_depend-->

</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8.3)
project(test_stacks_stack2)

find_package(catkin REQUIRED)

catkin_package()


### INSTALL ###
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# syntax=docker/dockerfile:experimental
ARG SUFFIX=
ARG PREFIX=
FROM ros:melodic-ros-core as base
FROM ${PREFIX}builder${SUFFIX} as builder

FROM base as build
COPY . /root/ws/src/test_stacks_stack2/
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash build_workspace /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM build as test
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash test_workspace /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM build as install
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash install_workspace /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM install as full
RUN --mount=type=bind,from=builder,target=/builder \
apt-get update -qq && \
/builder/workspace.bash install_depends /root/ws && \
rm -rf /var/lib/apt/lists/*

FROM base as deploy
RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \
apt-get update -qq && \
/builder/workspace.bash install_depends /root/ws && \
rm -rf /var/lib/apt/lists/*
COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO

FROM deploy as launch
CMD ["roslaunch", "test_stacks_stack2", "stack2.launch"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<launch>

<node pkg="test_pkg" type="test_node" name="test_nodea" cwd="node" respawn="false" output="screen">
</node>

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<package format="2">
<name>test_stacks_stack2</name>
<version>0.0.1</version>
<description>This package provides launch file for operating test_stacks_stack2</description>

<license>Apache 2.0</license>

<url type="website">http://wiki.ros.org/</url>


<maintainer email="[email protected]">Jane Doe</maintainer>
<author email="[email protected]">Jane Doe</author>

<buildtool_depend>catkin</buildtool_depend>
<exec_depend>test_pkg</exec_depend>
<!--test_depend>roslaunch</test_depend-->

</package>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0"?>
<launch>
<param name="param1" value="hello"/>
<rosparam param="list">[1,2,a]</rosparam>
<rosparam param="list">[1,3]</rosparam>
<rosparam>
<param name="param1" value="hello"/>
<rosparam param="list">[1,2,a]</rosparam>
<rosparam param="list">[1,3]</rosparam>
<rosparam>
first_element: 8
third_element: dsd
</rosparam>
</rosparam>

<node pkg="test_pkg" type="test_node" name="test_node" cwd="node" respawn="false" output="screen">
<remap from='scan' to='scan_rename' />
</node>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<maintainer email="[email protected]">Jane Doe</maintainer>
<author email="[email protected]">Jane Doe</author>


<buildtool_depend>catkin</buildtool_depend>
<exec_depend>test_pkg</exec_depend>
<!--test_depend>roslaunch</test_depend-->
Expand Down
Loading

0 comments on commit e9279c9

Please sign in to comment.