-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
868 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef AKUSHON__CONFIG__GRPC__CALL_DATA_HPP_ | ||
#define AKUSHON__CONFIG__GRPC__CALL_DATA_HPP_ | ||
|
||
#include "akushon.grpc.pb.h" | ||
#include "akushon.pb.h" | ||
#include "grpc/support/log.h" | ||
#include "grpcpp/grpcpp.h" | ||
#include "akushon/config/grpc/call_data_base.hpp" | ||
|
||
namespace akushon | ||
{ | ||
template <class ConfigRequest, class ConfigReply> | ||
class CallData : CallDataBase | ||
{ | ||
public: | ||
CallData( | ||
akushon_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string path); | ||
|
||
virtual void Proceed() override; | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() = 0; | ||
|
||
enum CallStatus { CREATE, PROCESS, FINISH }; | ||
|
||
CallStatus status_; // The current serving state. | ||
|
||
akushon_interfaces::proto::Config::AsyncService * service_; | ||
|
||
const std::string path_; | ||
|
||
grpc::ServerCompletionQueue * cq_; | ||
grpc::ServerContext ctx_; | ||
ConfigRequest request_; | ||
ConfigReply reply_; | ||
grpc::ServerAsyncResponseWriter<ConfigReply> responder_; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // AKUSHON__CONFIG__GRPC__CALL_DATA_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef __AKUSHON__CONFIG__GRPC__CALL_DATA_BASE_HPP__ | ||
#define __AKUSHON__CONFIG__GRPC__CALL_DATA_BASE_HPP__ | ||
namespace akushon | ||
{ | ||
class CallDataBase | ||
{ | ||
public: | ||
CallDataBase(); | ||
|
||
virtual void Proceed() = 0; | ||
|
||
protected: | ||
virtual void WaitForRequest() = 0; | ||
virtual void HandleRequest() = 0; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // __AKUSHON__CONFIG__GRPC__CALL_DATA_BASE_HPP__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef AKUSHON__CONFIG__GRPC__CALL_DATA_GET_CONFIG_HPP_ | ||
#define AKUSHON__CONFIG__GRPC__CALL_DATA_GET_CONFIG_HPP_ | ||
|
||
#include "akushon/config/grpc/call_data.hpp" | ||
|
||
namespace akushon | ||
{ | ||
class CallDataGetConfig | ||
: CallData<akushon_interfaces::proto::Empty, akushon_interfaces::proto::ConfigActions> | ||
{ | ||
public: | ||
CallDataGetConfig( | ||
akushon_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string path); | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() override; | ||
virtual void WaitForRequest() override; | ||
virtual void HandleRequest() override; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // AKUSHON__CONFIG__GRPC__CALL_DATA_GET_CONFIG_HPP_ |
47 changes: 47 additions & 0 deletions
47
include/akushon/config/grpc/call_data_publish_set_joints.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef AKUSHON__CONFIG__GRPC__CALL_DATA_PUBLISH_SET_JOINTS_HPP_ | ||
#define AKUSHON__CONFIG__GRPC__CALL_DATA_PUBLISH_SET_JOINTS_HPP_ | ||
|
||
#include "akushon/config/grpc/call_data.hpp" | ||
#include "tachimawari_interfaces/msg/set_joints.hpp" | ||
#include "rclcpp/rclcpp.hpp" | ||
|
||
namespace akushon | ||
{ | ||
class CallDataPublishSetJoints | ||
: CallData<akushon_interfaces::proto::SetJointsData, akushon_interfaces::proto::Empty> | ||
{ | ||
public: | ||
CallDataPublishSetJoints( | ||
akushon_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string path, rclcpp::Node::SharedPtr node); | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() override; | ||
virtual void WaitForRequest() override; | ||
virtual void HandleRequest() override; | ||
rclcpp::Node::SharedPtr node_; | ||
rclcpp::Publisher<tachimawari_interfaces::msg::SetJoints>::SharedPtr set_joints_publisher_; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // AKUSHON__CONFIG__GRPC__CALL_DATA_PUBLISH_SET_JOINTS_HPP_ |
47 changes: 47 additions & 0 deletions
47
include/akushon/config/grpc/call_data_publish_set_torques.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef AKUSHON__CONFIG__GRPC__CALL_DATA_PUBLISH_SET_TORQUES_HPP_ | ||
#define AKUSHON__CONFIG__GRPC__CALL_DATA_PUBLISH_SET_TORQUES_HPP_ | ||
|
||
#include "akushon/config/grpc/call_data.hpp" | ||
#include "tachimawari_interfaces/msg/set_torques.hpp" | ||
#include "rclcpp/rclcpp.hpp" | ||
|
||
namespace akushon | ||
{ | ||
class CallDataPublishSetTorques | ||
: CallData<akushon_interfaces::proto::SetTorquesData, akushon_interfaces::proto::Empty> | ||
{ | ||
public: | ||
CallDataPublishSetTorques( | ||
akushon_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string path, rclcpp::Node::SharedPtr node); | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() override; | ||
virtual void WaitForRequest() override; | ||
virtual void HandleRequest() override; | ||
rclcpp::Node::SharedPtr node_; | ||
rclcpp::Publisher<tachimawari_interfaces::msg::SetTorques>::SharedPtr set_torque_publisher_; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // AKUSHON__CONFIG__GRPC__CALL_DATA_PUBLISH_SET_TORQUES_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef AKUSHON__CONFIG__GRPC__CALL_DATA_RUN_ACTION_HPP_ | ||
#define AKUSHON__CONFIG__GRPC__CALL_DATA_RUN_ACTION_HPP_ | ||
|
||
#include "akushon/config/grpc/call_data.hpp" | ||
#include "akushon_interfaces/msg/run_action.hpp" | ||
#include "rclcpp/rclcpp.hpp" | ||
|
||
namespace akushon | ||
{ | ||
class CallDataRunAction | ||
: CallData<akushon_interfaces::proto::ConfigRunAction, akushon_interfaces::proto::Empty> | ||
{ | ||
public: | ||
CallDataRunAction( | ||
akushon_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string path, rclcpp::Node::SharedPtr node); | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() override; | ||
virtual void WaitForRequest() override; | ||
virtual void HandleRequest() override; | ||
rclcpp::Node::SharedPtr node_; | ||
rclcpp::Publisher<akushon_interfaces::msg::RunAction>::SharedPtr run_action_publisher_; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // AKUSHON__CONFIG__GRPC__CALL_DATA_RUN_ACTION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2023 Ichiro ITS | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#ifndef AKUSHON__CONFIG__GRPC__SAVE_CONFIG_HPP_ | ||
#define AKUSHON__CONFIG__GRPC__SAVE_CONFIG_HPP_ | ||
|
||
#include "akushon/config/grpc/call_data.hpp" | ||
|
||
namespace akushon | ||
{ | ||
class CallDataSaveConfig | ||
: CallData<akushon_interfaces::proto::ConfigActions, akushon_interfaces::proto::Empty> | ||
{ | ||
public: | ||
CallDataSaveConfig( | ||
akushon_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string path); | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() override; | ||
virtual void WaitForRequest() override; | ||
virtual void HandleRequest() override; | ||
}; | ||
} // namespace akushon | ||
|
||
#endif // AKUSHON__CONFIG__GRPC__SAVE_CONFIG_HPP_ |
Oops, something went wrong.