From f0fc798fe25379333dbf33ed2d8413f6cef5ffef Mon Sep 17 00:00:00 2001 From: borednuna Date: Sat, 4 May 2024 01:32:33 +0700 Subject: [PATCH 1/2] feat: fix grpc error when run soccer --- CMakeLists.txt | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efd09bd..15e3442 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,10 +51,25 @@ add_library(${PROJECT_NAME} SHARED "src/${PROJECT_NAME}/node/akushon_node.cpp" ) +add_library(${PROJECT_NAME}_exported SHARED +"src/${PROJECT_NAME}/action/model/action_name.cpp" +"src/${PROJECT_NAME}/action/model/action.cpp" +"src/${PROJECT_NAME}/action/model/pose.cpp" +"src/${PROJECT_NAME}/action/node/action_manager.cpp" +"src/${PROJECT_NAME}/action/node/action_node.cpp" +"src/${PROJECT_NAME}/action/process/interpolator.cpp" +"src/${PROJECT_NAME}/action/process/joint_process.cpp" +) + target_include_directories(${PROJECT_NAME} PUBLIC $ $) + +target_include_directories(${PROJECT_NAME}_exported PUBLIC +$ +$) + ament_target_dependencies(${PROJECT_NAME} ament_index_cpp akushon_interfaces @@ -65,6 +80,15 @@ ament_target_dependencies(${PROJECT_NAME} tachimawari_interfaces gRPC) + ament_target_dependencies(${PROJECT_NAME}_exported + ament_index_cpp + akushon_interfaces + rclcpp + rclcpp_action + std_msgs + tachimawari + tachimawari_interfaces) + target_link_libraries(${PROJECT_NAME} gRPC::grpc++_reflection gRPC::grpc++ @@ -79,6 +103,13 @@ install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "bin" INCLUDES DESTINATION "include") + install(TARGETS ${PROJECT_NAME}_exported + EXPORT export_${PROJECT_NAME}_exported + ARCHIVE DESTINATION "lib" + LIBRARY DESTINATION "lib" + RUNTIME DESTINATION "bin" + INCLUDES DESTINATION "include") + target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) add_executable(action "src/action_main.cpp") @@ -119,5 +150,5 @@ ament_export_dependencies( tachimawari tachimawari_interfaces) ament_export_include_directories("include") -ament_export_libraries(${PROJECT_NAME}) +ament_export_libraries(${PROJECT_NAME}_exported) ament_package() From 09a15af8b92885a23dc8f9c29c3d07eba40aed7d Mon Sep 17 00:00:00 2001 From: FaaizHaikal Date: Sun, 5 May 2024 20:34:58 +0700 Subject: [PATCH 2/2] fix: fix save config and current joint service --- src/akushon/config/grpc/call_data_save_config.cpp | 3 +-- .../grpc/call_data_subscribe_current_joints.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/akushon/config/grpc/call_data_save_config.cpp b/src/akushon/config/grpc/call_data_save_config.cpp index 7e54d06..a6f4956 100644 --- a/src/akushon/config/grpc/call_data_save_config.cpp +++ b/src/akushon/config/grpc/call_data_save_config.cpp @@ -48,8 +48,7 @@ void CallDataSaveConfig::HandleRequest() { Config config(path_); try { - nlohmann::json akushon_data = nlohmann::json::parse(request_.json_actions()); - config.save_config(akushon_data); + config.save_config(request_.json_actions()); RCLCPP_INFO(rclcpp::get_logger("SaveConfig"), "config has been saved!"); } catch (nlohmann::json::exception e) { RCLCPP_ERROR(rclcpp::get_logger("SaveConfig"), e.what()); diff --git a/src/akushon/config/grpc/call_data_subscribe_current_joints.cpp b/src/akushon/config/grpc/call_data_subscribe_current_joints.cpp index 8c564a1..778f267 100644 --- a/src/akushon/config/grpc/call_data_subscribe_current_joints.cpp +++ b/src/akushon/config/grpc/call_data_subscribe_current_joints.cpp @@ -33,6 +33,13 @@ CallDataSubscribeCurrentJoints::CallDataSubscribeCurrentJoints( const std::string& path, rclcpp::Node::SharedPtr& node) : CallData(service, cq, path), node_(node) { + current_joint_subscription_ = + node_->create_subscription( + "/joint/current_joints", 10, + [this](const tachimawari_interfaces::msg::CurrentJoints::SharedPtr curr_joints) { + curr_joints_.joints = curr_joints->joints; + }); + Proceed(); } // namespace akushon @@ -49,12 +56,6 @@ void CallDataSubscribeCurrentJoints::WaitForRequest() void CallDataSubscribeCurrentJoints::HandleRequest() { try { - current_joint_subscription_ = - node_->create_subscription( - "/joint/current_joints", 10, - [this](const tachimawari_interfaces::msg::CurrentJoints::SharedPtr curr_joints) { - curr_joints_.joints = curr_joints->joints; - }); nlohmann::json curr_joints; for (const auto & items : curr_joints_.joints) {