# Determine the compensation models for the Hexapod, including coefficients

XMLWordPrintable

#### Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
• Story Points:
2
• Sprint:
TSSW Sprint - Aug 3 - Aug 17
• Team:
Telescope and Site
• Urgent?:
No

#### Description

Determine a suitable model for Hexapod compensation, with coefficients.

#### Attachments

1. fits_cosine_polynomial_camera.png
125 kB
2. fits_fourier_camera.png
105 kB
3. fits_polynomial_camera_order_5.png
103 kB
4. HexapodFitting.zip
782 kB

#### Activity

Hide
Russell Owen added a comment - - edited

Thanks to Bo Xin [X] for the following data sources:

Compensation for elevation:

Compensation for temperature:

• Document 7334 (a powerpoint presentation) page 9, which lists the fit coefficient of expansion.

I used the elevation spreadsheets and the attached code to fit various models for elevation. I found:

• A Fourier series worked best: f(el) = C0 + C1 sin(el) + C2 cos(el0 + C3 sin(2 el) + C4 cos(2 el) + .... This model can also be used for azimuth, since it wrap around at 0/360.
• A standard polynomial worked well: f(el) = C0 + C1 el + C2 el^2 + .... This is not suitable for azimuth compensation.
• A "cosine polynomial" did not work very well: f(el) = C0 + C1 cos(el) + C2 cos(el)^2 + .... This can be used for azimuth compensation.

Tiago Ribeiro decided we should use the standard polynomial for now so I did the following on DM-25856:

• I coded the standard polynomial for elevation compensation and removed azimuth compensation. (Before this ticket I had coded a cosine polynomial, as per Tiago Ribeiro's initial request).
• Added the fit coefficients to the default.yaml config file in ts_config_mttcs on the same ticket. I am not positive I got the sign of the corrections correct.
• Added support for the Fourier series to ts_hexapod, so we have it available. I personally think we should use it.

Note: I found that scipy.optimize.curve_fit did a far better job than numpy.polyfit so I used that for all fitting.

I also attached 3 of the graphs – all for the Camera since it is a bit harder to fit than M2.

Show
Russell Owen added a comment - - edited Thanks to Bo Xin [X] for the following data sources: Compensation for elevation: M2 hexapod: https://github.com/bxin/hexrot/blob/master/LUT/M2%20Hexapod%20Motions%20in%20Elevation%20Axis%202020%2007%2023.xlsx Camera hexapod: https://github.com/bxin/hexrot/blob/master/LUT/Camera%20Hexapod%20Motions%20in%20Elevation%20Axis%202020%2007%2023.xlsx Compensation for temperature: Document 7334 (a powerpoint presentation) page 9, which lists the fit coefficient of expansion. I used the elevation spreadsheets and the attached code to fit various models for elevation. I found: A Fourier series worked best: f(el) = C0 + C1 sin(el) + C2 cos(el0 + C3 sin(2 el) + C4 cos(2 el) + .... This model can also be used for azimuth, since it wrap around at 0/360. A standard polynomial worked well: f(el) = C0 + C1 el + C2 el^2 + .... This is not suitable for azimuth compensation. A "cosine polynomial" did not work very well: f(el) = C0 + C1 cos(el) + C2 cos(el)^2 + .... This can be used for azimuth compensation. Tiago Ribeiro decided we should use the standard polynomial for now so I did the following on DM-25856 : I coded the standard polynomial for elevation compensation and removed azimuth compensation. (Before this ticket I had coded a cosine polynomial, as per Tiago Ribeiro 's initial request). Added the fit coefficients to the default.yaml config file in ts_config_mttcs on the same ticket. I am not positive I got the sign of the corrections correct. Added support for the Fourier series to ts_hexapod, so we have it available. I personally think we should use it. Note: I found that scipy.optimize.curve_fit did a far better job than numpy.polyfit so I used that for all fitting. I also attached 3 of the graphs – all for the Camera since it is a bit harder to fit than M2.
Hide
Russell Owen added a comment - - edited

In addition to the graphs in the attachment, please see code in the "fitter" directory of ts_hexapod, which was added as the 2nd-to-last commit of: https://github.com/lsst-ts/ts_hexapod/pull/20

I would also appreciate a sanity check of the coefficients in Hexapod/v1/default.yaml in pull request: https://github.com/lsst-ts/ts_config_mttcs/pull/8

It may help to know that:

• compensated Hexpod position = uncompensated (user-specified) position + compensation_model(elevation, azimuth, temperature).
• There is no compensation for azimuth at this time. It will be added later if we find a need (once we can study the data an choose a suitable model, though I expect that the Fourier model will do fine).
Show
Russell Owen added a comment - - edited In addition to the graphs in the attachment, please see code in the "fitter" directory of ts_hexapod, which was added as the 2nd-to-last commit of: https://github.com/lsst-ts/ts_hexapod/pull/20 I would also appreciate a sanity check of the coefficients in Hexapod/v1/default.yaml in pull request: https://github.com/lsst-ts/ts_config_mttcs/pull/8 It may help to know that: compensated Hexpod position = uncompensated (user-specified) position + compensation_model(elevation, azimuth, temperature). There is no compensation for azimuth at this time. It will be added later if we find a need (once we can study the data an choose a suitable model, though I expect that the Fourier model will do fine).
Hide
Bo Xin [X] (Inactive) added a comment -

Thanks for the good work!

Show
Bo Xin [X] (Inactive) added a comment - Thanks for the good work!

#### People

Assignee:
Russell Owen
Reporter:
Russell Owen
Reviewers:
Bo Xin [X] (Inactive)
Watchers:
Bo Xin [X] (Inactive), Russell Owen, Te-Wei Tsai, Tiago Ribeiro