CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

24
CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010

Transcript of CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Page 1: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

CAOX and the LiCAS RTRSPatrick BrockillLiCAS Group5 Oct, 2010

Page 2: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Outline General discussion of Caox

What can it do? What is it missing?

Caox core design How Caox has become a generalised framework Reliance on external libraries and programs

Case study: the LiCAS Rapid Tunnel Reference Surveyor (RTRS) Provides motivation for much of what Caox can do Importance of including inner constraints

Caox operation Design matrix analysis Model verification

Future Future work on Caox Integration of Caox into other environments, e.g. S.A. 2

Page 3: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

What is Caox?A C++ framework of about 200 pgs (so far) for least squares

analysis Solve least-squares problems of the form

and constraints

for X as well as . Note that for our purposes we also require off-diagonal elements of

Designed to call and be called by external libraries Allows for mathematical rigour Designed for “calibration” and “operation/reconstruction”

problems involving rotations/translations, but generally applicable

Already used in LiCAS, Mona Lisa for calibration A work in progress

3

Page 4: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

What is Caox missing? User friendliness for input

A way of graphically inputting the problem 3D input engine Measurement input

It's own optimisers and algebra routines (framework) Can also be seen as a strength

Best optimiser for each problem Performance depends on optimiser, algebra routines Direct user intervention can dramatically increase speed and size

Status in commercial products unclear Possibly supply own, but potentially much work

A user base: interest and motivation Input from those working in geodesy 4

Page 5: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Caox CoreAt the core, Caox relies on C++ templates for definitions of

F(X) and constraints

Disadvantages: Compilation required

Advantages (amongst others): Speed (important for external libraries) Allows us to define F(X) and constraints once yet

evaluate in many ways

5

Page 6: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

LS Problems:Mode of Attack

Addresses 3 common aspects, applicable to many problems:

(1) Formulation of the Model

(2) Optimisation

(3) Error Analysis

6

Most externally available software focuses on (2) and (3)

We focus on (1) and (3) Simple Gauss-Newton w/line fit for (2) Add support for calling other optimisers

Rely on publicly available external libraries Numerical BLAS, LAPACK, etc. Semi-Symbolic ADOL-C Symbolic GiNaC

Caox has been generalised to include not only our originalspecific problems, but many more kinds of least square (LS)problems in general

Page 7: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Typical ProblemsConsidered So Far

Measurement apparatus calibration Element of F(X) large composition

of functions (e.g. rotations and translations), 150 pages for one element of F(X)

O(2000) elements of X Design matrix A=dF/dX frequently

relatively dense Regularity problem: elements of L

missing

Measurement apparatus operation: “reconstruction”

Very large O(106) elements in X 7

L=F(X)

F1

M

F3000

M

F6000

⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟

150 pgs.

L1

M

L2999

L3000

L3001

M

L6000

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

A =

∂F1

∂X1L ∂F1

∂X M∂F2

∂X1L ∂F2

∂X M∂F3

∂X1L ∂F3

∂X M

M O M∂FN∂X1

L ∂FN∂X M

⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟

L1

M

L2999

L3001

M

L6000

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

Page 8: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Arbitrary precision: “quick

and dirty” calculations despite

rounding errors, large condition

numbers, near-singular matrices,

e.g.

Caox: Research & Planning

Input from (amongst others): DESY Geodesy, DESY Physics, Oxford Mathematics, Oxford Photogrammetry, Oxford Engineering, Oxford Physics

Literature: sometimes back to original geodesy literature in German.

8

Software planning:Investigated modellers, modelling languages, optimisersKeeping in mind, e.g.:

Costs Irregular measurements Data input format Graphical checks

Page 9: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

9collider component

Tunnel Wall

Reconstructed tunnel shapes(relative co-ordinates)

wall markers internal FSI external FSISM beam

Case Study: RTRS Survey

Source: Armin Reichold

Page 10: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

10

RTRS in Motion

Page 11: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

11

Local RTRS Operation

Multilaterationto DetermineWall Marker“External FSI”

Need to Relate PositionsOf Cars: Need To Introduce aCommon Object Between Them

Laser line passed through all cars…Then reflected back along itself…

Then split off and observed.Able to determine some rotationsand translations this way.“Laser Straightness Monitor” (LSM)

We use gravity, i.e. tilt sensors, to determine some rotational d.f. But this is not enough.

But none of these systemsdetermines distance betweencars so this must also bemeasured: “Internal FSI”

Basic Elements (“Subsystems”):1. Distance between two points2. Intersection of a line and a plane3. Tilt sensor

Our Goal: Determine the best positions for the wall markers which agree with our data

…But first we have to find the positions/orientations of the internal elements (“Calibration”). Caveat: we can’t just measure this...

"Calibration dance": one car at a timeis translated... and rotated (at the same time).

