diff --git a/src/lane_path_detection/.gitignore b/src/lane_path_detection/.gitignore new file mode 100644 index 0000000000..3c2880a52b --- /dev/null +++ b/src/lane_path_detection/.gitignore @@ -0,0 +1,21 @@ +# ROS2工作空间临时文件(核心忽略项) +build/ +install/ +log/ +.colcon* +.ros/ + +# Python缓存文件 +__pycache__/ +*.pyc +*.pyo +*.pyd + +# Windows系统文件 +Thumbs.db +Desktop.ini + +# IDE/编辑器配置(可选,根据自己使用的工具加) +.vscode/ +.idea/ +*.sublime-* \ No newline at end of file diff --git a/src/lane_path_detection/package.xml b/src/lane_path_detection/package.xml new file mode 100644 index 0000000000..6607bf9e87 --- /dev/null +++ b/src/lane_path_detection/package.xml @@ -0,0 +1,28 @@ + + + + + lane_path_detection + 0.0.0 + ROS2 package for lane path detection + + rosli + Apache-2.0 + + + ament_python + rclpy + rclpy + + + sensor_msgs + visualization_msgs + + + ament_lint_auto + ament_lint_common + + + ament_python + + diff --git a/src/lane_path_detection/resource/lane_path_detection b/src/lane_path_detection/resource/lane_path_detection new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/lane_path_detection/setup.cfg b/src/lane_path_detection/setup.cfg new file mode 100644 index 0000000000..e8765a618e --- /dev/null +++ b/src/lane_path_detection/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script-dir=$base/lib/lane_path_detection +[install] +install-scripts=$base/lib/lane_path_detection diff --git a/src/lane_path_detection/setup.py b/src/lane_path_detection/setup.py new file mode 100644 index 0000000000..3cc84c1b68 --- /dev/null +++ b/src/lane_path_detection/setup.py @@ -0,0 +1,34 @@ +from setuptools import setup, find_packages +import os +from glob import glob + +package_name = 'lane_path_detection' + +setup( + name=package_name, + version='0.0.0', + # 自动查找所有子模块(适配你的目录结构) + packages=find_packages(exclude=['test']), + # 声明源码目录为当前目录 + package_dir={'': '.'}, + # 资源文件配置(保留你的原有逻辑) + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + (os.path.join('share', package_name, 'resource'), glob('resource/*')), + ], + # ROS2节点入口点(关键:关联main.py的main函数) + entry_points={ + 'console_scripts': [ + 'lane_path_detection_node = lane_path_detection.main:main', + ], + }, + install_requires=['setuptools'], + zip_safe=True, + maintainer='rosli', + maintainer_email='rosli@todo.todo', + description='Lane path detection node for ROS2', + license='Apache-2.0', + tests_require=['pytest'], +) diff --git a/src/lane_path_detection/test/test_copyright.py b/src/lane_path_detection/test/test_copyright.py new file mode 100644 index 0000000000..cc8ff03f79 --- /dev/null +++ b/src/lane_path_detection/test/test_copyright.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_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/src/lane_path_detection/test/test_flake8.py b/src/lane_path_detection/test/test_flake8.py new file mode 100644 index 0000000000..27ee1078ff --- /dev/null +++ b/src/lane_path_detection/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) diff --git a/src/lane_path_detection/test/test_pep257.py b/src/lane_path_detection/test/test_pep257.py new file mode 100644 index 0000000000..b234a3840f --- /dev/null +++ b/src/lane_path_detection/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'