From a7b6cdd30f179f49eeb44051ef52b2bd1ca5c045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Str=C3=B8m?= Date: Thu, 8 Aug 2024 16:36:27 +0200 Subject: [PATCH] Remove setup.py and minor lifecycle callback changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christopher Strøm --- mission/system_monitor/CMakeLists.txt | 10 ++++++- mission/system_monitor/package.xml | 2 ++ mission/system_monitor/setup.py | 26 ------------------- .../system_monitor_node.py | 0 .../thruster_allocator/src/allocator_ros.cpp | 6 ++--- 5 files changed, 14 insertions(+), 30 deletions(-) delete mode 100644 mission/system_monitor/setup.py rename mission/system_monitor/{scripts => system_monitor}/system_monitor_node.py (100%) diff --git a/mission/system_monitor/CMakeLists.txt b/mission/system_monitor/CMakeLists.txt index 0290a85f..d5dd4386 100644 --- a/mission/system_monitor/CMakeLists.txt +++ b/mission/system_monitor/CMakeLists.txt @@ -12,7 +12,7 @@ ament_python_install_package(${PROJECT_NAME}) # Install Python executables install(PROGRAMS - scripts/system_monitor_node.py + system_monitor/system_monitor_node.py DESTINATION lib/${PROJECT_NAME} ) @@ -23,4 +23,12 @@ install(DIRECTORY DESTINATION share/${PROJECT_NAME} ) +# Install the package.xml file +install(FILES package.xml DESTINATION share/${PROJECT_NAME}) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + ament_package() \ No newline at end of file diff --git a/mission/system_monitor/package.xml b/mission/system_monitor/package.xml index 572e89a4..717985cd 100644 --- a/mission/system_monitor/package.xml +++ b/mission/system_monitor/package.xml @@ -8,6 +8,7 @@ TODO: License declaration ament_cmake + ament_cmake_python launch_ros launch @@ -16,6 +17,7 @@ ament_lint_auto ament_lint_common + ament_cmake diff --git a/mission/system_monitor/setup.py b/mission/system_monitor/setup.py deleted file mode 100644 index 7f8e7692..00000000 --- a/mission/system_monitor/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -from setuptools import setup - -package_name = 'system_monitor' - -setup( - name=package_name, - version='0.0.1', - packages=[package_name], - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='Your Name', - maintainer_email='your.email@example.com', - description='System Monitor for ROS2', - license='TODO: License declaration', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'system_monitor_node = system_monitor.system_monitor_node:main' - ], - }, -) \ No newline at end of file diff --git a/mission/system_monitor/scripts/system_monitor_node.py b/mission/system_monitor/system_monitor/system_monitor_node.py similarity index 100% rename from mission/system_monitor/scripts/system_monitor_node.py rename to mission/system_monitor/system_monitor/system_monitor_node.py diff --git a/motion/thruster_allocator/src/allocator_ros.cpp b/motion/thruster_allocator/src/allocator_ros.cpp index e6677548..f7d5c508 100644 --- a/motion/thruster_allocator/src/allocator_ros.cpp +++ b/motion/thruster_allocator/src/allocator_ros.cpp @@ -68,9 +68,6 @@ ThrusterAllocator::on_deactivate(const rclcpp_lifecycle::State &) { rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn ThrusterAllocator::on_cleanup(const rclcpp_lifecycle::State &) { - thruster_forces_publisher_.reset(); - wrench_subscriber_.reset(); - calculate_thrust_timer_.reset(); RCLCPP_INFO(get_logger(), "Thruster allocator cleaned up"); return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface:: CallbackReturn::SUCCESS; @@ -78,6 +75,9 @@ ThrusterAllocator::on_cleanup(const rclcpp_lifecycle::State &) { rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn ThrusterAllocator::on_shutdown(const rclcpp_lifecycle::State &) { + thruster_forces_publisher_.reset(); + wrench_subscriber_.reset(); + calculate_thrust_timer_.reset(); RCLCPP_INFO(get_logger(), "Thruster allocator shutting down"); return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface:: CallbackReturn::SUCCESS;