Hopefully at some point, X in L=F(X) is uniquely determined

Page 12: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

12

Laser Tracker Aided Calib.Additional observations of the car movements to be used if necessary

Page 13: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Characterising the RTRS Problem

Measurement vector L is a large composite quite non-linear function

We need to a way to verify functional form of F(X)

Equality constraint equations also frequently just as composite, complex

Poor condition number of design matrix

Require careful calculation of derivatives in design matrix

Near “symmetries”, graphically visualised and analysed

Regularity problem in actual data

Inner constraints a must13

Page 14: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Multilateration Prototype

14

P1

P4 P3

P2

x

y

?

?

?

?

?L4

L3

L2L1

{L1,L2,L3,L4}(1)

?

L4 L3

L2L1

{L1,L2,L3,L4}(2)

L4 L3

L2L1

?

{L1,L2,L3,L4}(N)

3 Constraints:Trans.: P1x=P1y=0Rot.: P2y=0

L1(i) = (P1x −Qx

(i))2 + (P1y −Qy( i))2

L1(1)

M

L4(N )

⎜ ⎜ ⎜

⎟ ⎟ ⎟=

F1(1)(P,Q)

M

F4(N )(P,Q)

⎜ ⎜ ⎜

⎟ ⎟ ⎟

L=F(X)

Q(i)

X =

P1x

M

P4y

Qx(1)

M

Qy(N )

⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜

⎟ ⎟ ⎟ ⎟ ⎟ ⎟ ⎟

+constraints

Four Launches in 2D Plane Observing Randomly Moved Retroreflector

Essentially, looking for X=F-1(L)

More correctly, we want to minimise the “objective function” [L-F(X)]2 Least Squares Optimisation

In this example, we call this “calibration”

And we want the errors on the parameters X

Page 15: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Mulilateration (cont.)

15

P1

P4 P3

P2

L4 L3

L2L1

?

✓✓ Q

Given: P1 …P4 and L1…L4. Find Q.

Smaller problem than previous slide

We call this “Reconstruction” or “Operation”

Another least squares problem

How can we make self-calibratable apparati which make optimal measurements?

What are the weak points in a design?

3 Processes(1) Calibration

(2) Operation

(3) Design and Analysis

Positions and orientations of optical elements, some of which cannot (or only with much difficulty) be measured directly.

Performed by spatial rotations and translations of apparatus.

Once positions and orientations of optical elements are known, actually make measurements with the apparatus. Potentially large Submatrix of calibration covariance matrix required as input

Page 16: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Design Matrix AnalysisConceptually:

Hoberman sphere

Eigen. λ=0, λ≈0 can be disastrous

Nontrivial, surprisingly common Can be overcome with extra measurements, but reflect design weakness

3D visualisation very useful Best avoided in design stage

15

Page 17: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

External FSI Self Calibration

17

Wallmarker appears for observationQuill positions, blue dots, position in principle unknown and not directly measurableWall marker, orange dot, position also unknown6 length observations from quills to wall marker can this determine all of the unknown positions?

Perhaps if we took enough measurements in different wall marker positions, all positions would be determined (“self calibration”)

POV: looking at the unit from the tunnel wall

No. So also consider another wallmarker position

Page 18: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

18

Subsystem Symmetriesin the RTRS

All of these symmetries are overcome if we calibrate all subsystems together with the laser tracker included.

Nevertheless, still represent design weaknesses

No. There is no unique solution if the blue spheres representing the quills are on a conic section (parabola, hyperbola, circle)

Laser Straightness Monitor (LSM) is also not immune – we require three independent/non-parallel normals to the CCD planes

We could fix this symmetry by including one new distance measurement

