yaq-project / yaq-python

Repository for yaq core python packages.
https://yaq.fyi
GNU Lesser General Public License v3.0
5 stars 5 forks source link

HasTransformedPosition: limits is broken #56

Closed ddkohler closed 1 year ago

ddkohler commented 1 year ago

Currently, limits mixes up native and transformed limits when checking what positions are valid.

e.g. position = 2 * native limits = [1, 2] (this should apply to transformed position)

calling set_native_position(0.5) will actually set the native position to 1, and the transformed position to 1.5

In addition to fixing this bug (native should only check limits in native coordinates), I propose to add new config params for the trait that allow setting limits in native position. In software, we will always restrict movement to the intersection of valid native positions and transformed positions.

kameyer226 commented 1 year ago

Removing child's get_limits and in_limits methods makes bug go away, I propose we remove get_native_limits, reserve config's limits to native values, and write in the documentation that get_limits returns in native values.

ddkohler commented 1 year ago

I am against having limits refer to native values, because it goes against the idea of the has-transformed-position trait. A central idea of the trait is that a daemon's position can be thought of in some some experimentally convenient scale distinct from the specifics of the motor itself. So reporting limits back in some scale that position does not refer to is confusing.

So here is my proposal:

Note that this proposal is all about how the client interfaces with the daemon, and has nothing to do with how we keep track of position under the hood. Case and point: has-transformed-position is implemented in a way that keeps track of native position under the hood. This detail of the implementation might be the key to figuring out what changes are needed to make limits work correctly.

kameyer226 commented 1 year ago

I think the use of super() is the inherent problem with the code. We may have to remove these references and completely override set_position, in_limits, get_limits, and possibly get_position and get_destination for both HasTransformedPosition and HasLimits classes. ("Completely" --> not use super() ) Are you ok with that?

ddkohler commented 1 year ago

The main issue I was discussing was how the client side should not see changes. I'm not super concerned with how the daemon is coded under the hood. Any fix is a good starting point.

kameyer226 commented 1 year ago

I think that in order to have an easy to understand set of classes like this we may have to enforce the rule that both native_limits and limits are specified in the config file when using has-transformed-position. I think this is more important than attempting to make the set up more user-friendly.

ddkohler commented 1 year ago

we may have to enforce the rule that both native_limits and limits are specified in the config file when using has-transformed-position

I think you are saying the same thing I said earlier? I am not sure I understand the part about enforcing limits be specified--both native-limits and limits should be optional arguments with defaults of [-inf, inf].

kameyer226 commented 1 year ago

ok I understand now

ddkohler commented 1 year ago

Some summary thoughts (for future reference):