-
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
Conversation
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.
remove .vscode
dir
item.max_value = color.max_value; | ||
|
||
std::cout << "[DEBUG] Color setting has been applied!" << std::endl; | ||
std::cout << "name: " << item.name << std::endl; |
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.
remove these debugging lines
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.
I suggest creating a dedicated gRPC utility package first before merging this change, as I see there are many duplications of CallData
, CallDataBase
, etc., across different projects that are going to implement gRPC (see ichiro-its/shisen_cpp#25 and ichiro-its/aruku#20).
data/color_classifier.json
Outdated
@@ -0,0 +1,38 @@ | |||
{ |
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
@@ -0,0 +1,56 @@ | |||
// Copyright (c) 2021 ICHIRO ITS |
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.
Isn't this done in branch refactor ninshiki ? Maybe remove all changes that are done in refactor ninshiki branch before merging this branch later
void WaitForRequest(); | ||
void HandleRequest(); |
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.
These lines should be marked as override.
void WaitForRequest(); | |
void HandleRequest(); | |
void WaitForRequest() override; | |
void HandleRequest() override; |
void WaitForRequest(); | ||
void HandleRequest(); |
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.
Ditto.
void WaitForRequest(); | ||
void HandleRequest(); |
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.
Ditto.
#include <absl/flags/flag.h> | ||
#include <absl/flags/parse.h> | ||
#include <absl/strings/str_format.h> | ||
#include <grpc/support/log.h> | ||
#include <grpcpp/grpcpp.h> | ||
#include <ninshiki_cpp/config/grpc/call_data.hpp> | ||
#include <ninshiki_cpp/config/grpc/call_data_base.hpp> | ||
#include <ninshiki_cpp/detector/color_detector.hpp> | ||
#include <ninshiki_interfaces/msg/color_setting.hpp> | ||
#include <ninshiki_interfaces/ninshiki.grpc.pb.h> | ||
#include <ninshiki_interfaces/ninshiki.pb.h> | ||
#include <nlohmann/json.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <chrono> | ||
#include <fstream> | ||
#include <future> | ||
#include <iostream> | ||
#include <map> | ||
#include <memory> | ||
#include <string> | ||
#include <thread> |
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.
Some of these headers may be unnecessary, don't put all of them in the header file.
|
||
namespace ninshiki_cpp | ||
{ | ||
CallDataBase::CallDataBase() {} |
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.
Just remove the constructor if it does not do anything.
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.
after I deleted the constructor or deleted the call_data_base.cpp
file, when building the package it produced an error
/usr/bin/ld: libninshiki_cpp.so: undefined reference to `ninshiki_cpp::CallDataBase::CallDataBase()'
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.
You also need to remove the constructor from the class declaration in the .hpp
file.
std::string name = request_.name(); | ||
int min_hue = request_.min_hue(); | ||
int max_hue = request_.max_hue(); | ||
int min_saturation = request_.min_saturation(); | ||
int max_saturation = request_.max_saturation(); | ||
int min_value = request_.min_value(); | ||
int max_value = request_.max_value(); | ||
|
||
utils::Color color( | ||
name, | ||
min_hue, | ||
max_hue, | ||
min_saturation, | ||
max_saturation, | ||
min_value, | ||
max_value | ||
); |
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.
Simpler
std::string name = request_.name(); | |
int min_hue = request_.min_hue(); | |
int max_hue = request_.max_hue(); | |
int min_saturation = request_.min_saturation(); | |
int max_saturation = request_.max_saturation(); | |
int min_value = request_.min_value(); | |
int max_value = request_.max_value(); | |
utils::Color color( | |
name, | |
min_hue, | |
max_hue, | |
min_saturation, | |
max_saturation, | |
min_value, | |
max_value | |
); | |
utils::Color color( | |
request_.name(), | |
request_.min_hue(), | |
request_.max_hue(), | |
request_.min_saturation(), | |
request_.max_saturation(), | |
request_.min_value(), | |
request_.max_value() | |
); |
I think there are going to be a lot of changes while working on this. It might be worked on after this year's competition mas, which is around next month. |
343f44e
to
c200bab
Compare
Jira Link:
https://ichiro-its.atlassian.net/browse/PD-405?atlOrigin=eyJpIjoiZjcyMmNiZGY0YjQ5NDliYzkxYjhkZjBiODFmODk2OWUiLCJwIjoiaiJ9
Description
Added grpc to implement get, set and save functions. The gRPC server runs on port :5858 and consists of 3 RPCs, GetColorSetting, SetColorSetting, and SaveColorSetting. It has been tested using Postman and it works.
Example Message:
Type of Change
How Has This Been Tested?
Checklist:
feature/JIRA-ID-SHORT-DESCRIPTION
if has a JIRA ticketenhancement/SHORT-DESCRIPTION
if has/has no JIRA ticket and contain enhancementhotfix/SHORT-DESCRIPTION
if the change doesn't need to be tested (urgent)