-
Notifications
You must be signed in to change notification settings - Fork 7
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
hugo/feature/Add ShapeRecognition activity #1015
Conversation
HPezz
commented
Sep 9, 2022
•
edited
Loading
edited
- Validated on robot
File comparision analysis report🔖 Info
Click to show memory sections
📝 SummaryClick to show summary
🗺️ Map files diff outputClick to show diff list
|
Codecov Report
@@ Coverage Diff @@
## hugo/feature/Add-SuperSimon-activity #1015 +/- ##
=======================================================================
Coverage ? 96.03%
=======================================================================
Files ? 133
Lines ? 3106
Branches ? 0
=======================================================================
Hits ? 2983
Misses ? 123
Partials ? 0 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
File comparision analysis report🔖 Info
Click to show memory sections
📝 SummaryClick to show summary
🗺️ Map files diff outputClick to show diff list
|
3633449
to
dda1778
Compare
f627356
to
1cc8ac6
Compare
1cc8ac6
to
7328a07
Compare
dda1778
to
831e956
Compare
7328a07
to
94fdd65
Compare
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.
First activity review, very interesting 👍
I have a few questions to discuss on Monday :)
++_score; | ||
|
||
if (_score == kScoreToWin) { | ||
_backup_callback(MagicCard::dice_roll); |
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.
this is strange -- you're creating an invisible but very strong dependency on something and Activity can' possibly know: what the backup callback would do.
We need to find a better way of exiting an app than that.
If we change the main callback in the Robot Controller, it might break all the activities which should not be the case as they are not at all related
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.
Quick review
@@ -56,6 +56,7 @@ | |||
#include "RobotController.h" | |||
#include "SDBlockDevice.h" | |||
#include "SerialNumberKit.h" | |||
#include "ShapeRecognition.h" |
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.
Could we have a header for all autonomous activities in order to avoid to overcrowd the included files here?
#include "ShapeRecognition.h" | |
#include "AutonomousActivities.h" |
#include "ShapeRecognition.h" | |
#include "Activities.h" |
RFIDKit &_rfidkit; | ||
interface::VideoKit &_videokit; | ||
ReinforcerKit &_reinforcerkit; | ||
|
||
static constexpr uint8_t kRoundsNumber = 5; | ||
static constexpr uint8_t kNumberOfShapes = 4 * 2; | ||
|
||
uint8_t _score = 0; | ||
std::optional<Shape> _current_shape {}; | ||
std::function<void(const MagicCard &)> _backup_callback {}; | ||
std::array<Shape, kNumberOfShapes> _shapes = {Shape::square, Shape::square, Shape::circle, Shape::circle, | ||
Shape::triangle, Shape::triangle, Shape::star, Shape::star}; | ||
|
||
void launchNextRound(); |
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.
Guidestyle point
Private methods come first before private members
auto on_tag_detected_callback = [this](const MagicCard &card) { | ||
if (card == _current_shape->card) { | ||
_reinforcerkit.playDefault(); | ||
++_score; | ||
|
||
if (_score == kRoundsNumber) { | ||
_backup_callback(MagicCard::dice_roll); | ||
return; | ||
} | ||
|
||
launchNextRound(); | ||
} else { | ||
_backup_callback(card); | ||
} | ||
}; |
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 have a question, why this lambda isn't a private method?
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.
About lambda
vs std::bind
[Link]
831e956
to
685ff14
Compare
79eeecd
to
30bd601
Compare
685ff14
to
7b788a4
Compare
30bd601
to
06d5650
Compare
7b788a4
to
b88df8a
Compare
06d5650
to
7b61938
Compare
b88df8a
to
ccca540
Compare
c52bf66
to
2dcea08
Compare
ccca540
to
bd777e8
Compare
2dcea08
to
9fd66a4
Compare
bd777e8
to
23f3098
Compare
9fd66a4
to
99298e6
Compare
SonarCloud Quality Gate failed. |