pybricks / support

Pybricks support and general discussion
MIT License
109 stars 7 forks source link

[Doc] Document the default for reset_angle in the Motor class doc #1917

Closed BertLindeman closed 3 weeks ago

BertLindeman commented 3 weeks ago

Describe the issue In #389 the argument reset_angle has been introduced. The doc does not state whether True or False is used if the argument is not specified.

Suggested improvement After

reset_angle ([bool](https://beta.pybricks.com/static/docs/v2.19.0/micropython/builtins.html#ubuiltins.bool)) 
– Choose True to reset the rotation sensor value to the absolute marker angle (between -180 and 179). 
Choose False to keep the current value, so your program knows where it left off last time.

add

If `reset_angle` is not specified, `False` is used.

Or better fitting text.

This came up in #1916

[EDIT] If I knew how / where I would have tried a PR. [EDIT 2] Simple? in the doc Will try there.

BertLindeman commented 3 weeks ago

I do no want to stir up too much for this. Looking in pupdevices.py

Is the policy to document the defaults in the parameter list: image

This would seem to me that the default for reset_angle would be True.

Tested with

from pybricks.pupdevices import Motor
from pybricks.parameters import Port
from pybricks import version

print(version)

motor = Motor(Port.A)
print("start at", motor.angle())

('technichub', '3.6.0b2', 'ci-build-3607-v3.6.0b2-19-g9e5ef68d on 2024-10-29')
start at -146
('technichub', '3.6.0b2', 'ci-build-3607-v3.6.0b2-19-g9e5ef68d on 2024-10-29')
start at -146
BertLindeman commented 3 weeks ago

Re-reading shows me I do not understand this mechanism at all.

The difference between reset_angle=True scales the motor angle between -180 and 179, reset_angle=False keeps the motor angle even if it is outside that range.

So closing this as stupid.

BertLindeman commented 3 weeks ago

close as user error