WATANABE Aoi 2023-01-10
Merge pull request #22 from HarvestX/feat/bringup
add separated bringup files
@f7c5ce39fddf72093c1282dfd71b36a89a3f4211
.github/workflows/ci_galactic.yml
--- .github/workflows/ci_galactic.yml
+++ .github/workflows/ci_galactic.yml
@@ -34,6 +34,7 @@
           target-ros2-distro: ${{ matrix.ros_distribution }}
           import-token: ${{ secrets.GITHUB_TOKEN }}
           package-name: |
+            p9n_bringup
             p9n_interface
             p9n_example
             p9n_test
(파일 끝에 줄바꿈 문자 없음)
.github/workflows/ci_humble.yml
--- .github/workflows/ci_humble.yml
+++ .github/workflows/ci_humble.yml
@@ -34,6 +34,7 @@
           target-ros2-distro: ${{ matrix.ros_distribution }}
           import-token: ${{ secrets.GITHUB_TOKEN }}
           package-name: |
+            p9n_bringup
             p9n_interface
             p9n_example
             p9n_test
(파일 끝에 줄바꿈 문자 없음)
.vscode/cspell.json
--- .vscode/cspell.json
+++ .vscode/cspell.json
@@ -10,12 +10,13 @@
     "dualshock",
     "m12watanabe1a",
     "rclcpp",
+    "remappings",
     "roboteq",
     "rosdistro",
     "rosidl",
     "rviz",
     "teleop",
     "urdf",
-    "xacro",
+    "xacro"
   ]
-}
(파일 끝에 줄바꿈 문자 없음)
+}
 
p9n_bringup/launch/teleop.launch.py (added)
+++ p9n_bringup/launch/teleop.launch.py
@@ -0,0 +1,64 @@
+# Copyright 2022 HarvestX Inc.
+#
+# 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.
+
+from launch import LaunchDescription
+from launch.actions import DeclareLaunchArgument
+from launch.substitutions import LaunchConfiguration
+from launch.substitutions import TextSubstitution
+from launch_ros.actions import ComposableNodeContainer
+from launch_ros.descriptions import ComposableNode
+
+
+def generate_launch_description():
+    """Generate launch description."""
+    hw_type_arg = DeclareLaunchArgument(
+        'hw_type', default_value=TextSubstitution(text='DualSense'))
+    topic_name_arg = DeclareLaunchArgument(
+        'topic_name', default_value=TextSubstitution(text='cmd_vel'))
+
+    joy_container = ComposableNodeContainer(
+        name='joy_container',
+        package='rclcpp_components',
+        executable='component_container',
+        namespace='',
+        composable_node_descriptions=[
+            ComposableNode(
+                package='joy',
+                plugin='joy::Joy',
+                name='joy',
+                namespace='',
+            ),
+            ComposableNode(
+                package='p9n_node',
+                plugin='p9n_node::TeleopTwistJoyNode',
+                name='teleop_twist_joy_node',
+                namespace='',
+                parameters=[{
+                        'hw_type': LaunchConfiguration('hw_type')
+                }],
+                remappings=[
+                    ('cmd_vel', LaunchConfiguration('topic_name'))
+                ],
+            )
+        ],
+    )
+
+    ld = LaunchDescription()
+
+    ld.add_action(hw_type_arg)
+    ld.add_action(topic_name_arg)
+
+    ld.add_action(joy_container)
+
+    return ld
 
p9n_bringup/p9n_bringup/__init__.py (added)
+++ p9n_bringup/p9n_bringup/__init__.py
@@ -0,0 +1,0 @@
 
p9n_bringup/package.xml (added)
+++ p9n_bringup/package.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
+<package format="3">
+  <name>p9n_bringup</name>
+  <version>0.0.0</version>
+  <description>PlayStation Interface Node Launch Files.</description>
+  <maintainer email="40206149+m12watanabe1a@users.noreply.github.com">m12watanabe1a</maintainer>
+  <license>Apache License 2.0</license>
+
+  <test_depend>ament_copyright</test_depend>
+  <test_depend>ament_flake8</test_depend>
+  <test_depend>ament_pep257</test_depend>
+  <test_depend>python3-pytest</test_depend>
+
+  <export>
+    <build_type>ament_python</build_type>
+  </export>
+</package>
 
