Fix motor groups not properly setting motor gearing/encoder units #610
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Appended _all to the
set_gearing
andset_encoder_units
calls in the motor group constructor.Motivation:
After testing, it seems that when creating a motor group, the gearing you provide to the constructor only applies to the first motor in the group. Previously, the constructor would call
set_gearing
and pass in only the gearset, which would result in theindex
argument defaulting to 0 and therefore only applying to the first motor. The same is true with the existingset_encoder_units
call. Changing these to their_all
variants means all motors in the group will get the proper gearing and encoder units.Example:
pros::MotorGroup motors({1, 2}, pros::MotorGears::blue);
will only set the first motor to blue.Test Plan:
get_gearing_all
on the motor group and print the values to verify the gearing is correctget_encoder_units_all
on the motor group and print the values to verify the encoder units are correct