From 37bf72e014cec40cc4325985b0c7340bdf2e5ee8 Mon Sep 17 00:00:00 2001 From: pranavpshah Date: Wed, 14 Feb 2024 16:38:17 -0500 Subject: [PATCH 1/3] kr_mav_msgs ROS2 compatible --- kr_mav_msgs/CMakeLists.txt | 59 ++++++++++++++++------------- kr_mav_msgs/msg/MotorRPM.msg | 2 +- kr_mav_msgs/msg/OutputData.msg | 2 +- kr_mav_msgs/msg/PWMCommand.msg | 2 +- kr_mav_msgs/msg/PositionCommand.msg | 2 +- kr_mav_msgs/msg/SO3Command.msg | 6 +-- kr_mav_msgs/msg/Serial.msg | 2 +- kr_mav_msgs/msg/StatusData.msg | 2 +- kr_mav_msgs/msg/TRPYCommand.msg | 6 +-- kr_mav_msgs/package.xml | 21 +++++++--- 10 files changed, 60 insertions(+), 44 deletions(-) diff --git a/kr_mav_msgs/CMakeLists.txt b/kr_mav_msgs/CMakeLists.txt index 382ca75f..e7c19daa 100644 --- a/kr_mav_msgs/CMakeLists.txt +++ b/kr_mav_msgs/CMakeLists.txt @@ -1,34 +1,41 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.8) project(kr_mav_msgs) -# set default build type -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo) +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) endif() -find_package(catkin REQUIRED COMPONENTS message_generation geometry_msgs) +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(std_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) find_package(Eigen3 REQUIRED) -add_message_files( - DIRECTORY - msg - FILES - AuxCommand.msg - Corrections.msg - MotorRPM.msg - OutputData.msg - PWMCommand.msg - PositionCommand.msg - SO3Command.msg - Serial.msg - StatusData.msg - TRPYCommand.msg) +find_package(rosidl_default_generators REQUIRED) +rosidl_generate_interfaces(${PROJECT_NAME} +"msg/AuxCommand.msg" +"msg/Corrections.msg" +"msg/MotorRPM.msg" +"msg/OutputData.msg" +"msg/PositionCommand.msg" +"msg/PWMCommand.msg" +"msg/Serial.msg" +"msg/SO3Command.msg" +"msg/StatusData.msg" +"msg/TRPYCommand.msg" +DEPENDENCIES builtin_interfaces std_msgs geometry_msgs +) -generate_messages(DEPENDENCIES geometry_msgs) +ament_export_dependencies(rosidl_default_runtime) -catkin_package( - CATKIN_DEPENDS - geometry_msgs - message_runtime - DEPENDS - EIGEN3) +ament_package() diff --git a/kr_mav_msgs/msg/MotorRPM.msg b/kr_mav_msgs/msg/MotorRPM.msg index 36593c9c..9f3e2255 100644 --- a/kr_mav_msgs/msg/MotorRPM.msg +++ b/kr_mav_msgs/msg/MotorRPM.msg @@ -1,3 +1,3 @@ -Header header +std_msgs/Header header uint8 motor_count int16[8] rpm diff --git a/kr_mav_msgs/msg/OutputData.msg b/kr_mav_msgs/msg/OutputData.msg index 66eb8d4d..e4cf0222 100644 --- a/kr_mav_msgs/msg/OutputData.msg +++ b/kr_mav_msgs/msg/OutputData.msg @@ -1,4 +1,4 @@ -Header header +std_msgs/Header header uint16 loop_rate float64 voltage geometry_msgs/Quaternion orientation diff --git a/kr_mav_msgs/msg/PWMCommand.msg b/kr_mav_msgs/msg/PWMCommand.msg index e8e1d0a8..ec0631c2 100644 --- a/kr_mav_msgs/msg/PWMCommand.msg +++ b/kr_mav_msgs/msg/PWMCommand.msg @@ -1,3 +1,3 @@ -Header header +std_msgs/Header header # pwm values should be between 0 (1ms pulse width) and 1 (2ms pulse width) float64[2] pwm diff --git a/kr_mav_msgs/msg/PositionCommand.msg b/kr_mav_msgs/msg/PositionCommand.msg index 59625905..80634879 100644 --- a/kr_mav_msgs/msg/PositionCommand.msg +++ b/kr_mav_msgs/msg/PositionCommand.msg @@ -1,4 +1,4 @@ -Header header +std_msgs/Header header geometry_msgs/Point position geometry_msgs/Vector3 velocity geometry_msgs/Vector3 acceleration diff --git a/kr_mav_msgs/msg/SO3Command.msg b/kr_mav_msgs/msg/SO3Command.msg index 015d90ea..61c4cb99 100644 --- a/kr_mav_msgs/msg/SO3Command.msg +++ b/kr_mav_msgs/msg/SO3Command.msg @@ -1,7 +1,7 @@ -Header header +std_msgs/Header header geometry_msgs/Vector3 force geometry_msgs/Quaternion orientation geometry_msgs/Vector3 angular_velocity kr_mav_msgs/AuxCommand aux -float64[3] kR -float64[3] kOm +float64[3] kr +float64[3] kom diff --git a/kr_mav_msgs/msg/Serial.msg b/kr_mav_msgs/msg/Serial.msg index 3e6d466c..bacb338e 100644 --- a/kr_mav_msgs/msg/Serial.msg +++ b/kr_mav_msgs/msg/Serial.msg @@ -6,7 +6,7 @@ uint8 PWM_CMD = 119 # 'w' in base 10 uint8 STATUS_DATA = 99 # 'c' in base 10 uint8 OUTPUT_DATA = 100 # 'd' in base 10 -Header header +std_msgs/Header header uint8 channel uint8 type # One of the types listed above uint8[] data diff --git a/kr_mav_msgs/msg/StatusData.msg b/kr_mav_msgs/msg/StatusData.msg index d176e4f0..2b17fc12 100644 --- a/kr_mav_msgs/msg/StatusData.msg +++ b/kr_mav_msgs/msg/StatusData.msg @@ -1,4 +1,4 @@ -Header header +std_msgs/Header header uint16 loop_rate float64 voltage uint8 seq diff --git a/kr_mav_msgs/msg/TRPYCommand.msg b/kr_mav_msgs/msg/TRPYCommand.msg index f11efb18..1024ecdd 100644 --- a/kr_mav_msgs/msg/TRPYCommand.msg +++ b/kr_mav_msgs/msg/TRPYCommand.msg @@ -1,9 +1,9 @@ -Header header +std_msgs/Header header float64 thrust float64 roll float64 pitch float64 yaw geometry_msgs/Vector3 angular_velocity -float64[3] kR -float64[3] kOm +float64[3] kr +float64[3] kom kr_mav_msgs/AuxCommand aux diff --git a/kr_mav_msgs/package.xml b/kr_mav_msgs/package.xml index 963c645a..160ca018 100644 --- a/kr_mav_msgs/package.xml +++ b/kr_mav_msgs/package.xml @@ -1,19 +1,28 @@ - + kr_mav_msgs 1.0.0 kr_mav_msgs Kartik Mohta Michael Watterson Justin Thomas + Kashish Garg BSD - Kartik Mohta - catkin - + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + std_msgs geometry_msgs - message_generation - message_runtime + action_msgs + + ament_lint_auto + ament_lint_common + + + ament_cmake + From cef46f665a8b48decf14accf646e425a75567c8b Mon Sep 17 00:00:00 2001 From: pranavpshah Date: Wed, 14 Feb 2024 16:52:56 -0500 Subject: [PATCH 2/3] kr_tracker_msgs ROS2 humble compatible --- trackers/kr_tracker_msgs/CMakeLists.txt | 84 +++++++++++-------- .../action/CircleTracker.action | 8 +- .../kr_tracker_msgs/action/LineTracker.action | 4 +- trackers/kr_tracker_msgs/package.xml | 23 +++-- 4 files changed, 72 insertions(+), 47 deletions(-) diff --git a/trackers/kr_tracker_msgs/CMakeLists.txt b/trackers/kr_tracker_msgs/CMakeLists.txt index 7a0a1902..a4c7c384 100644 --- a/trackers/kr_tracker_msgs/CMakeLists.txt +++ b/trackers/kr_tracker_msgs/CMakeLists.txt @@ -1,38 +1,54 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.8) project(kr_tracker_msgs) -# set default build type -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE RelWithDebInfo) +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) endif() -find_package(catkin REQUIRED COMPONENTS message_generation nav_msgs geometry_msgs actionlib_msgs) - -add_service_files(DIRECTORY srv FILES Transition.srv) - -add_action_files( - DIRECTORY - action - FILES - LineTracker.action - VelocityTracker.action - CircleTracker.action - TrajectoryTracker.action - LissajousTracker.action - LissajousAdder.action) - -add_message_files( - DIRECTORY - msg - FILES - TrackerStatus.msg - VelocityGoal.msg) - -generate_messages(DEPENDENCIES geometry_msgs actionlib_msgs) - -catkin_package( - CATKIN_DEPENDS - nav_msgs - geometry_msgs - actionlib_msgs - message_runtime) +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(std_msgs REQUIRED) +find_package(builtin_interfaces REQUIRED) +find_package(geometry_msgs REQUIRED) + +find_package(rosidl_default_generators REQUIRED) +rosidl_generate_interfaces(${PROJECT_NAME} +"msg/TrackerStatus.msg" +"msg/VelocityGoal.msg" + +"srv/Transition.srv" + +"action/CircleTracker.action" +"action/LineTracker.action" +"action/LissajousAdder.action" +"action/LissajousTracker.action" +"action/TrajectoryTracker.action" +"action/VelocityTracker.action" + +DEPENDENCIES std_msgs builtin_interfaces geometry_msgs +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/trackers/kr_tracker_msgs/action/CircleTracker.action b/trackers/kr_tracker_msgs/action/CircleTracker.action index 305a70b7..b6e14b3f 100644 --- a/trackers/kr_tracker_msgs/action/CircleTracker.action +++ b/trackers/kr_tracker_msgs/action/CircleTracker.action @@ -1,7 +1,7 @@ #goal definition -float64 Ax -float64 Ay -float64 T +float64 ax +float64 ay +float64 t float64 duration --- #result definition @@ -12,4 +12,4 @@ float64 length --- #feedback # time in tracker -float64 duration \ No newline at end of file +float64 duration diff --git a/trackers/kr_tracker_msgs/action/LineTracker.action b/trackers/kr_tracker_msgs/action/LineTracker.action index 2b5cb183..eb28824d 100644 --- a/trackers/kr_tracker_msgs/action/LineTracker.action +++ b/trackers/kr_tracker_msgs/action/LineTracker.action @@ -6,8 +6,8 @@ float64 yaw float64 v_des float64 a_des bool relative -time t_start -duration duration +builtin_interfaces/Time t_start +builtin_interfaces/Duration duration --- #result definition # send back goal diff --git a/trackers/kr_tracker_msgs/package.xml b/trackers/kr_tracker_msgs/package.xml index c1269aa7..eee0f91c 100644 --- a/trackers/kr_tracker_msgs/package.xml +++ b/trackers/kr_tracker_msgs/package.xml @@ -1,20 +1,29 @@ - + kr_tracker_msgs 1.0.0 kr_tracker_msgs Dinesh Thakur Kartik Mohta + Kashish Garg BSD - Dinesh Thakur - catkin + ament_cmake - nav_msgs + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + action_msgs + std_msgs + builtin_interfaces geometry_msgs - actionlib_msgs - message_generation - message_runtime + ament_lint_auto + ament_lint_common + + + ament_cmake + From d8b9dfb82dbe1fd3765b2bdcf1fe2854ca2d5810 Mon Sep 17 00:00:00 2001 From: pranavpshah Date: Thu, 15 Feb 2024 14:30:19 -0500 Subject: [PATCH 3/3] cmake version 3.8->3.10 --- kr_mav_msgs/CMakeLists.txt | 2 +- trackers/kr_tracker_msgs/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kr_mav_msgs/CMakeLists.txt b/kr_mav_msgs/CMakeLists.txt index e7c19daa..2d9062bc 100644 --- a/kr_mav_msgs/CMakeLists.txt +++ b/kr_mav_msgs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.10) project(kr_mav_msgs) # Default to C99 diff --git a/trackers/kr_tracker_msgs/CMakeLists.txt b/trackers/kr_tracker_msgs/CMakeLists.txt index a4c7c384..d8eb6bdf 100644 --- a/trackers/kr_tracker_msgs/CMakeLists.txt +++ b/trackers/kr_tracker_msgs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.10) project(kr_tracker_msgs) # Default to C99