From 661cae70cef63a5741074d197d1e9803a88cedbf Mon Sep 17 00:00:00 2001 From: Dawid Date: Wed, 31 May 2023 16:10:04 +0200 Subject: [PATCH 1/4] add DriverState msg --- CMakeLists.txt | 17 ++++++++--------- msg/DriverState.msg | 2 ++ msg/FaultFlag.msg | 9 +++++++++ msg/LightsMessage.msg | 12 ------------ msg/MotorControllerState.msg | 7 +++++++ msg/MotorState.msg | 2 ++ msg/RuntimeError.msg | 7 +++++++ msg/ScriptFlag.msg | 3 +++ package.xml | 18 ++++++++---------- 9 files changed, 46 insertions(+), 31 deletions(-) create mode 100644 msg/DriverState.msg create mode 100644 msg/FaultFlag.msg delete mode 100644 msg/LightsMessage.msg create mode 100644 msg/MotorControllerState.msg create mode 100644 msg/MotorState.msg create mode 100644 msg/RuntimeError.msg create mode 100644 msg/ScriptFlag.msg diff --git a/CMakeLists.txt b/CMakeLists.txt index b314524..b9a21ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,21 @@ -cmake_minimum_required(VERSION 3.5) - +cmake_minimum_required(VERSION 3.10.2) project(panther_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_package(ament_cmake REQUIRED) find_package(builtin_interfaces REQUIRED) -find_package(std_msgs REQUIRED) +find_package(rosidl_default_generators REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} - "msg/LightsMessage.msg" - DEPENDENCIES builtin_interfaces std_msgs + "msg/DriverState.msg" + "msg/FaultFlag.msg" + "msg/MotorControllerState.msg" + "msg/MotorState.msg" + "msg/RuntimeError.msg" + "msg/ScriptFlag.msg" ) ament_export_dependencies(rosidl_default_runtime) diff --git a/msg/DriverState.msg b/msg/DriverState.msg new file mode 100644 index 0000000..cd812bf --- /dev/null +++ b/msg/DriverState.msg @@ -0,0 +1,2 @@ +panther_msgs/MotorControllerState front +panther_msgs/MotorControllerState rear \ No newline at end of file diff --git a/msg/FaultFlag.msg b/msg/FaultFlag.msg new file mode 100644 index 0000000..570908c --- /dev/null +++ b/msg/FaultFlag.msg @@ -0,0 +1,9 @@ +bool can_net_err +bool overheat +bool overvoltage +bool undervoltage +bool short_circuit +bool emergency_stop +bool motor_or_sensor_setup_fault +bool mosfet_failure +bool default_config_loaded_at_startup \ No newline at end of file diff --git a/msg/LightsMessage.msg b/msg/LightsMessage.msg deleted file mode 100644 index cb09d02..0000000 --- a/msg/LightsMessage.msg +++ /dev/null @@ -1,12 +0,0 @@ -uint8 BLINKER_RIGHT = 0 -uint8 BLINKER_LEFT = 1 -uint8 BRAKE_FRONT = 2 -uint8 BRAKE_REAR = 3 -uint8 BRAKE_BOTH = 4 -uint8 NORMAL_FORWARD = 5 -uint8 NORMAL_REVERSING = 6 -uint8 SKID_RIGHT = 7 -uint8 SKID_LEFT = 8 -uint8 ERROR = 9 -uint8 animation -string custom_color \ No newline at end of file diff --git a/msg/MotorControllerState.msg b/msg/MotorControllerState.msg new file mode 100644 index 0000000..1013950 --- /dev/null +++ b/msg/MotorControllerState.msg @@ -0,0 +1,7 @@ +float32 voltage +float32 current +float32 temperature +panther_msgs/FaultFlag fault_flag +panther_msgs/ScriptFlag script_flag +panther_msgs/MotorState left_motor +panther_msgs/MotorState right_motor \ No newline at end of file diff --git a/msg/MotorState.msg b/msg/MotorState.msg new file mode 100644 index 0000000..1e7955c --- /dev/null +++ b/msg/MotorState.msg @@ -0,0 +1,2 @@ +string motor_joint_name +panther_msgs/RuntimeError runtime_error \ No newline at end of file diff --git a/msg/RuntimeError.msg b/msg/RuntimeError.msg new file mode 100644 index 0000000..f8c0419 --- /dev/null +++ b/msg/RuntimeError.msg @@ -0,0 +1,7 @@ +bool amps_limit_active +bool motor_stall +bool loop_error +bool safety_stop_active +bool forward_limit_triggered +bool reverse_limit_triggered +bool amps_trigger_activated \ No newline at end of file diff --git a/msg/ScriptFlag.msg b/msg/ScriptFlag.msg new file mode 100644 index 0000000..34ad0e7 --- /dev/null +++ b/msg/ScriptFlag.msg @@ -0,0 +1,3 @@ +bool loop_error +bool encoder_disconected +bool amp_limiter \ No newline at end of file diff --git a/package.xml b/package.xml index 76db942..689f187 100644 --- a/package.xml +++ b/package.xml @@ -1,26 +1,24 @@ - + panther_msgs - 0.0.0 - - Custom messages for Panther robot. - - - Husarion + 0.0.1 + Custom messages for Panther robot. Apache License 2.0 + Dawid Kmak + Krzysztof Wojciechowski + Husarion + https://husarion.com/ https://github.com/husarion/panther_msgs/tree/ros2 https://github.com/husarion/panther_msgs/issues - Krzysztof Wojciechowski ament_cmake rosidl_default_generators builtin_interfaces - std_msgs rosidl_default_runtime rosidl_interface_packages @@ -28,4 +26,4 @@ ament_cmake - + \ No newline at end of file From 98196a15d8d73d53bc0e6215a1683ded46c656d3 Mon Sep 17 00:00:00 2001 From: Dawid Date: Fri, 2 Jun 2023 14:57:35 +0200 Subject: [PATCH 2/4] update package.xml --- package.xml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/package.xml b/package.xml index 689f187..11a8cbb 100644 --- a/package.xml +++ b/package.xml @@ -3,18 +3,17 @@ panther_msgs 0.0.1 - Custom messages for Panther robot. - Apache License 2.0 - - Dawid Kmak - Krzysztof Wojciechowski Husarion + Apache License 2.0 https://husarion.com/ https://github.com/husarion/panther_msgs/tree/ros2 https://github.com/husarion/panther_msgs/issues + Dawid Kmak + Krzysztof Wojciechowski + ament_cmake rosidl_default_generators From 2b929caa51e6c69d57aa82394629e79746a25a80 Mon Sep 17 00:00:00 2001 From: Dawid Date: Fri, 13 Oct 2023 10:15:29 +0000 Subject: [PATCH 3/4] Update messages --- CMakeLists.txt | 9 ++++++++- msg/DriverState.msg | 4 +++- msg/FaultFlag.msg | 2 +- msg/IOState.msg | 7 +++++++ msg/LEDAnimation.msg | 13 +++++++++++++ msg/LEDAnimationQueue.msg | 1 + msg/LEDImageAnimation.msg | 5 +++++ msg/MotorControllerState.msg | 2 +- msg/MotorState.msg | 2 +- msg/RuntimeError.msg | 2 +- msg/ScriptFlag.msg | 2 +- msg/SystemStatus.msg | 7 +++++++ package.xml | 3 ++- 13 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 msg/IOState.msg create mode 100644 msg/LEDAnimation.msg create mode 100644 msg/LEDAnimationQueue.msg create mode 100644 msg/LEDImageAnimation.msg create mode 100644 msg/SystemStatus.msg diff --git a/CMakeLists.txt b/CMakeLists.txt index b9a21ee..f8f0eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,16 +8,23 @@ endif() find_package(ament_cmake REQUIRED) find_package(builtin_interfaces REQUIRED) find_package(rosidl_default_generators REQUIRED) +find_package(std_msgs REQUIRED) rosidl_generate_interfaces(${PROJECT_NAME} "msg/DriverState.msg" "msg/FaultFlag.msg" + "msg/IOState.msg" + "msg/LEDAnimation.msg" + "msg/LEDAnimationQueue.msg" + "msg/LEDImageAnimation.msg" "msg/MotorControllerState.msg" "msg/MotorState.msg" "msg/RuntimeError.msg" "msg/ScriptFlag.msg" + "msg/SystemStatus.msg" + DEPENDENCIES std_msgs ) ament_export_dependencies(rosidl_default_runtime) -ament_package() \ No newline at end of file +ament_package() diff --git a/msg/DriverState.msg b/msg/DriverState.msg index cd812bf..f28ac45 100644 --- a/msg/DriverState.msg +++ b/msg/DriverState.msg @@ -1,2 +1,4 @@ +std_msgs/Header header + panther_msgs/MotorControllerState front -panther_msgs/MotorControllerState rear \ No newline at end of file +panther_msgs/MotorControllerState rear diff --git a/msg/FaultFlag.msg b/msg/FaultFlag.msg index 570908c..e0e1f8a 100644 --- a/msg/FaultFlag.msg +++ b/msg/FaultFlag.msg @@ -6,4 +6,4 @@ bool short_circuit bool emergency_stop bool motor_or_sensor_setup_fault bool mosfet_failure -bool default_config_loaded_at_startup \ No newline at end of file +bool default_config_loaded_at_startup diff --git a/msg/IOState.msg b/msg/IOState.msg new file mode 100644 index 0000000..2f8933c --- /dev/null +++ b/msg/IOState.msg @@ -0,0 +1,7 @@ +bool aux_power +bool charger_connected +bool charger_enabled +bool digital_power +bool fan +bool motor_on +bool power_button \ No newline at end of file diff --git a/msg/LEDAnimation.msg b/msg/LEDAnimation.msg new file mode 100644 index 0000000..2bd339f --- /dev/null +++ b/msg/LEDAnimation.msg @@ -0,0 +1,13 @@ +uint16 E_STOP = 0 +uint16 READY = 1 +uint16 ERROR = 2 +uint16 MANUAL_ACTION = 3 +uint16 AUTONOMOUS_ACTION = 4 +uint16 GOAL_ACHIEVED = 5 +uint16 LOW_BATTERY = 6 +uint16 CRITICAL_BATTERY = 7 +uint16 BATTERY_STATE = 8 +uint16 CHARGING_BATTERY = 9 + +uint16 id +string param diff --git a/msg/LEDAnimationQueue.msg b/msg/LEDAnimationQueue.msg new file mode 100644 index 0000000..9996f51 --- /dev/null +++ b/msg/LEDAnimationQueue.msg @@ -0,0 +1 @@ +string[] queue diff --git a/msg/LEDImageAnimation.msg b/msg/LEDImageAnimation.msg new file mode 100644 index 0000000..fc1fde2 --- /dev/null +++ b/msg/LEDImageAnimation.msg @@ -0,0 +1,5 @@ +string image +float32 duration +float32 brightness +uint8 repeat +uint32 color diff --git a/msg/MotorControllerState.msg b/msg/MotorControllerState.msg index 1013950..c1dd500 100644 --- a/msg/MotorControllerState.msg +++ b/msg/MotorControllerState.msg @@ -4,4 +4,4 @@ float32 temperature panther_msgs/FaultFlag fault_flag panther_msgs/ScriptFlag script_flag panther_msgs/MotorState left_motor -panther_msgs/MotorState right_motor \ No newline at end of file +panther_msgs/MotorState right_motor diff --git a/msg/MotorState.msg b/msg/MotorState.msg index 1e7955c..4ea25b4 100644 --- a/msg/MotorState.msg +++ b/msg/MotorState.msg @@ -1,2 +1,2 @@ string motor_joint_name -panther_msgs/RuntimeError runtime_error \ No newline at end of file +panther_msgs/RuntimeError runtime_error diff --git a/msg/RuntimeError.msg b/msg/RuntimeError.msg index f8c0419..459d9b2 100644 --- a/msg/RuntimeError.msg +++ b/msg/RuntimeError.msg @@ -4,4 +4,4 @@ bool loop_error bool safety_stop_active bool forward_limit_triggered bool reverse_limit_triggered -bool amps_trigger_activated \ No newline at end of file +bool amps_trigger_activated diff --git a/msg/ScriptFlag.msg b/msg/ScriptFlag.msg index 34ad0e7..2a2759a 100644 --- a/msg/ScriptFlag.msg +++ b/msg/ScriptFlag.msg @@ -1,3 +1,3 @@ bool loop_error bool encoder_disconected -bool amp_limiter \ No newline at end of file +bool amp_limiter diff --git a/msg/SystemStatus.msg b/msg/SystemStatus.msg new file mode 100644 index 0000000..7a09023 --- /dev/null +++ b/msg/SystemStatus.msg @@ -0,0 +1,7 @@ +std_msgs/Header header + +float32[] cpu_percent +float32 cpu_temp +float32 avg_load_percent +float32 ram_usage_percent +float32 disc_usage_percent diff --git a/package.xml b/package.xml index 11a8cbb..feeeda0 100644 --- a/package.xml +++ b/package.xml @@ -18,6 +18,7 @@ rosidl_default_generators builtin_interfaces + std_msgs rosidl_default_runtime rosidl_interface_packages @@ -25,4 +26,4 @@ ament_cmake - \ No newline at end of file + From dababaed02e6e2f8311401de3532d054848e54e5 Mon Sep 17 00:00:00 2001 From: Dawid Date: Fri, 13 Oct 2023 10:19:59 +0000 Subject: [PATCH 4/4] Update services --- CMakeLists.txt | 3 +++ srv/SetLEDAnimation.srv | 5 +++++ srv/SetLEDBrightness.srv | 4 ++++ srv/SetLEDImageAnimation.srv | 7 +++++++ 4 files changed, 19 insertions(+) create mode 100644 srv/SetLEDAnimation.srv create mode 100644 srv/SetLEDBrightness.srv create mode 100644 srv/SetLEDImageAnimation.srv diff --git a/CMakeLists.txt b/CMakeLists.txt index f8f0eb9..4f72510 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ rosidl_generate_interfaces(${PROJECT_NAME} "msg/RuntimeError.msg" "msg/ScriptFlag.msg" "msg/SystemStatus.msg" + "srv/SetLEDAnimation.srv" + "srv/SetLEDBrightness.srv" + "srv/SetLEDImageAnimation.srv" DEPENDENCIES std_msgs ) diff --git a/srv/SetLEDAnimation.srv b/srv/SetLEDAnimation.srv new file mode 100644 index 0000000..0b94cb7 --- /dev/null +++ b/srv/SetLEDAnimation.srv @@ -0,0 +1,5 @@ +panther_msgs/LEDAnimation animation +bool repeating +--- +bool success +string message diff --git a/srv/SetLEDBrightness.srv b/srv/SetLEDBrightness.srv new file mode 100644 index 0000000..e7b83e8 --- /dev/null +++ b/srv/SetLEDBrightness.srv @@ -0,0 +1,4 @@ +float32 data +--- +bool success +string message diff --git a/srv/SetLEDImageAnimation.srv b/srv/SetLEDImageAnimation.srv new file mode 100644 index 0000000..99d4d00 --- /dev/null +++ b/srv/SetLEDImageAnimation.srv @@ -0,0 +1,7 @@ +panther_msgs/LEDImageAnimation front +panther_msgs/LEDImageAnimation rear +bool interrupting +bool repeating +--- +bool success +string message