-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Sprint 22/23 / PD-405] [Feature] Add implementation GRPC #13
Closed
Closed
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
37052b8
feat: create grpc function
mbsaloka ae0d726
feat: get and save function works
mbsaloka 35d7bf7
feat: set function works
mbsaloka 29205a5
refactor: remove debug code and unnecassary code
mbsaloka bcb3735
refactor: uncomment dnn detection and lbp detection codes
mbsaloka 73fa36e
feat pulling the master branch and merge
mbsaloka ee4172e
docs: clean up code and add copyright
mbsaloka c79bfd5
refactor: remove .vscode dir and debugging lines
mbsaloka 4dd50fe
feat: add _exported to cmakelist
mbsaloka d4daaca
Merge branch 'enhancement/refactor-ninshiki' into feature/using-grpc
mbsaloka 6e89e69
fix: remove unused file
mbsaloka 75f59d5
fix: add override
mbsaloka 4f2885a
fix: remove unnecessary header and simplify codes
mbsaloka 78c8bae
fix: remove call_data_base constrctor
mbsaloka c200bab
fix: remove port parameter
mbsaloka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"browse": { | ||
"databaseFilename": "${default}", | ||
"limitSymbolsToIncludedHeaders": false | ||
}, | ||
"includePath": [ | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/suiryoku/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/atama/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/aruku/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/kansei/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/akushon/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/tachimawari/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/tachimawari_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/suiryoku_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki_cpp/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/shisen_cpp/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/shisen_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/keisan/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/kansei_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/image_geometry/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/cv_bridge/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/atama_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/aruku_interfaces/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/akushon_interfaces/include/**", | ||
"/opt/ros/iron/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/akushon/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/aruku/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/atama/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/kansei/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/keisan/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/ninshiki_cpp/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/shisen_cpp/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/soccer/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/suiryoku/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/tachimawari/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/vision_opencv/cv_bridge/include/**", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/src/vision_opencv/image_geometry/include/**", | ||
"/usr/include/**" | ||
], | ||
"name": "ROS", | ||
"intelliSenseMode": "gcc-x64", | ||
"compilerPath": "/usr/bin/gcc", | ||
"cStandard": "gnu11", | ||
"cppStandard": "c++14" | ||
} | ||
], | ||
"version": 4 | ||
} |
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,34 @@ | ||
{ | ||
"python.autoComplete.extraPaths": [ | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/tachimawari_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/suiryoku_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki_py/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/shisen_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/opencv_tests/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/kansei_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/image_geometry/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/cv_bridge/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/atama_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/aruku_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/akushon_interfaces/lib/python3.10/site-packages", | ||
"/opt/ros/iron/lib/python3.10/site-packages" | ||
], | ||
"python.analysis.extraPaths": [ | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/tachimawari_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/suiryoku_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki_py/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/shisen_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/opencv_tests/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/ninshiki_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/kansei_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/image_geometry/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/cv_bridge/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/atama_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/aruku_interfaces/lib/python3.10/site-packages", | ||
"/home/mbsaloka/Desktop/Ichiro/ros2-ws/install/akushon_interfaces/lib/python3.10/site-packages", | ||
"/opt/ros/iron/lib/python3.10/site-packages" | ||
] | ||
} |
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,38 @@ | ||
{ | ||
"ball": { | ||
"max_hsv": [ | ||
179, | ||
100, | ||
100 | ||
], | ||
"min_hsv": [ | ||
151, | ||
40, | ||
10 | ||
] | ||
}, | ||
"field": { | ||
"max_hsv": [ | ||
116, | ||
100, | ||
100 | ||
], | ||
"min_hsv": [ | ||
84, | ||
10, | ||
0 | ||
] | ||
}, | ||
"line": { | ||
"max_hsv": [ | ||
260, | ||
60, | ||
100 | ||
], | ||
"min_hsv": [ | ||
180, | ||
0, | ||
55 | ||
] | ||
} | ||
} |
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,3 @@ | ||
{ | ||
"port": 5858 | ||
} |
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,87 @@ | ||
// Copyright (c) 2024 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 __NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_HPP__ | ||
#define __NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_HPP__ | ||
|
||
#include "ninshiki_cpp/config/grpc/call_data_base.hpp" | ||
#include "ninshiki_interfaces/ninshiki.grpc.pb.h" | ||
#include "ninshiki_interfaces/ninshiki.pb.h" | ||
#include "grpc/support/log.h" | ||
#include "grpcpp/grpcpp.h" | ||
|
||
namespace ninshiki_cpp | ||
{ | ||
template <class ConfigRequest, class ConfigReply> | ||
class CallData : public CallDataBase | ||
{ | ||
public: | ||
CallData( | ||
ninshiki_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string & path); | ||
|
||
void Proceed(); | ||
|
||
protected: | ||
virtual void AddNextToCompletionQueue() = 0; | ||
|
||
enum CallStatus { CREATE, PROCESS, FINISH }; | ||
|
||
CallStatus status_; // The current serving state. | ||
|
||
ninshiki_interfaces::proto::Config::AsyncService * service_; | ||
|
||
const std::string path_; | ||
|
||
grpc::ServerCompletionQueue * cq_; | ||
grpc::ServerContext ctx_; | ||
ConfigRequest request_; | ||
ConfigReply reply_; | ||
grpc::ServerAsyncResponseWriter<ConfigReply> responder_; | ||
}; | ||
|
||
template <class ConfigRequest, class ConfigReply> | ||
CallData<ConfigRequest, ConfigReply>::CallData( | ||
ninshiki_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||
const std::string & path) | ||
: status_(CREATE), service_(service), cq_(cq), responder_(&ctx_), path_(path) | ||
{ | ||
} | ||
|
||
template <class ConfigRequest, class ConfigReply> | ||
void CallData<ConfigRequest, ConfigReply>::Proceed() | ||
{ | ||
if (status_ == CREATE) { | ||
status_ = PROCESS; | ||
WaitForRequest(); | ||
} else if (status_ == PROCESS) { | ||
AddNextToCompletionQueue(); | ||
HandleRequest(); | ||
status_ = FINISH; | ||
responder_.Finish(reply_, grpc::Status::OK, this); | ||
} else { | ||
GPR_ASSERT(status_ == FINISH); | ||
delete this; | ||
} | ||
} | ||
|
||
} // namespace ninshiki_cpp | ||
|
||
#endif // __NINSHIKI_CPP__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,39 @@ | ||
// Copyright (c) 2024 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 NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_BASE_HPP_ | ||
#define NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_BASE_HPP_ | ||
|
||
namespace ninshiki_cpp | ||
{ | ||
class CallDataBase | ||
{ | ||
public: | ||
CallDataBase(); | ||
|
||
virtual void Proceed() = 0; | ||
|
||
protected: | ||
virtual void WaitForRequest() = 0; | ||
virtual void HandleRequest() = 0; | ||
}; | ||
} // namespace ninshiki_cpp | ||
|
||
#endif // NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_BASE_HPP_ |
43 changes: 43 additions & 0 deletions
43
include/ninshiki_cpp/config/grpc/call_data_get_color_setting.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) 2024 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 NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_GET_COLOR_SETTING_HPP__ | ||||||||||
#define NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_GET_COLOR_SETTING_HPP__ | ||||||||||
|
||||||||||
#include <ninshiki_cpp/config/grpc/call_data.hpp> | ||||||||||
|
||||||||||
namespace ninshiki_cpp | ||||||||||
{ | ||||||||||
class CallDataGetColorSetting | ||||||||||
: CallData<ninshiki_interfaces::proto::Empty, ninshiki_interfaces::proto::ConfigColor> | ||||||||||
{ | ||||||||||
public: | ||||||||||
CallDataGetColorSetting( | ||||||||||
ninshiki_interfaces::proto::Config::AsyncService * service, grpc::ServerCompletionQueue * cq, | ||||||||||
const std::string & path); | ||||||||||
|
||||||||||
protected: | ||||||||||
void AddNextToCompletionQueue() override; | ||||||||||
void WaitForRequest(); | ||||||||||
void HandleRequest(); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These lines should be marked as override.
Suggested change
|
||||||||||
}; | ||||||||||
} // namespace ninshiki_cpp | ||||||||||
|
||||||||||
#endif // NINSHIKI_CPP__CONFIG__GRPC__CALL_DATA_GET_COLOR_SETTING_HPP__ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this as we have moved the configurations to config repo