pybricks-micropython icon indicating copy to clipboard operation
pybricks-micropython copied to clipboard

pbio/drivebase: Reverse turn rate for negative drive speed.

Open laurensvalk opened this issue 2 years ago • 5 comments

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

laurensvalk avatar Nov 13 '23 09:11 laurensvalk

Coverage Status

coverage: 56.071% (-0.002%) from 56.073% when pulling 74d6b2b1d6533b56ac86692e37d91217a8ba810a on drivebase-circle into bdf20a81843a0d4065d803ed7869e602dbd9e397 on master.

coveralls avatar Nov 13 '23 09:11 coveralls

@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!

laurensvalk avatar Nov 13 '23 09:11 laurensvalk

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).

dlech avatar Nov 15 '23 03:11 dlech

For what it's worth, this variant doesn't have special treatment or siding it one way for the zero case.

laurensvalk avatar Nov 15 '23 12:11 laurensvalk