From 9ecc71860967b216c95e72d94fb09524c7a92383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20H=C3=B6nig?= Date: Thu, 17 Nov 2022 08:50:08 +0100 Subject: [PATCH] Issue87 (#111) * examples: switch to cmake for symlink-install Workaround for https://github.com/colcon/colcon-core/issues/407 Fixes #87 --- .github/workflows/ci-ros2.yml | 5 ++++- crazyflie_examples/CMakeLists.txt | 19 +++++++++++++++++ crazyflie_examples/package.xml | 5 ++++- crazyflie_examples/setup.cfg | 10 +++++---- crazyflie_examples/setup.py | 35 ------------------------------- docs2/tutorials.rst | 5 ----- 6 files changed, 33 insertions(+), 46 deletions(-) create mode 100644 crazyflie_examples/CMakeLists.txt delete mode 100644 crazyflie_examples/setup.py diff --git a/.github/workflows/ci-ros2.yml b/.github/workflows/ci-ros2.yml index 39186e030..513d860f3 100644 --- a/.github/workflows/ci-ros2.yml +++ b/.github/workflows/ci-ros2.yml @@ -73,6 +73,9 @@ jobs: - name: build and test ROS 2 uses: ros-tooling/action-ros-ci@v0.2 with: - package-name: crazyflie crazyflie_interfaces + package-name: | + crazyflie + crazyflie_examples + crazyflie_interfaces target-ros2-distro: ${{ matrix.ros_distribution }} vcs-repo-file-url: rosinstall \ No newline at end of file diff --git a/crazyflie_examples/CMakeLists.txt b/crazyflie_examples/CMakeLists.txt new file mode 100644 index 000000000..9ea4389cd --- /dev/null +++ b/crazyflie_examples/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.8) +project(crazyflie_examples) + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(ament_cmake_python REQUIRED) + +# Install Python modules +ament_python_install_package(${PROJECT_NAME} SCRIPTS_DESTINATION lib/${PROJECT_NAME}) + +# Install launch and config files. +install(DIRECTORY + config + data + launch + DESTINATION share/${PROJECT_NAME}/ +) + +ament_package() diff --git a/crazyflie_examples/package.xml b/crazyflie_examples/package.xml index c280be6ce..04015c337 100644 --- a/crazyflie_examples/package.xml +++ b/crazyflie_examples/package.xml @@ -7,6 +7,9 @@ Wolfgang Hönig, Kimberly McGuire MIT + ament_cmake + ament_cmake_python + rclpy crazyflie_py @@ -16,6 +19,6 @@ python3-pytest - ament_python + ament_cmake diff --git a/crazyflie_examples/setup.cfg b/crazyflie_examples/setup.cfg index 4ad112eaf..e2443cc06 100644 --- a/crazyflie_examples/setup.cfg +++ b/crazyflie_examples/setup.cfg @@ -1,4 +1,6 @@ -[develop] -script_dir=$base/lib/crazyflie_examples -[install] -install_scripts=$base/lib/crazyflie_examples +[options.entry_points] +console_scripts = + hello_world = crazyflie_examples.hello_world:main + nice_hover = crazyflie_examples.nice_hover:main + figure8 = crazyflie_examples.figure8:main + cmd_full_state = crazyflie_examples.cmd_full_state:main \ No newline at end of file diff --git a/crazyflie_examples/setup.py b/crazyflie_examples/setup.py deleted file mode 100644 index 71b4a20d6..000000000 --- a/crazyflie_examples/setup.py +++ /dev/null @@ -1,35 +0,0 @@ -from setuptools import setup -import os -from glob import glob - -package_name = 'crazyflie_examples' - -setup( - name=package_name, - version='2.0.0', - packages=[package_name], - package_data={'package_name': ['data/*.csv']}, - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - (os.path.join('share', package_name), glob('launch/*launch.py')), - (os.path.join('share', package_name), glob('config/*')), - (os.path.join('share', package_name, 'data'), glob('data/*')) - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='Wolfgang Hönig, Kimberly McGuire', - maintainer_email='hoenig@tu-berlin.de', - description='Examples for Crayzswarm2 ROS stack', - license='MIT', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'hello_world = crazyflie_examples.hello_world:main', - 'nice_hover = crazyflie_examples.nice_hover:main', - 'figure8 = crazyflie_examples.figure8:main', - 'cmd_full_state = crazyflie_examples.cmd_full_state:main', - ], - }, -) diff --git a/docs2/tutorials.rst b/docs2/tutorials.rst index cab52ed22..560bc9fb3 100644 --- a/docs2/tutorials.rst +++ b/docs2/tutorials.rst @@ -264,8 +264,6 @@ Once you are happy, you can save the map with 'Save Map' in the SLAM toolbox pan If not, you could tweak with the parameters of the `SLAM toolbox `_ to get a better result. -.. warning:: - Anything you change in the launch file, you'll need to reinstall with 'colcon build --symlink-install' in the ros2_ws folder Connecting with Nav2 Bringup ---------------------------- @@ -387,9 +385,6 @@ Also try it out by putting obstacles along the path of the crazyflie like in the As you noticed, the movement around the obstacles are pretty conservative. You can tune the values in /config/nav2_params.yaml, like the global or local planner's inflation_layer or the size of the robot. Please check out `NAV2's tuning documentation `_ for more explanation of these values. -.. warning:: - Anything you change in the launch, config and data file, you'll need to reinstall with 'colcon build --symlink-install' in the ros2_ws folder. This is due to `this unresolved issue in colcon_core `_. - .. note:: Final note. The SLAM performance and navigation performance of the Crazyflie with the multiranger is doable but not perfect. We absolutely encourage you to tweak and tune the parameters to get something better! (And if you do, please share :D)