pbio/drivebase: Reverse turn rate for negative drive speed.
Changed steering direction with DriveBase.drive() when reversing. Now, a positive angle or turn rate means the robot travels along a circle to its right. The speed or radius can be negated to travel in reverse along that same circle.
See https://github.com/pybricks/support/issues/1191
coverage: 56.071% (-0.002%) from 56.073% when pulling 74d6b2b1d6533b56ac86692e37d91217a8ba810a on drivebase-circle into bdf20a81843a0d4065d803ed7869e602dbd9e397 on master.
Download the artifacts for this pull request:
- cityhub-firmware-build-3126-git15de0535.zip
- essentialhub-firmware-build-3126-git15de0535.zip
- movehub-firmware-build-3126-git15de0535.zip
- mpy-cross.zip
- nxt-firmware-build-3126-git15de0535.zip
- pr_number.zip
- primehub-firmware-build-3126-git15de0535.zip
- pybricks-micropython-build-3126-git15de0535.zip
- technichub-firmware-build-3126-git15de0535.zip
@JDwyer009, would you like to give this a try?
To try it, download one of the firmware links in the post above.
In Pybricks, begin installing the firmware as usual. Instead of choosing a hub on the first dialog, pick "Advanced" and pick the file you just downloaded.
Proceed normally and try out the updated drive command :smile:
Thanks!
I feel like this would make things a bit weird when the drive speed is zero. Since zero is neither positive nor negative, it seems arbitrary that when drive speed is zero that the positive rules should apply. And the fact that the requested turn rate would no longer match the turn rate return by state() only when speed is negative also makes it feel weird.
So I still think it makes more sense to leave drive() as it is (and introduce a new method if we want something else).
For what it's worth, this variant doesn't have special treatment or siding it one way for the zero case.