-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add file and folder structure for ros2_python_pkg template
- Loading branch information
Showing
15 changed files
with
213 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...g/{% if has_action_server %}{{ package_name }}_interfaces{% endif %}/CMakeLists.txt.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project({{ package_name }}_interfaces) | ||
|
||
find_package(rosidl_default_generators REQUIRED) | ||
|
||
rosidl_generate_interfaces(${PROJECT_NAME} | ||
action/Fibonacci.action | ||
) | ||
|
||
ament_export_dependencies(rosidl_default_runtime) | ||
|
||
ament_package() |
5 changes: 5 additions & 0 deletions
5
...% if has_action_server %}{{ package_name }}_interfaces{% endif %}/action/Fibonacci.action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
int32 order | ||
--- | ||
int32[] sequence | ||
--- | ||
int32[] partial_sequence |
24 changes: 24 additions & 0 deletions
24
..._pkg/{% if has_action_server %}{{ package_name }}_interfaces{% endif %}/package.xml.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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>{{ package_name }}_interfaces</name> | ||
<version>0.0.0</version> | ||
<description>ROS interface definitions for {{ package_name }}</description> | ||
|
||
<maintainer email="{{ maintainer_email }}">{{ maintainer }}</maintainer> | ||
<author email="{{ author_email }}">{{ author }}</author> | ||
|
||
<license>{{ license }}</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
<build_depend>rosidl_default_generators</build_depend> | ||
<exec_depend>rosidl_default_runtime</exec_depend> | ||
|
||
<member_of_group>rosidl_interface_packages</member_of_group> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
|
||
</package> |
22 changes: 22 additions & 0 deletions
22
templates/ros2_python_pkg/{{ package_name }}/package.xml.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?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>{{ package_name }}</name> | ||
<version>0.0.0</version> | ||
<description>{{ description }}</description> | ||
|
||
<maintainer email="{{ maintainer_email }}">{{ maintainer }}</maintainer> | ||
<author email="{{ author_email }}">{{ author }}</author> | ||
|
||
<license>{{ license }}</license> | ||
|
||
<buildtool_depend>ament_python</buildtool_depend> | ||
|
||
<depend>rclpy</depend> | ||
|
||
<export> | ||
<build_type>ament_python</build_type> | ||
</export> | ||
|
||
</package> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[develop] | ||
script_dir=$base/lib/{{ package_name }} | ||
[install] | ||
install_scripts=$base/lib/{{ package_name }} |
29 changes: 29 additions & 0 deletions
29
templates/ros2_python_pkg/{{ package_name }}/setup.py.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
from glob import glob | ||
from setuptools import setup | ||
|
||
package_name = '{{ package_name }}' | ||
|
||
setup( | ||
name=package_name, | ||
version='0.0.0', | ||
packages=[package_name], | ||
data_files=[('share/ament_index/resource_index/packages', | ||
['resource/' + package_name]), | ||
(os.path.join('share', package_name), ['package.xml']), | ||
(os.path.join('share', package_name, | ||
'launch'), glob('launch/*launch.[pxy][yma]*')), | ||
(os.path.join('share', package_name, | ||
'config'), glob('config/*.yaml'))], | ||
install_requires=['setuptools'], | ||
zip_safe=True, | ||
maintainer='root', | ||
maintainer_email='root@todo.todo', | ||
description='TODO: Package description', | ||
license='TODO: License declaration', | ||
tests_require=['pytest'], | ||
entry_points={ | ||
'console_scripts': | ||
['{{ node_name }} = {{ package_name }}.{{ node_name }}:main'], | ||
}, | ||
) |
8 changes: 8 additions & 0 deletions
8
...ros2_python_pkg/{{ package_name }}/{% if has_docker_ros %}.gitlab-ci.yml{% endif %}.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include: | ||
- remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/main/.gitlab-ci/docker-ros.yml | ||
|
||
variables: | ||
PLATFORM: amd64,arm64 | ||
TARGET: dev,run | ||
BASE_IMAGE: rwthika/ros2:latest | ||
COMMAND: ros2 run {{ package_name }} {{ node_name }} |
42 changes: 42 additions & 0 deletions
42
...ch{% endif %}/{% if launch_file_type == 'py' %}{{ node_name }}_launch.py{% endif %}.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
|
||
from ament_index_python import get_package_share_directory | ||
from launch import LaunchDescription | ||
{% if is_lifecycle %} | ||
from launch.actions import DeclareLaunchArgument, GroupAction | ||
from launch.conditions import LaunchConfigurationNotEquals | ||
from launch.substitutions import LaunchConfiguration | ||
from launch_ros.actions import LifecycleNode, SetParameter | ||
{% else %} | ||
from launch.actions import DeclareLaunchArgument | ||
from launch.substitutions import LaunchConfiguration | ||
from launch_ros.actions import Node | ||
{% endif %} | ||
|
||
|
||
def generate_launch_description(): | ||
|
||
arg_name = DeclareLaunchArgument("name", default_value="{{ node_name }}", description="node name") | ||
arg_namespace = DeclareLaunchArgument("namespace", default_value="", description="node namespace") | ||
|
||
node = Node( | ||
package="{{ package_name }}", | ||
executable="{{ node_name }}", | ||
namespace=LaunchConfiguration("namespace"), | ||
name=LaunchConfiguration("name"), | ||
{% if has_params %} | ||
parameters=[ | ||
os.path.join(get_package_share_directory("{{ package_name }}"), "config", "params.yml"), | ||
], | ||
{% endif %} | ||
output="screen", | ||
emulate_tty=True, | ||
) | ||
|
||
return LaunchDescription([ | ||
arg_name, | ||
arg_namespace, | ||
node | ||
]) |
12 changes: 12 additions & 0 deletions
12
...{% endif %}/{% if launch_file_type == 'xml' %}{{ node_name }}_launch.xml{% endif %}.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<launch> | ||
|
||
<arg name="name" default="{{ node_name }}" description="node name" /> | ||
<arg name="namespace" default="" description="node namespace" /> | ||
|
||
<node pkg="{{ package_name }}" exec="{{ node_name }}" namespace="$(var namespace)" name="$(var name)" output="screen"> | ||
{% if has_params %} | ||
<param from="$(find-pkg-share {{ package_name }})/config/params.yml" /> | ||
{% endif %} | ||
</node> | ||
|
||
</launch> |
20 changes: 20 additions & 0 deletions
20
...{% endif %}/{% if launch_file_type == 'yml' %}{{ node_name }}_launch.yml{% endif %}.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
launch: | ||
- arg: | ||
name: name | ||
default: {{ node_name }} | ||
description: node name | ||
- arg: | ||
name: namespace | ||
default: "" | ||
description: node namespace | ||
- node: | ||
pkg: {{ package_name }} | ||
exec: {{ node_name }} | ||
namespace: "$(var namespace)" | ||
name: "$(var name)" | ||
output: screen | ||
{% if has_params %} | ||
param: | ||
- name: param | ||
value: 1.0 | ||
{% endif %} |
3 changes: 3 additions & 0 deletions
3
.../ros2_python_pkg/{{ package_name }}/{% if has_params %}config{% endif %}/params.yml.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/**/*: | ||
ros__parameters: | ||
param: 1.0 |
Empty file.
19 changes: 19 additions & 0 deletions
19
templates/ros2_python_pkg/{{ package_name }}/{{ package_name }}/{{ node_name }}.py.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import rclpy | ||
|
||
from rclpy import Node | ||
|
||
|
||
class {{ node_class_name }}(Node): | ||
def __init__(self): | ||
pass | ||
|
||
|
||
def main(): | ||
|
||
rclpy.init() | ||
rclpy.spin({{ node_class_name }}()) | ||
rclpy.shutdown() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |