Skip to content

Conversation

@Bob-Thomas
Copy link

No description provided.

ManDeJan and others added 30 commits May 23, 2017 10:24
Stepper class to control the steps of the motor
RobotArmController to controll 3 different steppers
@Bob-Thomas
Copy link
Author

Bob Thomas

Copy link
Contributor

@cjsmeele cjsmeele left a 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"
Copy link
Contributor

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.


#include "wrap-hwlib.hh"

//\brief Simple boundary class for the KY101 chip
Copy link
Contributor

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
 */

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted

/**
* \file
* \brief KY101 chip interface
* \author Luke Rovers
Copy link
Contributor

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? :-)

Copy link
Author

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

//\brief Simple boundary class for the KY101 chip
class Ky101 {
private:
// hwlib pin_in that the chip is wired to
Copy link
Contributor

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;


public:
// Constructor for the Ky101 classs
//\param signal hwlib::pin_in to read the input from
Copy link
Contributor

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.

case RobotAxis::X:
if ((checkLimitations() == RobotLimitSwitch::BOTH ||
checkLimitations() == RobotLimitSwitch::X) &&
!clockwise) {
Copy link
Contributor

@cjsmeele cjsmeele Jun 5, 2017

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.

#include "robot-arm.hh"

RobotArmController::RobotArmController(Stepper &xAxis, Stepper &yAxis, Stepper &zAxis,
hwlib::target::pin_in &xLimitSwitch, hwlib::target::pin_in &yLimitSwitch,
Copy link
Contributor

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.

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
Copy link
Contributor

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.

#include "parser.hh"

Status parseCommand(const hwlib::string<0> &command, RobotArmController &robotArmController) {
uint8_t space = 0; // the place of the space
Copy link
Contributor

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.

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++) {
Copy link
Contributor

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.

@Bob-Thomas
Copy link
Author

@cjsmeele updated the pr

Copy link

@Jipolie01 Jipolie01 left a 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

Copy link

@Remco-Ruttenberg Remco-Ruttenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature looks good

Copy link

@TheHippiez TheHippiez left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants