From 30c3281ab5be79253cae7967300291b65116958f Mon Sep 17 00:00:00 2001 From: arshPratap Date: Sat, 19 Aug 2023 15:47:19 +0530 Subject: [PATCH] Tools : Added custom ROS-2 serivce definition for switching drive modes --- Tools/ros2/ardupilot_msgs/CMakeLists.txt | 1 + Tools/ros2/ardupilot_msgs/srv/ModeSwitch.srv | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 Tools/ros2/ardupilot_msgs/srv/ModeSwitch.srv diff --git a/Tools/ros2/ardupilot_msgs/CMakeLists.txt b/Tools/ros2/ardupilot_msgs/CMakeLists.txt index 5887179c4eb711..5a56bd31cc3572 100644 --- a/Tools/ros2/ardupilot_msgs/CMakeLists.txt +++ b/Tools/ros2/ardupilot_msgs/CMakeLists.txt @@ -12,6 +12,7 @@ find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} "srv/ArmMotors.srv" + "srv/ModeSwitch.srv" ADD_LINTER_TESTS ) diff --git a/Tools/ros2/ardupilot_msgs/srv/ModeSwitch.srv b/Tools/ros2/ardupilot_msgs/srv/ModeSwitch.srv new file mode 100644 index 00000000000000..7ecbf9671f8b9c --- /dev/null +++ b/Tools/ros2/ardupilot_msgs/srv/ModeSwitch.srv @@ -0,0 +1,15 @@ + +# This service requests the vehicle to switch its drive/flight mode + +# mode : Set the value to the drive/flight mode to be used +# Copter : https://github.com/ArduPilot/ardupilot/blob/master/ArduCopter/mode.h +# Rover : https://github.com/ArduPilot/ardupilot/blob/master/Rover/mode.h +# Plane : https://github.com/ArduPilot/ardupilot/blob/master/ArduPlane/mode.h + +uint8 mode +--- +# status : True if the request for mode switch was successful, False otherwise +# curr_mode : Returns the code for the current drive/flight mode , after the processing the request + +bool status +uint8 curr_mode