diff --git a/.github/workflows/backport.yaml b/.github/workflows/backport.yaml new file mode 100644 index 000000000..0b8bd9f97 --- /dev/null +++ b/.github/workflows/backport.yaml @@ -0,0 +1,29 @@ +--- +name: Backport + +on: + pull_request_target: + types: [closed] + workflow_dispatch: + inputs: + pr_number: + description: Pull request number to backport. Please add backport labels to the PR before running + this workflow. + required: true + +jobs: + backport: + name: Backport + runs-on: ubuntu-latest + if: > + (github.event_name == 'workflow_dispatch') || + ( + github.event_name == 'pull_request_target' && + github.event.pull_request.merged + ) + steps: + - uses: actions/checkout@v4 + - uses: korthout/backport-action@v3 + with: + github_token: ${{ secrets.GH_PAT }} + source_pr_number: ${{ inputs.pr_number || github.event.pull_request.number }} diff --git a/.github/workflows/release-project.yaml b/.github/workflows/release-project.yaml index bb0b47bc4..94465be3d 100644 --- a/.github/workflows/release-project.yaml +++ b/.github/workflows/release-project.yaml @@ -38,6 +38,7 @@ jobs: release_repository: name: Release repository + needs: variables uses: ./.github/workflows/release-repository.yaml with: release_candidate: ${{ needs.variables.outputs.RC_BRANCH_NAME }} @@ -114,5 +115,5 @@ jobs: owner: husarion repo: docs_new github_token: ${{ secrets.GH_PAT }} - workflow_file_name: build.yml + workflow_file_name: build.yaml ref: master diff --git a/.github/workflows/release-repository.yaml b/.github/workflows/release-repository.yaml index e8b892b65..30be9e333 100644 --- a/.github/workflows/release-repository.yaml +++ b/.github/workflows/release-repository.yaml @@ -118,5 +118,6 @@ jobs: - name: Update devel branch if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && inputs.automatic_mode }} run: | + git config pull.rebase false git pull origin ${{ env.MAIN_BRANCH }} git push origin ${{ env.DEVEL_BRANCH }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27b0be718..19e6b8787 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -81,7 +81,6 @@ repos: - id: ament_copyright name: ament_copyright description: Check if copyright notice is available in all files. - stages: [commit] entry: ament_copyright language: system diff --git a/ROS_API.md b/ROS_API.md index cfab3c3c5..ddde0d508 100644 --- a/ROS_API.md +++ b/ROS_API.md @@ -58,7 +58,7 @@ Below is information about the physical robot API. For the simulation, topics an | ✅ | ✅ | `lights_controller` | This node is responsible for processing animations and publishing frames to `light_driver` node.
[*husarion_ugv_lights/LightsControllerNode*](./husarion_ugv_lights/include/husarion_ugv_lights/lights_controller_node.hpp) | | ✅ | ❌ | `lights_driver` | This node is responsible for displaying frames on the robot's lights.
[*husarion_ugv_lights/LightsDriverNode*](./husarion_ugv_lights/include/husarion_ugv_lights/lights_driver_node.hpp) | | ✅ | ✅ | `lights_manager` | Node responsible for managing lights animation scheduling.
[husarion_ugv_manager/lights_manager](./husarion_ugv_manager/include/husarion_ugv_manager/lights_manager_node.hpp) | -| ✅ | ✅ | ⚙️ `navsat_transform` ⚙️ | It converts raw GPS data into odometry data and publishes corrected GPS positions based on sensor data at a higher frequency.
*[robot_localization/navsat_transform](https://github.com/cra-ros-pkg/robot_localization)* | +| ✅ | ✅ | ⚙️ `navsat_transform` ⚙️ | It converts raw GPS data into odometry data and publishes corrected GPS positions based on sensor data at a higher frequency.
*[robot_localization/navsat_transform](https://github.com/cra-ros-pkg/robot_localization)* | | ✅ | ✅ | `robot_state_publisher` | Broadcasts a robot's state to tf2 using a provided URDF model and joint states. It updates the model and broadcasts poses for fixed and movable joints to tf2 topics.
*[robot_state_publisher/robot_state_publisher](https://github.com/ros/robot_state_publisher)* | | ✅ | ❌ | `safety_manager` | Node responsible for managing safety features, and software shutdown of components.
*[husarion_ugv_manager/safety_manager_node](./husarion_ugv_manager/include/husarion_ugv_manager/safety_manager_node.hpp)* | | ✅ | ❌ | `system_monitor` | Publishes system state of the Built-in Computer such as CPU usage, RAM memory usage, disk usage and CPU temperature.
*[husarion_ugv_diagnostics/system_monitor_node](./husarion_ugv_diagnostics/include/husarion_ugv_diagnostics/system_monitor_node.hpp)* | diff --git a/husarion_ugv/CMakeLists.txt b/husarion_ugv/CMakeLists.txt index 358c65a23..c2c28db6e 100644 --- a/husarion_ugv/CMakeLists.txt +++ b/husarion_ugv/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv) find_package(ament_cmake REQUIRED) diff --git a/husarion_ugv_battery/CMakeLists.txt b/husarion_ugv_battery/CMakeLists.txt index 1d0e3b080..cc8be61ba 100644 --- a/husarion_ugv_battery/CMakeLists.txt +++ b/husarion_ugv_battery/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_battery) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/husarion_ugv_bringup/CMakeLists.txt b/husarion_ugv_bringup/CMakeLists.txt index 6fb4694db..1d55e54f8 100644 --- a/husarion_ugv_bringup/CMakeLists.txt +++ b/husarion_ugv_bringup/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_bringup) find_package(ament_cmake REQUIRED) diff --git a/husarion_ugv_controller/CMakeLists.txt b/husarion_ugv_controller/CMakeLists.txt index 9cf8423aa..0af66bce5 100644 --- a/husarion_ugv_controller/CMakeLists.txt +++ b/husarion_ugv_controller/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_controller) find_package(ament_cmake REQUIRED) diff --git a/husarion_ugv_description/CMakeLists.txt b/husarion_ugv_description/CMakeLists.txt index 9f7e7d4a7..bdcaf3918 100644 --- a/husarion_ugv_description/CMakeLists.txt +++ b/husarion_ugv_description/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_description) find_package(ament_cmake REQUIRED) diff --git a/husarion_ugv_description/launch/load_urdf.launch.py b/husarion_ugv_description/launch/load_urdf.launch.py index f2d3ac3da..1c809f245 100644 --- a/husarion_ugv_description/launch/load_urdf.launch.py +++ b/husarion_ugv_description/launch/load_urdf.launch.py @@ -33,6 +33,27 @@ def generate_launch_description(): + common_dir_path = LaunchConfiguration("common_dir_path") + declare_common_dir_path_arg = DeclareLaunchArgument( + "common_dir_path", + default_value="", + description="Path to the common configuration directory.", + ) + + description_pkg = FindPackageShare("husarion_ugv_description") + description_common_dir = PythonExpression( + [ + "'", + common_dir_path, + "/husarion_ugv_description", + "' if '", + common_dir_path, + "' else '", + description_pkg, + "'", + ] + ) + battery_config_path = LaunchConfiguration("battery_config_path") declare_battery_config_path_arg = DeclareLaunchArgument( "battery_config_path", @@ -46,9 +67,7 @@ def generate_launch_description(): components_config_path = LaunchConfiguration("components_config_path") declare_components_config_path_arg = DeclareLaunchArgument( "components_config_path", - default_value=PathJoinSubstitution( - [FindPackageShare("husarion_ugv_description"), "config", "components.yaml"] - ), + default_value=PathJoinSubstitution([description_common_dir, "config", "components.yaml"]), description=( "Specify file which contains components. These components will be included in URDF." "Available options can be found in manuals: https://husarion.com/manuals" @@ -176,6 +195,7 @@ def generate_launch_description(): ) actions = [ + declare_common_dir_path_arg, declare_battery_config_path_arg, declare_components_config_path_arg, declare_robot_model_arg, # robot_model is used by wheel_type diff --git a/husarion_ugv_description/urdf/common/gazebo.urdf.xacro b/husarion_ugv_description/urdf/common/gazebo.urdf.xacro index 6d2b65920..3ebcf5376 100644 --- a/husarion_ugv_description/urdf/common/gazebo.urdf.xacro +++ b/husarion_ugv_description/urdf/common/gazebo.urdf.xacro @@ -40,9 +40,6 @@ drive_controller/cmd_vel_unstamped:=cmd_vel drive_controller/odom:=odometry/wheels drive_controller/transition_event:=drive_controller/_transition_event - gz_ros2_control/e_stop:=hardware/e_stop - gz_ros2_control/e_stop_reset:=hardware/e_stop_reset - gz_ros2_control/e_stop_trigger:=hardware/e_stop_trigger imu_broadcaster/imu:=imu/data imu_broadcaster/transition_event:=imu_broadcaster/_transition_event joint_state_broadcaster/transition_event:=joint_state_broadcaster/_transition_event diff --git a/husarion_ugv_diagnostics/CMakeLists.txt b/husarion_ugv_diagnostics/CMakeLists.txt index 9f8d16e21..6be18209c 100644 --- a/husarion_ugv_diagnostics/CMakeLists.txt +++ b/husarion_ugv_diagnostics/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.11) # Handle superbuild first option(USE_SUPERBUILD "Whether or not a superbuild should be invoked" ON) diff --git a/husarion_ugv_diagnostics/cmake/SuperBuild.cmake b/husarion_ugv_diagnostics/cmake/SuperBuild.cmake index 83fdadbb3..b7df4febb 100644 --- a/husarion_ugv_diagnostics/cmake/SuperBuild.cmake +++ b/husarion_ugv_diagnostics/cmake/SuperBuild.cmake @@ -26,7 +26,10 @@ ExternalProject_Add( PREFIX ${CMAKE_CURRENT_BINARY_DIR}/ep_cppuprofile BUILD_COMMAND $(MAKE) -C INSTALL_COMMAND make install INSTALL_PREFIX= + # DCMAKE_POLICY_VERSION_MINIMUM is required because of using external + # `cppuprofile` repo in the diagnostics pkg CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 BUILD_IN_SOURCE 1) ExternalProject_Add( diff --git a/husarion_ugv_gazebo/CMakeLists.txt b/husarion_ugv_gazebo/CMakeLists.txt index 9241457f4..d0c84d515 100644 --- a/husarion_ugv_gazebo/CMakeLists.txt +++ b/husarion_ugv_gazebo/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_gazebo) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/husarion_ugv_gazebo/config/gz_bridge.yaml b/husarion_ugv_gazebo/config/gz_bridge.yaml index 73980e649..113ddf702 100644 --- a/husarion_ugv_gazebo/config/gz_bridge.yaml +++ b/husarion_ugv_gazebo/config/gz_bridge.yaml @@ -5,26 +5,3 @@ ros_type_name: rosgraph_msgs/msg/Clock gz_type_name: gz.msgs.Clock direction: GZ_TO_ROS - -- ros_topic_name: battery/battery_status - gz_topic_name: /model//battery//battery/state - ros_type_name: sensor_msgs/msg/BatteryState - gz_type_name: gz.msgs.BatteryState - direction: GZ_TO_ROS - -- topic_name: cmd_vel - ros_type_name: geometry_msgs/msg/Twist - gz_type_name: gz.msgs.Twist - direction: GZ_TO_ROS - -- ros_topic_name: lights/channel_1_frame - gz_topic_name: /lights/channel_1_frame - ros_type_name: sensor_msgs/msg/Image - gz_type_name: gz.msgs.Image - direction: ROS_TO_GZ - -- ros_topic_name: lights/channel_2_frame - gz_topic_name: /lights/channel_2_frame - ros_type_name: sensor_msgs/msg/Image - gz_type_name: gz.msgs.Image - direction: ROS_TO_GZ diff --git a/husarion_ugv_gazebo/config/robot_bridge.yaml b/husarion_ugv_gazebo/config/robot_bridge.yaml new file mode 100644 index 000000000..8a466b02f --- /dev/null +++ b/husarion_ugv_gazebo/config/robot_bridge.yaml @@ -0,0 +1,23 @@ +# For detailed information on configuring the parameter_bridge, please refer to: +# https://github.com/gazebosim/ros_gz/tree/ros2/ros_gz_bridge#example-5-configuring-the-bridge-via-yaml + +- ros_topic_name: //battery/battery_status + gz_topic_name: /model//battery//battery/state + ros_type_name: sensor_msgs/msg/BatteryState + gz_type_name: gz.msgs.BatteryState + direction: GZ_TO_ROS + +- topic_name: //cmd_vel + ros_type_name: geometry_msgs/msg/TwistStamped + gz_type_name: gz.msgs.Twist + direction: GZ_TO_ROS + +- topic_name: //lights/channel_1_frame + ros_type_name: sensor_msgs/msg/Image + gz_type_name: gz.msgs.Image + direction: ROS_TO_GZ + +- topic_name: //lights/channel_2_frame + ros_type_name: sensor_msgs/msg/Image + gz_type_name: gz.msgs.Image + direction: ROS_TO_GZ diff --git a/husarion_ugv_gazebo/include/husarion_ugv_gazebo/estop_system.hpp b/husarion_ugv_gazebo/include/husarion_ugv_gazebo/estop_system.hpp index ca3bba438..e5f7cf0bb 100644 --- a/husarion_ugv_gazebo/include/husarion_ugv_gazebo/estop_system.hpp +++ b/husarion_ugv_gazebo/include/husarion_ugv_gazebo/estop_system.hpp @@ -35,7 +35,7 @@ using TriggerSrv = std_srvs::srv::Trigger; /** * @brief Main class for the Husarion UGV which implements a simulated `ros2_control` - * `hardware_interface::SystemInterface`. This class inherits `gz_ros2_control::GazeboSystem` + * `hardware_interface::SystemInterface`. This class inherits `gz_ros2_control::GazeboSimSystem` * and implements additional functionalities like E-stop handling. */ class EStopSystem : public gz_ros2_control::GazeboSimSystem diff --git a/husarion_ugv_gazebo/launch/simulate_robot.launch.py b/husarion_ugv_gazebo/launch/simulate_robot.launch.py index ee881f4d2..41fb29cf8 100644 --- a/husarion_ugv_gazebo/launch/simulate_robot.launch.py +++ b/husarion_ugv_gazebo/launch/simulate_robot.launch.py @@ -80,7 +80,7 @@ def generate_launch_description(): declare_gz_bridge_config_path_arg = DeclareLaunchArgument( "gz_bridge_config_path", default_value=PathJoinSubstitution( - [FindPackageShare("husarion_ugv_gazebo"), "config", "gz_bridge.yaml"] + [FindPackageShare("husarion_ugv_gazebo"), "config", "robot_bridge.yaml"] ), description="Path to the parameter_bridge configuration file.", ) @@ -204,10 +204,10 @@ def generate_launch_description(): ) model_name = PythonExpression(["'", namespace, "' if '", namespace, "' else 'panther'"]) - + ns = PythonExpression(["'", namespace, "' + '/' if '", namespace, "' else ''"]) namespaced_gz_bridge_config_path = ReplaceString( source_file=gz_bridge_config_path, - replacements={"": model_name, "": namespace, "//": "/"}, + replacements={"": model_name, "/": ns}, ) gz_bridge = Node( diff --git a/husarion_ugv_gazebo/launch/simulation.launch.py b/husarion_ugv_gazebo/launch/simulation.launch.py index c42c4716f..00c68ed84 100644 --- a/husarion_ugv_gazebo/launch/simulation.launch.py +++ b/husarion_ugv_gazebo/launch/simulation.launch.py @@ -23,7 +23,7 @@ LaunchConfiguration, PathJoinSubstitution, ) -from launch_ros.actions import SetUseSimTime +from launch_ros.actions import Node, SetUseSimTime from launch_ros.substitutions import FindPackageShare from nav2_common.launch import ReplaceString @@ -76,30 +76,40 @@ def generate_launch_description(): launch_arguments={"gz_gui": namespaced_gz_gui, "gz_log_level": "1"}.items(), ) - rviz_launch = IncludeLaunchDescription( + gz_bridge_config = PathJoinSubstitution( + [FindPackageShare("husarion_ugv_gazebo"), "config", "gz_bridge.yaml"] + ) + gz_bridge = Node( + package="ros_gz_bridge", + executable="parameter_bridge", + name="gz_bridge", + parameters=[{"config_file": gz_bridge_config}], + ) + + simulate_robots = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [ - FindPackageShare("husarion_ugv_description"), + FindPackageShare("husarion_ugv_gazebo"), "launch", - "rviz.launch.py", + "simulate_robot.launch.py", ] ) ), - condition=IfCondition(use_rviz), + launch_arguments={"log_level": log_level}.items(), ) - simulate_robots = IncludeLaunchDescription( + rviz_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [ - FindPackageShare("husarion_ugv_gazebo"), + FindPackageShare("husarion_ugv_description"), "launch", - "simulate_robot.launch.py", + "rviz.launch.py", ] ) ), - launch_arguments={"log_level": log_level}.items(), + condition=IfCondition(use_rviz), ) actions = [ @@ -107,11 +117,11 @@ def generate_launch_description(): declare_log_level_arg, declare_namespace_arg, declare_use_rviz_arg, - # Sets use_sim_time for all nodes started below (doesn't work for nodes started from ignition gazebo) SetUseSimTime(True), gz_sim, - rviz_launch, + gz_bridge, simulate_robots, + rviz_launch, ] return LaunchDescription(actions) diff --git a/husarion_ugv_hardware_interfaces/CMakeLists.txt b/husarion_ugv_hardware_interfaces/CMakeLists.txt index 59499edf9..92992fdf7 100644 --- a/husarion_ugv_hardware_interfaces/CMakeLists.txt +++ b/husarion_ugv_hardware_interfaces/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) # Handle superbuild first option(USE_SUPERBUILD "Whether or not a superbuild should be invoked" ON) @@ -110,8 +110,9 @@ if(BUILD_TESTING) ${PROJECT_NAME}_test_roboteq_data_converters PUBLIC $ $) - ament_target_dependencies(${PROJECT_NAME}_test_roboteq_data_converters - husarion_ugv_msgs husarion_ugv_utils) + ament_target_dependencies( + ${PROJECT_NAME}_test_roboteq_data_converters ament_index_cpp + husarion_ugv_msgs husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_roboteq_data_converters PkgConfig::LIBLELY_COAPP) @@ -121,7 +122,7 @@ if(BUILD_TESTING) src/robot_system/gpio/gpio_controller.cpp src/robot_system/gpio/gpio_driver.cpp) ament_target_dependencies(${PROJECT_NAME}_test_gpiod_controller - husarion_ugv_utils) + ament_index_cpp husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_gpiod_controller PkgConfig::LIBGPIOD) @@ -142,6 +143,7 @@ if(BUILD_TESTING) $) ament_target_dependencies( ${PROJECT_NAME}_test_ugv_system + ament_index_cpp diagnostic_updater hardware_interface rclcpp @@ -270,8 +272,9 @@ if(BUILD_TESTING) ${PROJECT_NAME}_test_canopen_manager PUBLIC $ $) - ament_target_dependencies(${PROJECT_NAME}_test_canopen_manager rclcpp - husarion_ugv_msgs husarion_ugv_utils) + ament_target_dependencies( + ${PROJECT_NAME}_test_canopen_manager ament_index_cpp rclcpp + husarion_ugv_msgs husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_canopen_manager PkgConfig::LIBLELY_COAPP) @@ -288,8 +291,9 @@ if(BUILD_TESTING) ${PROJECT_NAME}_test_lynx_robot_driver PUBLIC $ $) - ament_target_dependencies(${PROJECT_NAME}_test_lynx_robot_driver rclcpp - husarion_ugv_msgs husarion_ugv_utils) + ament_target_dependencies( + ${PROJECT_NAME}_test_lynx_robot_driver ament_index_cpp rclcpp + husarion_ugv_msgs husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_lynx_robot_driver PkgConfig::LIBLELY_COAPP) @@ -306,8 +310,9 @@ if(BUILD_TESTING) ${PROJECT_NAME}_test_panther_robot_driver PUBLIC $ $) - ament_target_dependencies(${PROJECT_NAME}_test_panther_robot_driver rclcpp - husarion_ugv_msgs husarion_ugv_utils) + ament_target_dependencies( + ${PROJECT_NAME}_test_panther_robot_driver ament_index_cpp rclcpp + husarion_ugv_msgs husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_panther_robot_driver PkgConfig::LIBLELY_COAPP) @@ -321,8 +326,9 @@ if(BUILD_TESTING) ${PROJECT_NAME}_test_roboteq_driver PUBLIC $ $) - ament_target_dependencies(${PROJECT_NAME}_test_roboteq_driver rclcpp - husarion_ugv_msgs husarion_ugv_utils) + ament_target_dependencies( + ${PROJECT_NAME}_test_roboteq_driver ament_index_cpp rclcpp + husarion_ugv_msgs husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_roboteq_driver PkgConfig::LIBLELY_COAPP) @@ -338,8 +344,9 @@ if(BUILD_TESTING) ${PROJECT_NAME}_test_roboteq_robot_driver PUBLIC $ $) - ament_target_dependencies(${PROJECT_NAME}_test_roboteq_robot_driver rclcpp - husarion_ugv_msgs husarion_ugv_utils) + ament_target_dependencies( + ${PROJECT_NAME}_test_roboteq_robot_driver ament_index_cpp rclcpp + husarion_ugv_msgs husarion_ugv_utils) target_link_libraries(${PROJECT_NAME}_test_roboteq_robot_driver PkgConfig::LIBLELY_COAPP) diff --git a/husarion_ugv_hardware_interfaces/src/robot_system/system_ros_interface.cpp b/husarion_ugv_hardware_interfaces/src/robot_system/system_ros_interface.cpp index 3bc1ec356..7c6022796 100644 --- a/husarion_ugv_hardware_interfaces/src/robot_system/system_ros_interface.cpp +++ b/husarion_ugv_hardware_interfaces/src/robot_system/system_ros_interface.cpp @@ -83,18 +83,19 @@ SystemROSInterface::SystemROSInterface( executor_thread_ = std::thread([this]() { executor_->spin(); }); - driver_state_publisher_ = node_->create_publisher("~/robot_driver_state", 5); + driver_state_publisher_ = node_->create_publisher( + "hardware/robot_driver_state", 5); realtime_driver_state_publisher_ = std::make_unique>( driver_state_publisher_); io_state_publisher_ = node_->create_publisher( - "~/io_state", rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable()); + "hardware/io_state", rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable()); realtime_io_state_publisher_ = std::make_unique>(io_state_publisher_); e_stop_state_publisher_ = node_->create_publisher( - "~/e_stop", rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable()); + "hardware/e_stop", rclcpp::QoS(rclcpp::KeepLast(1)).transient_local().reliable()); realtime_e_stop_state_publisher_ = std::make_unique>(e_stop_state_publisher_); diff --git a/husarion_ugv_hardware_interfaces/src/robot_system/ugv_system.cpp b/husarion_ugv_hardware_interfaces/src/robot_system/ugv_system.cpp index 3a8357ce4..0aeb9d6f5 100644 --- a/husarion_ugv_hardware_interfaces/src/robot_system/ugv_system.cpp +++ b/husarion_ugv_hardware_interfaces/src/robot_system/ugv_system.cpp @@ -113,32 +113,33 @@ CallbackReturn UGVSystem::on_activate(const rclcpp_lifecycle::State &) system_ros_interface_ = std::make_unique("hardware_controller"); system_ros_interface_->AddService>( - "~/fan_enable", + "hardware/fan_enable", std::bind(&GPIOControllerInterface::FanEnable, gpio_controller_, std::placeholders::_1)); system_ros_interface_->AddService>( - "~/aux_power_enable", + "hardware/aux_power_enable", std::bind(&GPIOControllerInterface::AUXPowerEnable, gpio_controller_, std::placeholders::_1)); system_ros_interface_->AddService>( - "~/digital_power_enable", + "hardware/digital_power_enable", std::bind( &GPIOControllerInterface::DigitalPowerEnable, gpio_controller_, std::placeholders::_1)); system_ros_interface_->AddService>( - "~/charger_enable", + "hardware/charger_enable", std::bind(&GPIOControllerInterface::ChargerEnable, gpio_controller_, std::placeholders::_1)); system_ros_interface_->AddService>( - "~/led_control_enable", + "hardware/led_control_enable", std::bind(&GPIOControllerInterface::LEDControlEnable, gpio_controller_, std::placeholders::_1)); system_ros_interface_->AddService>( - "~/motor_torque_enable", std::bind(&UGVSystem::MotorTorqueEnable, this, std::placeholders::_1)); + "hardware/motor_torque_enable", + std::bind(&UGVSystem::MotorTorqueEnable, this, std::placeholders::_1)); system_ros_interface_->AddService>( - "~/e_stop_trigger", std::bind(&EStopInterface::TriggerEStop, e_stop_), 1, + "hardware/e_stop_trigger", std::bind(&EStopInterface::TriggerEStop, e_stop_), 1, rclcpp::CallbackGroupType::MutuallyExclusive); auto e_stop_reset_qos = rmw_qos_profile_services_default; e_stop_reset_qos.depth = 1; system_ros_interface_->AddService>( - "~/e_stop_reset", std::bind(&EStopInterface::ResetEStop, e_stop_), 2, + "hardware/e_stop_reset", std::bind(&EStopInterface::ResetEStop, e_stop_), 2, rclcpp::CallbackGroupType::MutuallyExclusive, e_stop_reset_qos); system_ros_interface_->AddDiagnosticTask( diff --git a/husarion_ugv_hardware_interfaces/test/integration/phidget_imu_sensor/test_phidget_imu_sensor.cpp b/husarion_ugv_hardware_interfaces/test/integration/phidget_imu_sensor/test_phidget_imu_sensor.cpp index d7dad3fe2..ec1fc8363 100644 --- a/husarion_ugv_hardware_interfaces/test/integration/phidget_imu_sensor/test_phidget_imu_sensor.cpp +++ b/husarion_ugv_hardware_interfaces/test/integration/phidget_imu_sensor/test_phidget_imu_sensor.cpp @@ -133,7 +133,7 @@ class TestPhidgetImuSensor : public testing::Test { public: TestPhidgetImuSensor(); - ~TestPhidgetImuSensor(); + ~TestPhidgetImuSensor() {} void CreateResourceManagerFromUrdf(const std::string & urdf); @@ -183,6 +183,7 @@ class TestPhidgetImuSensor : public testing::Test inline static const std::string kUrdfHeader = R"( + )"; @@ -210,19 +211,18 @@ class TestPhidgetImuSensor : public testing::Test std::unique_ptr imu_sensor_; std::shared_ptr rm_; + std::shared_ptr node_ = std::make_shared("PhidgetIMUTest"); }; TestPhidgetImuSensor::TestPhidgetImuSensor() { imu_sensor_ = std::make_unique(); - rclcpp::init(0, nullptr); } -TestPhidgetImuSensor::~TestPhidgetImuSensor() { rclcpp::shutdown(); } - void TestPhidgetImuSensor::CreateResourceManagerFromUrdf(const std::string & urdf) { - rm_ = std::make_shared(urdf); + rm_ = std::make_unique( + urdf, node_->get_node_clock_interface(), node_->get_node_logging_interface()); } hardware_interface::return_type TestPhidgetImuSensor::ConfigurePhidgetImu() @@ -563,7 +563,7 @@ TEST_F(TestPhidgetImuSensor, CheckStatesInitialValues) auto loaded_state_interfaces = ClaimGoodStateInterfaces(); for (const auto & state_interface : loaded_state_interfaces) { - EXPECT_TRUE(std::isnan(state_interface.get_value())); + EXPECT_TRUE(std::isnan(state_interface.get_optional().value())); } EXPECT_EQ(ShutdownPhidgetImu(), return_type::OK); @@ -593,7 +593,7 @@ TEST_F(TestPhidgetImuSensor, CheckReadAndConfigureRealSensor) auto loaded_state_interfaces = ClaimGoodStateInterfaces(); for (const auto & state_interface : loaded_state_interfaces) { - EXPECT_TRUE(std::isfinite(state_interface.get_value())); + EXPECT_TRUE(std::isfinite(state_interface.get_optional().value())); } EXPECT_EQ(UnconfigurePhidgetImu(), return_type::OK); @@ -602,7 +602,11 @@ TEST_F(TestPhidgetImuSensor, CheckReadAndConfigureRealSensor) int main(int argc, char ** argv) { + rclcpp::init(argc, argv); testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); + auto run_tests = RUN_ALL_TESTS(); + + rclcpp::shutdown(); + return run_tests; } diff --git a/husarion_ugv_lights/CMakeLists.txt b/husarion_ugv_lights/CMakeLists.txt index 8585e8a32..176c4d6d4 100644 --- a/husarion_ugv_lights/CMakeLists.txt +++ b/husarion_ugv_lights/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_lights) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/husarion_ugv_localization/CMakeLists.txt b/husarion_ugv_localization/CMakeLists.txt index 2ce65ec9f..9e67f4327 100644 --- a/husarion_ugv_localization/CMakeLists.txt +++ b/husarion_ugv_localization/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_localization) find_package(ament_cmake REQUIRED) diff --git a/husarion_ugv_manager/CMakeLists.txt b/husarion_ugv_manager/CMakeLists.txt index 9918ea99f..f3b784a0a 100644 --- a/husarion_ugv_manager/CMakeLists.txt +++ b/husarion_ugv_manager/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_manager) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/husarion_ugv_manager/test/plugins/condition/test_check_bool_msg.cpp b/husarion_ugv_manager/test/plugins/condition/test_check_bool_msg.cpp index a18920442..13f7d24dc 100644 --- a/husarion_ugv_manager/test/plugins/condition/test_check_bool_msg.cpp +++ b/husarion_ugv_manager/test/plugins/condition/test_check_bool_msg.cpp @@ -85,10 +85,11 @@ TEST_F(TestCheckBoolMsg, OnTickBehavior) for (auto & test_case : test_cases) { CreateTree(PLUGIN, test_case.input); - PublishMsg(test_case.msg); - auto & tree = GetTree(); - auto status = tree.tickWhileRunning(); + auto status = tree.tickOnce(); + + PublishMsg(test_case.msg); + status = tree.tickWhileRunning(); EXPECT_EQ(status, test_case.result); } diff --git a/husarion_ugv_manager/test/plugins/condition/test_check_joy_msg.cpp b/husarion_ugv_manager/test/plugins/condition/test_check_joy_msg.cpp index cfb0478f4..d2f29b5fd 100644 --- a/husarion_ugv_manager/test/plugins/condition/test_check_joy_msg.cpp +++ b/husarion_ugv_manager/test/plugins/condition/test_check_joy_msg.cpp @@ -103,12 +103,13 @@ TEST_F(TestCheckJoyMsg, TimeoutTests) for (auto & test_case : test_cases) { CreateTree(PLUGIN, test_case.input); + auto & tree = GetTree(); + auto status = tree.tickOnce(); + SetCurrentMsgTime(test_case.msg); std::this_thread::sleep_for(std::chrono::milliseconds(2)); PublishMsg(test_case.msg); - - auto & tree = GetTree(); - auto status = tree.tickWhileRunning(); + status = tree.tickWhileRunning(); EXPECT_EQ(status, test_case.result); } @@ -168,11 +169,12 @@ TEST_F(TestCheckJoyMsg, OnTickBehavior) for (auto & test_case : test_cases) { CreateTree(PLUGIN, test_case.input); + auto & tree = GetTree(); + auto status = tree.tickOnce(); + SetCurrentMsgTime(test_case.msg); PublishMsg(test_case.msg); - - auto & tree = GetTree(); - auto status = tree.tickWhileRunning(); + status = tree.tickOnce(); EXPECT_EQ(status, test_case.result); } diff --git a/husarion_ugv_manager/test/plugins/test_shutdown_host.cpp b/husarion_ugv_manager/test/plugins/test_shutdown_host.cpp index 13e8c1ec6..8887ecc8d 100644 --- a/husarion_ugv_manager/test/plugins/test_shutdown_host.cpp +++ b/husarion_ugv_manager/test/plugins/test_shutdown_host.cpp @@ -118,10 +118,10 @@ TEST_F(TestShutdownHost, HTTPServerNotAvailable) husarion_ugv_manager::ShutdownHostState::COMMAND_EXECUTED) { this->shutdown_host_->Call(); } + ASSERT_EQ(this->shutdown_host_->GetState(), husarion_ugv_manager::ShutdownHostState::FAILURE); EXPECT_TRUE(this->ContainsExpression(this->shutdown_host_->GetError(), "Command return code:")); EXPECT_TRUE(this->ContainsExpression(this->shutdown_host_->GetOutput(), "000")); - EXPECT_TRUE(this->ContainsExpression(this->shutdown_host_->GetOutput(), "Connection refused")); } TEST_F(TestShutdownHost, GoodShutdownExecute) diff --git a/husarion_ugv_msgs/CMakeLists.txt b/husarion_ugv_msgs/CMakeLists.txt index 8c5bf209c..6e38260f2 100644 --- a/husarion_ugv_msgs/CMakeLists.txt +++ b/husarion_ugv_msgs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_msgs) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/husarion_ugv_utils/CMakeLists.txt b/husarion_ugv_utils/CMakeLists.txt index ff8f4c01b..afbcf78c6 100644 --- a/husarion_ugv_utils/CMakeLists.txt +++ b/husarion_ugv_utils/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.11) project(husarion_ugv_utils) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")