Skip to content

Commit

Permalink
fix: fix save config and current joint service
Browse files Browse the repository at this point in the history
  • Loading branch information
FaaizHaikal committed May 5, 2024
1 parent f0fc798 commit 09a15af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/akushon/config/grpc/call_data_save_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
13 changes: 7 additions & 6 deletions src/akushon/config/grpc/call_data_subscribe_current_joints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<tachimawari_interfaces::msg::CurrentJoints>(
"/joint/current_joints", 10,
[this](const tachimawari_interfaces::msg::CurrentJoints::SharedPtr curr_joints) {
curr_joints_.joints = curr_joints->joints;
});

Proceed();
} // namespace akushon

Expand All @@ -49,12 +56,6 @@ void CallDataSubscribeCurrentJoints::WaitForRequest()
void CallDataSubscribeCurrentJoints::HandleRequest()
{
try {
current_joint_subscription_ =
node_->create_subscription<tachimawari_interfaces::msg::CurrentJoints>(
"/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) {
Expand Down

0 comments on commit 09a15af

Please sign in to comment.