Page 19: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Yrun[0_11737].car_ccd_xy[0][1][0] == -(cos(car_ccd_orient_0_1_1)*sin(car_ccd_orient_0_1_2)*(cos(Xrun_0_11737_car_orient_0_0)*sin(Xrun_0_11737_car_orient_0_1)*cos(Xrun_0_11737_car_orient_0_2)+sin(Xrun_0_11737_car_orient_0_0)*sin(Xrun_0_11737_car_orient_0_2))+cos(Xrun_0_11737_car_orient_0_0)*(cos(car_ccd_orient_0_1_0)*sin(car_ccd_orient_0_1_1)*sin(car_ccd_orient_0_1_2)-cos(car_ccd_orient_0_1_2)*sin(car_ccd_orient_0_1_0))*cos(Xrun_0_11737_car_orient_0_1)+(sin(car_ccd_orient_0_1_1)*sin(car_ccd_orient_0_1_0)*sin(car_ccd_orient_0_1_2)+cos(car_ccd_orient_0_1_0)*cos(car_ccd_orient_0_1_2))*(cos(Xrun_0_11737_car_orient_0_0)*sin(Xrun_0_11737_car_orient_0_1)*sin(Xrun_0_11737_car_orient_0_2)-cos(Xrun_0_11737_car_orient_0_2)*sin(Xrun_0_11737_car_orient_0_0)))*((sin(Xrun_0_11737_car_orient_2_2)*((cos(Xrun_0_11737_lsm_mirror_orient_0)^2*cos(Xrun_0_11737_lsm_mirror_orient_1)^2-sin(Xrun_0_11737_lsm_mirror_orient_0)^2*cos(Xrun_0_11737_lsm_mirror_orient_1)^2+sin(Xrun_0_11737_lsm_mirror_orient_1)^2)*(cos(Xrun_0_11737_car_orient_2_2)*sin(Xrun_0_11737_car_orient_2_0)-…

Yrun[0_11737].car_ccd_xy[0][1][0] == -(cos(car_ccd_orient_0_1_1)*sin(car_ccd_orient_0_1_2)*(cos(Xrun_0_11737_car_orient_0_0)*sin(Xrun_0_11737_car_orient_0_1)*cos(Xrun_0_11737_car_orient_0_2)+sin(Xrun_0_11737_car_orient_0_0)*sin(Xrun_0_11737_car_orient_0_2))+cos(Xrun_0_11737_car_orient_0_0)*(cos(car_ccd_orient_0_1_0)*sin(car_ccd_orient_0_1_1)*sin(car_ccd_orient_0_1_2)-cos(car_ccd_orient_0_1_2)*sin(car_ccd_orient_0_1_0))*cos(Xrun_0_11737_car_orient_0_1)+(sin(car_ccd_orient_0_1_1)*sin(car_ccd_orient_0_1_0)*sin(car_ccd_orient_0_1_2)+cos(car_ccd_orient_0_1_0)*cos(car_ccd_orient_0_1_2))*(cos(Xrun_0_11737_car_orient_0_0)*sin(Xrun_0_11737_car_orient_0_1)*sin(Xrun_0_11737_car_orient_0_2)-cos(Xrun_0_11737_car_orient_0_2)*sin(Xrun_0_11737_car_orient_0_0)))*((sin(Xrun_0_11737_car_orient_2_2)*((cos(Xrun_0_11737_lsm_mirror_orient_0)^2*cos(Xrun_0_11737_lsm_mirror_orient_1)^2-sin(Xrun_0_11737_lsm_mirror_orient_0)^2*cos(Xrun_0_11737_lsm_mirror_orient_1)^2+sin(Xrun_0_11737_lsm_mirror_orient_1)^2)*(cos(Xrun_0_11737_car_orient_2_2)*sin(Xrun_0_11737_car_orient_2_0)-…

Design and Verification

Design Graphical visualisation of small eigenvectors Simulation: optimisation, best method

Verification of Model By initial parameters Symbolically Graphically (3D)

19

Scale: 30,000λ=2.2×10-6

F(X

)

X

Measured

Predicted

644×330 Matrix

Page 20: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Future Plans for Caox Software Related

Hook into various optimisers, export to AMPL (A Math. Prog. Lang.) (used by, e.g., mathematicians, scientists), GAMS (Gen. Algebraic Modeling System), etc. Also provide a better default optimiser

Parallel processing: CUDA, OpenCL 64-bit memory processing (264B=106 TB) [232B=4 GB]

Dependencies already support this

Better visualisation: constraints, 3D: Blender, etc.

Theory Related Better utilisation of sparsity properties Particular elements of covariance matrix ΣX

Other objective functions, e.g. F(X,L)=0, rather than a class of these of the form F(X)=L

20

Page 21: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Caox in Other Environments Possible integration path in S.A.

Export .C, .h files corresponding to internal S.A. representation Or work directly on program save files

S.A. graphics engine

Uses Alternate optimizers Symbolic representation of F(X), constraints Scientific publications (various methods for comparison, mathematical

rigour) Exotic changes to F(X) not easily accommodated in S.A. Block handling of A for large problems Self-calibration analysis Report full Tool for SA developers

21

Page 22: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Example F(X)

22

Page 23: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Constraints

Additional complications over problems without constraints, but are so important difficult to see how to avoid

Inner constraints Improving convergence, e.g. quaternions Define a new to allow, e.g. calc of

23

x1

x2

x3x2-x1

x3-x2

We measure x1 x2 x3 in RTRS's coordinate system

But we are actually interested in x2-x1 and x3-x2

Page 24: CAOX and the LiCAS RTRS Patrick Brockill LiCAS Group 5 Oct, 2010.

Constraints

Fixing poorly defined elements of X which contribute to large condition numbers and poor convergence properties, but don’t particularly affect the quantities we are interested in.

24

Coordinates of internal FSI quill- retroreflector pairs not well determined in transverse directions

We can just fix them to what we like - the overall effect on the accuracy is almost zero if moved correctly