Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Spherical coordinates useful #302

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

PeterJCLaw
Copy link
Contributor

@PeterJCLaw PeterJCLaw commented Oct 9, 2022

This changes the Spherical coordinates to (almost) following the ISO convention. Consequently there are a number of changes to the values, notably:

  • the reference positions for each angle changes
  • the interpretation of the angles changes

See inline documentation for the interpretation of the values now.

Fixes #300
Builds on #312

@PeterJCLaw
Copy link
Contributor Author

I wasn't expecting the reference positions for each of the rot_x and rot_y angles to change, which suggests that the previous values were likely even further from their documented behaviour than had been anticipated.

Still missing from this documentation is explicit notation of which direction on each axis is positive; I'm not sure how to establish that. Consequently, I'm also not sure which way around each axis represents a positive angle for each case. Establishing and documenting that would also be good.

This change is essentially untested in the real world. Unfortunately I don't have any printed markers nor a working webcam right now to test with, so this change is derived entirely from resources about how various coordinate systems, including this one, should behave (rather than how the system employed here actually does).

Copy link
Owner

@RealOrangeOne RealOrangeOne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look at this! Trig was never my strongpoint, but running through the test cases myself they all seem to make sense!

zoloto/coords.py Show resolved Hide resolved
zoloto/coords.py Show resolved Hide resolved
zoloto/coords.py Show resolved Hide resolved
zoloto/coords.py Outdated Show resolved Hide resolved
zoloto/marker.py Show resolved Hide resolved
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 16, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 16, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 16, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 16, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
@PeterJCLaw PeterJCLaw force-pushed the fix-spherical-coordinates branch from 8a6efea to 8047c67 Compare October 16, 2022 20:40
@PeterJCLaw
Copy link
Contributor Author

env/lib/python3.10/site-packages/numpy/init.pyi:638: error: Positional-only parameters are only supported in Python 3.8 and greater

Oh yay, looks like CI has picked up that broken mypy version.

@PeterJCLaw
Copy link
Contributor Author

env/lib/python3.10/site-packages/numpy/init.pyi:638: error: Positional-only parameters are only supported in Python 3.8 and greater

Oh yay, looks like CI has picked up that broken mypy version.

#306 fixes that.

PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 17, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 17, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 17, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 17, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 17, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
PeterJCLaw added a commit to PeterJCLaw/zoloto that referenced this pull request Oct 17, 2022
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
@PeterJCLaw PeterJCLaw marked this pull request as draft October 18, 2022 17:02
@PeterJCLaw PeterJCLaw force-pushed the fix-spherical-coordinates branch from df2527b to f4a337a Compare October 21, 2022 14:50
@PeterJCLaw
Copy link
Contributor Author

Have rebased on #312.


Zero values for April Tags markers have the marker reference point at
the top left.
"""
return self.yaw

@property
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These don't really make sense with the current coordinate system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on what you mean? Both in terms of which version you're referring to as "current" and which of the properties you're referring to here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yaw, pitch and roll do not line up with their standard definition https://en.wikipedia.org/wiki/Aircraft_principal_axes?wprov=sfla1

For instance yaw is a rotation about the vertical axis which is not the case here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably say that the correct fix here is to fix the incorrect convention, as we discussed in the kit team meeting last night.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately changing the mappings of which axes are which has the potential to be severely breaking to competitors code.
Even the changes which are in this branch as it stands are technically breaking, though relatively unlikely to affect most cases (and have the advantage of making this logic match what's actually in the SR docs).

@trickeydan
Copy link
Contributor

@PeterJCLaw What do we need to do to move this forward?

@PeterJCLaw
Copy link
Contributor Author

PeterJCLaw commented Nov 19, 2022

@PeterJCLaw What do we need to do to move this forward?

In local terms it needs rebasing/merging/something to fix the conflicts with master. I think I have half a branch which does that somewhere, but I'm not sure (don't wait for me to find that if you want to take this on). (edit: have done this)

More generally there needs to be a decision made about how happy we are to break competitor code. The changes here are technically breaking, even if they do fix what is arguably a bug in the code to make it match the SR docs.

It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
It would be great to document the orientation of the axes etc.,
however that's already in flight in RealOrangeOne#302
so leaving that for now.
This was determined by experimentation with an old printed marker
I had to hand. There's some slight oddness here in that the values
suggest the marker I have is upside down, however that seems to
disagree with other sources I've checked for the same marker.

Also worth noting that I don't have a calibration for the camera
I used, so this is based off another calibration I found for the
same resolution.
Derived from testing of the current system.

This includes moving the construction of the coordinates into the
type as that is functionally where the definition of the nature of
the spherical coordinates comes from.
This helps understand the relationship between these and ensures
that changes aren't accidental.
This changes the Spherical coordinates to (almost) following the
ISO convention. Consequently there are a number of changes to the
values, notably:
 - the reference positions for each angle changes
 - the interpretation of the angles changes

See inline documentation for the interpretation of the values now.

Fixes RealOrangeOne#300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Construction of Spherical leads to unknowable position differences
4 participants