Quote:
Originally Posted by King Nerd III
Code:
fl_motor->Set(left_speed); //Sets the front left motor to the left speed
fr_motor->Set(right_speed); //Sets the front right motor to the right speed
bl_motor->Set(left_speed); //Sets the back left motor to the left speed
br_motor->Set(right_speed); //Sets the back right motor to the right speed
SmartDashboard::PutNumber("Left Speed", left_speed); //Puts the left speed on SmartDashboard
SmartDashboard::PutNumber("Right Speed", right_speed * -1); //Puts the inverted right speed on SmartDashboard
}
|
Ewww.
Seriously, don't do that. Comments that merely echo the code are distracting at best. They can actually be confusing and counterproductive, as they can give the reader the impression that the author is trying to explain something unobvious about what the code is doing.
Keep putting the "block comments" at the beginning of sections, explaining what the code is
for, and explain assumptions and possible side effects, but don't overdo the line-by-line commentary on what the code
does. You can better document that kind of information by choosing appropriately detailed and helpful names for functions/methods and variables. For example, instead of the abbreviated
fl_motor, make the reader's job easier by calling it
front_left_motor. Instead of
left_speed, be more explicit with
left_speed_desired or
left_drive_commanded. That way it is obvious that you're not talking about
left_speed_measured or
left_intake_commanded.