-
Notifications
You must be signed in to change notification settings - Fork 9
Feat roboarm #23
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
base: development
Are you sure you want to change the base?
Feat roboarm #23
Conversation
Stepper class to control the steps of the motor RobotArmController to controll 3 different steppers
…t-roboarm-interface
…tart position on startup
…t-roboarm-limitations
…t-roboarm-nonblocking
cjsmeele
left a comment
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.
The structure and overall quality of the code look good!
I found no major issues.
Most of my comments are about misformatted or missing docblocks (besides that, the documentation looked pretty neat).
Additionally there are some minor C++ issues.
Lastly, the hwlib PR for fixing hwlib::string: I hope you can get it merged soon, otherwise, to be able to merge a working version of this PR, we would have to change the submodule to a fork.
| @@ -0,0 +1,7 @@ | |||
| #include "ky101.hh" | |||
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 file is missing a doxygen file header.
You can omit the \brief here, but at least mention the authors and copyright+license information.
modules/ROBOARM/src/ky101.hh
Outdated
|
|
||
| #include "wrap-hwlib.hh" | ||
|
|
||
| //\brief Simple boundary class for the KY101 chip |
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 comment will not be picked up by doxygen.
Please use this style for doxygen documentation on classes:
/**
* \brief Some short description
*/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.
noted
modules/ROBOARM/src/ky101.hh
Outdated
| /** | ||
| * \file | ||
| * \brief KY101 chip interface | ||
| * \author Luke Rovers |
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.
Correct me if I'm wrong, but isn't your name spelled with two 'o'-s? :-)
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.
Yeah XD that's my fault
modules/ROBOARM/src/ky101.hh
Outdated
| //\brief Simple boundary class for the KY101 chip | ||
| class Ky101 { | ||
| private: | ||
| // hwlib pin_in that the chip is wired to |
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.
For doxygen to pick up single-line brief comments, they should be formatted as such:
/// Some one-line description of what's below.
int theThing;
modules/ROBOARM/src/ky101.hh
Outdated
|
|
||
| public: | ||
| // Constructor for the Ky101 classs | ||
| //\param signal hwlib::pin_in to read the input from |
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 not a valid doxygen docblock.
For multiline docblocks, use the format as described in the coding guidlines at https://github.com/R2D2-2017/R2D2-2017/wiki/Coding-guidelines#param
The same goes for the function below.
modules/ROBOARM/src/robot-arm.cc
Outdated
| case RobotAxis::X: | ||
| if ((checkLimitations() == RobotLimitSwitch::BOTH || | ||
| checkLimitations() == RobotLimitSwitch::X) && | ||
| !clockwise) { |
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.
Not a critical issue by any means, but consider checking the bool clockwise in the beginning of the condition. This way you can save two function calls involving I/O when clockwise is true.
The same goes for the Y axis check below.
Alternatively I suggest you call checkLimitations() just once in this function and save the results.
modules/ROBOARM/src/robot-arm.cc
Outdated
| #include "robot-arm.hh" | ||
|
|
||
| RobotArmController::RobotArmController(Stepper &xAxis, Stepper &yAxis, Stepper &zAxis, | ||
| hwlib::target::pin_in &xLimitSwitch, hwlib::target::pin_in &yLimitSwitch, |
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.
Minor style question, up to you if you want to change it or not:
Putting the parameters on separate lines and aligning them would be incredibly aesthetically pleasing 😄 especially since they come in pairs.
modules/ROBOARM/src/parser.cc
Outdated
| Status parseCommand(const hwlib::string<0> &command, RobotArmController &robotArmController) { | ||
| uint8_t space = 0; // the place of the space | ||
|
|
||
| for (; command[space] != ' ' && space < command.length(); space++) // find space |
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.
In the condition, check space < command.length() first of the two to avoid a possible out of bounds read.
modules/ROBOARM/src/parser.cc
Outdated
| #include "parser.hh" | ||
|
|
||
| Status parseCommand(const hwlib::string<0> &command, RobotArmController &robotArmController) { | ||
| uint8_t space = 0; // the place of the space |
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.
hwlib::string::length() returns size_t, match your type.
modules/ROBOARM/src/parser.cc
Outdated
| bool direction = 0; // true if we go counterclockwise (negative value) | ||
|
|
||
| // string to int routine because no stdlib and not present in hwlib :( | ||
| for (uint8_t i = 0; i < amount.length(); i++) { |
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.
Change i to size_t, matching the type of length().
In general, whenever you index or address something, use size_ts.
|
@cjsmeele updated the pr |
Jipolie01
left a comment
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.
Looks good. Take care of Dave
Remco-Ruttenberg
left a comment
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.
Feature looks good
TheHippiez
left a comment
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.
Jip told me to do this
No description provided.