So I comment my code a lot, but I don't comment the obvious. Like setting the speed to the motors is pretty clear from the code. But I did change the variable names on the code to make it clear it was front_left and not f1. (See you looked to "is that a one or an L"). Same thing with the dashboard. The code is clear, so the "set the dashboard" comments don't add any value. A reminder about the inversion isn't needed since we saw the comment 7 lines before, but it's a little weird, so worth a comment.
And if this is where the drive speed is actually set then I'd do the speed inversion here. That way the entire stack on top is going Foward is positive (+) Reverse is negative (-) and does not need to do the "well the right motors need to be inverted" every place else. That would also get rid of the need to re-invert it back for the display. That would reduce some code complexity.
My 2 cents since you asked, your mileage WILL vary.
Code:
void DriveBase::DriveTank(float left_speed, float right_speed){
//This method drives each side of the robot using set values
//The values are not changed in any way
//Since the right motors are opposite of the left motors, their values are inverted in the command
//Because of this, when the speeds are output to the SmartDashboard we invert the inverted value
front_left_motor->Set(left_speed); //Set the motor speeds
front_right_motor->Set(right_speed);
back_left_motor->Set(left_speed);
back_right_motor->Set(right_speed);
SmartDashboard::PutNumber("Left Speed", left_speed);
SmartDashboard::PutNumber("Right Speed", right_speed * -1); //inverted right speed to make the number positive on the display
}
And with the inversion done here
Code:
void DriveBase::DriveTank(float left_speed, float right_speed){
//This method drives each side of the robot. Forward is positive speeds, reverse is negative speeds.
//The values are not changed in any way
//Since the right motors are opposite of the left motors, their values are inverted when we set them
front_left_motor->Set(left_speed); //Set the motor speeds
front_right_motor->Set(right_speed * (-1) );
back_left_motor->Set(left_speed);
back_right_motor->Set(right_speed * (-1) );
SmartDashboard::PutNumber("Left Speed", left_speed);
SmartDashboard::PutNumber("Right Speed", right_speed);
}