From 2183db5e801bc6db083d16b689df599819edb987 Mon Sep 17 00:00:00 2001 From: hanskw-weston Date: Mon, 1 Jul 2024 16:10:12 +0800 Subject: [PATCH 1/4] robot: remove range data publishers --- wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp | 6 ------ wrp_sdk_robot/src/mobile_base_node.cpp | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp b/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp index cc8046a..5e2824b 100644 --- a/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp +++ b/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp @@ -25,8 +25,6 @@ #include "wrp_sdk_msgs/msg/motion_state.hpp" #include "wrp_sdk_msgs/msg/actuator_state_array.hpp" #include "wrp_sdk_msgs/msg/actuator_state.hpp" -#include "wrp_sdk_msgs/msg/range_data.hpp" -#include "wrp_sdk_msgs/msg/range_data_array.hpp" #include "wrp_sdk_msgs/msg/motion_command.hpp" #include "wrp_sdk_msgs/msg/rc_state.hpp" @@ -97,10 +95,6 @@ class MobileBaseNode : public rclcpp::Node { rclcpp::Publisher::SharedPtr rc_state_publisher_; rclcpp::Publisher::SharedPtr odom_publisher_; - rclcpp::Publisher::SharedPtr - tof_data_publisher_; - rclcpp::Publisher::SharedPtr - ultrasonic_data_publisher_; rclcpp::Service::SharedPtr access_control_service_; diff --git a/wrp_sdk_robot/src/mobile_base_node.cpp b/wrp_sdk_robot/src/mobile_base_node.cpp index 23e0f8a..b3d9ddf 100644 --- a/wrp_sdk_robot/src/mobile_base_node.cpp +++ b/wrp_sdk_robot/src/mobile_base_node.cpp @@ -153,13 +153,7 @@ bool MobileBaseNode::SetupInterfaces() { // setup tf broadcaster tf_broadcaster_ = std::make_shared(this); } - ultrasonic_data_publisher_ = - this->create_publisher( - "~/ultrasonic_data", 10); - tof_data_publisher_ = - this->create_publisher("~/tof_data", - 10); - + // setup services access_control_service_ = this->create_service( From 04bacac66cae46b92a70a98feb71d331ed809f8a Mon Sep 17 00:00:00 2001 From: hanskw-weston Date: Mon, 1 Jul 2024 16:16:50 +0800 Subject: [PATCH 2/4] robot: use joy msg instead of rc state --- wrp_sdk_msgs/msg/mobile_base/RcState.msg | 3 --- .../include/wrp_sdk_robot/mobile_base_node.hpp | 3 ++- wrp_sdk_robot/src/mobile_base_node.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 wrp_sdk_msgs/msg/mobile_base/RcState.msg diff --git a/wrp_sdk_msgs/msg/mobile_base/RcState.msg b/wrp_sdk_msgs/msg/mobile_base/RcState.msg deleted file mode 100644 index 22cdb90..0000000 --- a/wrp_sdk_msgs/msg/mobile_base/RcState.msg +++ /dev/null @@ -1,3 +0,0 @@ -std_msgs/Header header -float32[8] axes -int32[8] buttons \ No newline at end of file diff --git a/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp b/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp index 5e2824b..9cc5d45 100644 --- a/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp +++ b/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp @@ -21,6 +21,7 @@ #include #include #include +#include #include "wrp_sdk_msgs/msg/system_state.hpp" #include "wrp_sdk_msgs/msg/motion_state.hpp" #include "wrp_sdk_msgs/msg/actuator_state_array.hpp" @@ -92,7 +93,7 @@ class MobileBaseNode : public rclcpp::Node { actuator_state_publisher_; rclcpp::Publisher::SharedPtr battery_state_publisher_; - rclcpp::Publisher::SharedPtr rc_state_publisher_; + rclcpp::Publisher::SharedPtr rc_state_publisher_; rclcpp::Publisher::SharedPtr odom_publisher_; diff --git a/wrp_sdk_robot/src/mobile_base_node.cpp b/wrp_sdk_robot/src/mobile_base_node.cpp index b3d9ddf..0198049 100644 --- a/wrp_sdk_robot/src/mobile_base_node.cpp +++ b/wrp_sdk_robot/src/mobile_base_node.cpp @@ -145,7 +145,7 @@ bool MobileBaseNode::SetupInterfaces() { this->create_publisher("~/battery_state", 10); rc_state_publisher_ = - this->create_publisher("~/rc_state", 10); + this->create_publisher("~/rc_state", 10); odom_publisher_ = this->create_publisher("~/odom", 50); @@ -153,7 +153,7 @@ bool MobileBaseNode::SetupInterfaces() { // setup tf broadcaster tf_broadcaster_ = std::make_shared(this); } - + // setup services access_control_service_ = this->create_service( @@ -369,16 +369,16 @@ void MobileBaseNode::PublishActuatorState() { void MobileBaseNode::PublishRcState() { auto rc_state = robot_->GetRcState(); - wrp_sdk_msgs::msg::RcState rc_state_msg; + sensor_msgs::msg::Joy rc_state_msg; rc_state_msg.header.stamp = this->now(); rc_state_msg.header.frame_id = base_frame_; for (size_t i = 0; i < 8; i++) { - rc_state_msg.axes[i] = rc_state.axes[i]; + rc_state_msg.axes.push_back(rc_state.axes[i]); } for (size_t i = 0; i < 8; i++) { - rc_state_msg.buttons[i] = rc_state.buttons[i]; + rc_state_msg.buttons.push_back(rc_state.buttons[i]); } rc_state_publisher_->publish(rc_state_msg); From 605a966c543f5c50ca92c64524c40fa173a75d53 Mon Sep 17 00:00:00 2001 From: hanskw-weston Date: Mon, 1 Jul 2024 16:20:23 +0800 Subject: [PATCH 3/4] msgs: remove rc_state msg --- wrp_sdk_msgs/CMakeLists.txt | 1 - wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp | 1 - 2 files changed, 2 deletions(-) diff --git a/wrp_sdk_msgs/CMakeLists.txt b/wrp_sdk_msgs/CMakeLists.txt index 9076f4d..fea33d1 100644 --- a/wrp_sdk_msgs/CMakeLists.txt +++ b/wrp_sdk_msgs/CMakeLists.txt @@ -26,7 +26,6 @@ set(message_files "msg/mobile_base/MotorState.msg" "msg/mobile_base/RangeData.msg" "msg/mobile_base/RangeDataArray.msg" - "msg/mobile_base/RcState.msg" "msg/mobile_base/SystemState.msg" # peripheral diff --git a/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp b/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp index 9cc5d45..e455c63 100644 --- a/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp +++ b/wrp_sdk_robot/include/wrp_sdk_robot/mobile_base_node.hpp @@ -27,7 +27,6 @@ #include "wrp_sdk_msgs/msg/actuator_state_array.hpp" #include "wrp_sdk_msgs/msg/actuator_state.hpp" #include "wrp_sdk_msgs/msg/motion_command.hpp" -#include "wrp_sdk_msgs/msg/rc_state.hpp" #include "wrp_sdk_msgs/srv/access_control.hpp" #include "wrp_sdk_msgs/srv/assisted_mode_control.hpp" From 3ab30c3845ba99f0dfd3675fea0d19945ef332a1 Mon Sep 17 00:00:00 2001 From: hanskw-weston Date: Mon, 1 Jul 2024 16:23:09 +0800 Subject: [PATCH 4/4] robot: update readme --- wrp_sdk_robot/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrp_sdk_robot/README.md b/wrp_sdk_robot/README.md index d6a65ea..d37ccf3 100644 --- a/wrp_sdk_robot/README.md +++ b/wrp_sdk_robot/README.md @@ -56,7 +56,7 @@ Legend: Y - Supported, N - Not Supported, P - Partially Supported | `~/actuator_state` | wrp_sdk_msgs::msg::ActuatorStateArray | Outputs robot's actuator states | | `~/odom` | nav_msgs::msg::Odometry | Outputs robot's wheel odometry | | `~/battery_state` | sensor_msgs::msg::BatteryState | Outputs robot's battery state | -| `~/rc_state` | wrp_sdk_msgs::msg::RcState | Outputs robot's rc state (if applicable) | +| `~/rc_state` | sensor_msgs::msg::Joy | Outputs robot's rc state (if applicable) | | Subscribed Topic | Type | Description | | ---------------- | ------------------------- | ------------------------ |