p9n_bringup/resource/p9n_bringup (added)
+++ p9n_bringup/resource/p9n_bringup
@@ -0,0 +1,0 @@
 
p9n_bringup/setup.cfg (added)
+++ p9n_bringup/setup.cfg
@@ -0,0 +1,4 @@
+[develop]
+script_dir=$base/lib/p9n_bringup
+[install]
+install_scripts=$base/lib/p9n_bringup
 
p9n_bringup/setup.py (added)
+++ p9n_bringup/setup.py
@@ -0,0 +1,29 @@
+"""Setup."""
+from glob import glob
+
+from setuptools import setup
+
+package_name = 'p9n_bringup'
+
+setup(
+    name=package_name,
+    version='0.0.0',
+    packages=[package_name],
+    data_files=[
+        ('share/ament_index/resource_index/packages',
+            ['resource/' + package_name]),
+        ('share/' + package_name, ['package.xml']),
+        ('share/{}/launch'.format(package_name), glob('launch/*.launch.py')),
+    ],
+    install_requires=['setuptools'],
+    zip_safe=True,
+    maintainer='m12watanabe1a',
+    maintainer_email='40206149+m12watanabe1a@users.noreply.github.com',
+    description='PlayStation Interface Node Launch Files.',
+    license='Apache License 2.0',
+    tests_require=['pytest'],
+    entry_points={
+        'console_scripts': [
+        ],
+    },
+)
 
p9n_bringup/test/test_flake8.py (added)
+++ p9n_bringup/test/test_flake8.py
@@ -0,0 +1,25 @@
+# Copyright 2017 Open Source Robotics Foundation, Inc.
+#
+# 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.
+
+from ament_flake8.main import main_with_errors
+import pytest
+
+
+@pytest.mark.flake8
+@pytest.mark.linter
+def test_flake8():
+    rc, errors = main_with_errors(argv=[])
+    assert rc == 0, \
+        'Found %d code style errors / warnings:\n' % len(errors) + \
+        '\n'.join(errors)
 
p9n_bringup/test/test_pep257.py (added)
+++ p9n_bringup/test/test_pep257.py
@@ -0,0 +1,23 @@
+# Copyright 2015 Open Source Robotics Foundation, Inc.
+#
+# 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.
+
+from ament_pep257.main import main
+import pytest
+
+
+@pytest.mark.linter
+@pytest.mark.pep257
+def test_pep257():
+    rc = main(argv=['.', 'test'])
+    assert rc == 0, 'Found code style errors / warnings'
p9n_node/CMakeLists.txt
--- p9n_node/CMakeLists.txt
+++ p9n_node/CMakeLists.txt
@@ -25,4 +25,4 @@
   ament_lint_auto_find_test_dependencies()
 endif()
 
-ament_auto_package(INSTALL_TO_SHARE launch)
+ament_auto_package()
 
p9n_node/launch/teleop.launch.py (deleted)
--- p9n_node/launch/teleop.launch.py
@@ -1,60 +0,0 @@
-# Copyright 2022 HarvestX Inc.
-#
-# 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.
-
-from launch import LaunchDescription
-from launch.actions import DeclareLaunchArgument
-from launch.substitutions import (
-    LaunchConfiguration,
-    TextSubstitution,
-)
-
-from launch_ros.actions import ComposableNodeContainer
-from launch_ros.descriptions import ComposableNode
-
-
-def generate_launch_description():
-    """Generate launch description."""
-    launch_args = [
-        DeclareLaunchArgument(
-            'hw_type',
-            default_value=TextSubstitution(text='DualSense')
-        )
-    ]
-    nodes = [
-        ComposableNodeContainer(
-            name='joy_container',
-            package='rclcpp_components',
-            executable='component_container',
-            namespace='',
-            composable_node_descriptions=[
-                ComposableNode(
-                    package='joy',
-                    plugin='joy::Joy',
-                    name='joy',
-                    namespace='',
-                ),
-                ComposableNode(
-                    package='p9n_node',
-                    plugin='p9n_node::TeleopTwistJoyNode',
-                    name='teleop_twist_joy_node',
-                    namespace='',
-                    parameters=[{
-                        'hw_type': LaunchConfiguration('hw_type')
-                    }],
-                )
-            ],
-        ),
-    ]
-
-    return LaunchDescription(launch_args + nodes)
Add a comment
List