Changes between Version 1 and Version 2 of Sensors/LeicaLIDAR/MashUp


Ignore:
Timestamp:
Sep 24, 2008 4:22:13 PM (11 years ago)
Author:
mark1
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Sensors/LeicaLIDAR/MashUp

    v1 v2  
    11= LIDAR Notes =
     2
     3Notes from visit to Leica, Switzerland on 11/Aug/2008.
     4
     5Contact email:
     6 * sensors_emea@leica-geosystems.com
     7 * Various support engineers at Leica.  The one that trained us was Barbara Haebler.
     8
     9FTP site (for updates, etc):
     10 * ftp://airborne:LsA36GmW@ftp.leica-geosystems/airborne/
     11 * problem uploads to go to incoming/ dir
     12
     13--------------------------
     14
     15== Overall system design and comments of note ==
     16
     17System is a Leica ALS50 (phase II) LIDAR.  There is an accompanying 39 megapixel [7216x5412, 12bit] digital camera, referred to as the "RCD".
     18
     19A GPS receiver and IMU (brand?) are included.  The LIDAR, RCD and IMU, are mounted on a shock plate to protect it from strong movements - this will also isolate the IMU from the hyperspectral imaging sensors.
     20
     21The IPAS controller (name correct?) allows for event recording, amongst other things.  Phil plans to use this to record frame sync pulses from Eagle and Hawk.
     22
     23There are also some associated control and display devices for operator and pilot usage.
     24
     25=== How it works ===
     26
     27The LIDAR works by firing a (4ns or 9ns) laser pulse downwards and measuring the roundtrip time for the light pulse to return, then converting this to a distance.  The pulse isn't modulated by a carrier - it's just an on/off pulse.  There are four timing cards ("range cards R1-R4") running for a pulse, so up to 4 returns can be detected (R4 actually detects the last return rather than the 4th?).  The system has a "MPiA" (Multiple Pulses in the Air) mode, which fires two pulses evenly separated, rather than waiting for the first to come back before firing another [SPiA mode, times out in case the pulse is eaten].  To measure this, there are actually two banks of timing cards (bank A and bank B, both with R1-R4 cards), so there are 8 timing cards in total.
     28
     29A minimum time separation between two returns means the minimum distance between two returns must be at least 2.7m for them to be counted as independent.  The expectation for the number of returns is 1 return ~100%, 2 returns ~10%, 3 returns ~1%, 4 returns ~0.1% of points - obviously this varies with the terrain.  When there are 4 returns, each range card measures the time of the return pulse.  When there are less than 4 returns, R4 is a second measurement (not a copy of) of the last pulse - i.e. if there are 2 returns, you will have R1, R2 and R4 (= re-measurement of R2).
     30
     31The intensity of a return is measured only for the first 3 returns (R1-R3), and is an 8 bit value (0=dark (water), 255=bright) relating to the reflectivity of the illuminated surface.  The value is amplified by an automatic gain controller, and is not related to a physical measure (can it be?).  The intensity can be used in various processing algorithms to help distinguish transitions between surfaces.  The AGC tries to keep the intensity in the range 100-150 or so.
     32
     33The laser is scanned across a (up-to) 75 degree swath by an oscillating mirror.  Due to the acceleration/deceleration of the mirror, this produces a sinusoidal pattern to the trace on the ground, with the highest density of points at the peak and trough of the sine wave (i.e. at the edges of the swath).  If the swath width is set to less than 75 degrees (45 degrees recommended), there's a roll compensation mechanism that tries to smooth out small roll movements by using the remaining freedom of motion.  The scan rate of the mirror is dependent on the FOV angle (36Hz for 40 degree FOV, 24Hz for a 75 degree FOV, calculate with 412.33 * FOV^-0.6548).
     34
     35The laser is an 8W class 4 laser, operating in the infrared range.  The divergence results in approximately a 22cm spot on the ground when fired from 1000m up.
     36
     37Controllable parameters:
     38 * laser intensity (0 -> 8W output), controlled by operator as a percentage output.  Has safety cutouts if the light level at the ground could cause eye damage.
     39
     40 * altitude (kinda a parameter ;) ) - minmium of ~650 up to ~2000m (after 2km, you start getting poor returns on forests, etc, the real limit is up to about 6km in ideal conditions)
     41 * ... pulse frequency, scan angle, etc [TBD]
     42
     43
     44
     45
     46
     47
     48=== Automatic Gain Control ===
     49
     50The intensity of a return is measured (R1-R3) as an 8 bit value (0=dark (water), 255=bright) relating to the reflectivity of the illuminated surface.  The value is amplified by an automatic gain controller to keep it within 8 bit range.  The value of the AGC is also measured as an 8 bit value and is recorded per pulse as the "gain control voltage" in the raw files.  Typical values are 110-180.
     51
     52The AGC is controlled automatically in our LIDAR, but operates on a threshold basis.  If there are N (64?) low intensity points in a row, the AGC will step up one level.  If there are M (32?) overbright points in a row, the AGC will step down.  This may lead to visible steps in the image intensity, but isn't supposed to be a big problem.  Look out for streaky areas though ("contact support if you see this" - though not sure why).
     53
     54
     55== RCD camera ==
     56
     57The system has a 39 megapixel digital camera, referred to as the "RCD", with the following characteristics:
     58 * 7216x5412 resolution, 12bit [=~57MB raw]
     59 * 60mm lenses (changeable), with 44.2 degree x 34 degree FOV
     60 * pixel size 6.8microns (= ~15cm ground resolution at 1350m)
     61 * 1/4000 exposure time, 2.2s per frame
     62 * serial number 21
     63 * shutter is curtain style, taking 8ms to open and close, so there's a 4ms time difference between the top and bottom of the CCD stopping acquiring light
     64
     65Logfiles contain various handy info, notably the image event file contains GPS time, pos/att and picture id
     66
     67Calibration files are required and supplied by Leica (dark, gain and camera parameters).
     68
     69File name convention is: `DDHHMMSSXXXXXXGN.raw`
     70 * DD = day of month
     71 * HHMMSS = timestamp
     72 * XXXXXX = incrementing picture id
     73 * G = gain (1-4)
     74
     75=== Orthophotos ===
     76
     77This apparently takes another week long training course.  We do have the basic software to do it but limited knowledge.  Basic process is to determine the camera parameters, correct and overlay the images, keeping ideally only the most central parts.  You then have to manually check through, especially along seams, and manually move the seam line in some instances (e.g. when perspective effects result in odd errors due to the seam hitting a tall building).
     78
     79--------------------------
     80
     81== Recommendations ==
     82
     83Perform calibrations frequently at the start of the period to get a feel for how they hold.  Reduce down to fit circumstances over time.
     84
     85=== Mission planning considerations ===
     86
     87Water absorbs IR, so expect poor returns from wet surfaces.  Ideally one should wait for a whole dry day after rain.
     88
     89For differential GPS, aim to have a base station nearby (within 20km) and ideally in center of the scene.  Base station data should be recorded at 2Hz
     90
     91Ideally choose a time with a good GPS constellation (lots of satellites, PDOP >= 4).
     92
     93Consider terrain and minimum target size to determine required point density.  Steep terrain may cause shadowing effects due to perspective.
     94
     95Consider reflectivity of surface - lighter surfaces need less laser power.  Too high a power means intensity overflows on the reflection, which mess up the range - AGC should deal with this for large areas but it should be considered in planning, particularly for small bright targets on a generally darker background.  Assume 10% reflectivity is typical.
     96
     97Recommended to do a figure 8 loop at the start and end of the data acquisitions to make the IMU happy.  Need one at the end for reverse navigation processing.
     98
     99Selecting a smaller FOV gives a higher resolution since uses a faster scan rate. With a large FOV shadowing may occur in the data.
     100
     101---------------------------
     102
     103= Processing =
     104
     105== Required items for processing ==
     106
     107Items required from every flight:
     108 * GPS and IMU data (including a basestation if not using PPP)
     109 * Raw laser data
     110 * Logfiles from LIDAR
     111   * Flight logfiles are useful too, if the LIDAR flight planning software is used
     112 * RCD & webcam images
     113 * Pressure and temperature measurements at the plane position above the site [this affects how long it takes the laser light to move through the air]
     114
     115Items required in general:
     116 * calibration (see elsewhere)
     117 * lever arm measurements
     118
     119== Extraction ==
     120
     121Use IPAS Pro to extract GPS, IMU and laser data from the raw files.
     122 * probably worth having the real time navigation info (doesn't add a lot of processing time)
     123 * during extraction, view the listing and verify the lever arms are correct (IMU one should never change).
     124 * look out for data gaps (listed in log)
     125
     126
     127Most Leica systems are mounted "laser backwards" (cables will be at the rear if this is so) - ensure that z=180 in the IPAS Pro aircraft tab.
     128
     129== Navigation processing ==
     130
     131See other pages on navigation processing as they cover this already.
     132
     133== General processing ==
     134
     135''Mark covered this better''
     136
     137-----------------------
     138= QC =
     139
     140== Things that may go wrong ==
     141
     142=== In flight ===
     143
     144Flying too low - if the LIDAR detects that the laser power may be too high for eye safety, it will cut out the laser automatically (if you're a seagull looking up, bad luck, it only accounts for ground height).
     145
     146Flying outside the "range gate" (acceptable ranges of distances) may cause similar effects.  Going too high will tend to make the edges of the swath drop out first (due to path length).
     147
     148Automatic gain control weirdness - the measured intensity is returned via an AGC which may step up or down depending on the returns from the ground.  Measured return intensity should only be used as a guideline rather than a real measurement.
     149
     150Laser power too high - if the intensity overflows (reaches 255), the intensity based range correction will probably be wrong.  For example, a freshly asphalted road with bright white reflective (overflowing) strips may appear with the strips appearing to float up to 20cm above the road surface.
     151
     152Water absorbs IR, so expect poor returns from wet surfaces.  Ideally one should wait for a whole dry day after rain.
     153
     154=== In processing ===
     155
     156Most Leica systems are mounted "laser backwards" (cables will be at the rear if this is so) - ensure that z=180 in the IPAS Pro aircraft tab.
     157
     158Streaky intensity images - "bad, contact support for guidance".  These will probably cause range errors due to the intensity variation, no idea what the cause would be as yet..
     159
     160Poor accuracy at edges - consider trimming the swath width (reduce processed angle) to cut off bad edges.
     161
     162=== Other error sources ===
     163
     164Atmospheric effects; the light path may bend due to atmospheric refraction, density effects, etc causing the laser to hit the ground earlier or later than expected, or in a different position.  This will be most noticeable at the edges of the swath where there are longer path lengths (and more atmosphere to pass through) and may look like the swath curls up or down at the edges (path length error), or may look like compression or stretching of the edges (if there is horizontal divergence).  The error was claimed to be a fraction of a meter at 6km altitude (i.e. not well bounded).  Measurement of temperature may help with this effect, but was said to be a minor value.
     165
     166Range correction error; if the range correction is wrong, the electronics will measure the path length incorrectly.  Points at nadir will be in error vertically only and points at the edge will have a vertical and horizontal error.  The error will make a flat piece of land look like a smile and the nadir point will be below the expected land surface (one can only get "late" measurements?).
     167
     168Torsion (of mirror) error; the mirror may be out of the expected position at the edges of the swath due to it bending under high acceleration.  There will be no error at nadir (no acceleration) and errors at the edges, inducing a smile effect again, but with the nadir at the correct height.  Range errors should be corrected before working on the torsion error, and the nadir point should be used for the range correction as there will be no mirror torsion effect there.
     169
     170MPiA mode errors: if a seagull gets in the way of the second pulse before the first pulse has returned, things will mess up.  On an edge of a very unluckily placed cloud, this would look a bit like the cloud merging into the ground.  Presumably rare or minor.
     171
     172
     173== Initial QC ==
     174
     175See if the lines are too short or if the point cloud has poor return %s.  If so, check the following (look at webcam images for hints):
     176 * clouds
     177 * height problem ("range gate" issue)
     178   * eyesafe shutoff (too close to ground)
     179   * too high may give dropouts
     180   * find altitude over ground (measured GPS alt - geoid-spheroid height) and see if it's within the min & max ranges
     181 * check the speed they were flying at is not too fast
     182
     183Laser power too high - if the intensity overflows (reaches 255), the intensity based range correction will probably be wrong.  For example, a freshly asphalted road with bright white reflective (overflowing) strips may appear with the strips appearing to float up to 20cm above the road surface.
     184 * filter out incorrect points (based on high intensity and height difference from locality?)
     185 * also, if you observe odd spikes, check for intensity over 150 - this may indicate a two-peaked response with the first peak being 150 (and being the detected one) and the second being 255 (overflow), causing the effect above
     186
     187
     188== Full QC procedures ==
     189
     190The general processing data QC-ing should primarily take the form of viewing the intensity images to check for striping and to see if they look “correct” i.e. Does it look like the area surveyed. The data should be loaded into TerraScan and checked that all the flight lines line up OK both spatially and vertically (check cross sections around the image).
     191
     192The main things are:
     193 * profiles
     194   * profiles along averaged areas
     195   * profiles along a track (e.g. following a ditch / feature in the surface)
     196   * narrow profiles across features where swaths overlap
     197 * comparisons against GCPs
     198   * requires the point cloud to be converted to a surface - also useful if no local DEM available for hyperspectral instrument processing.
     199
     200We may want to do some initial classification (or filtering) of points to remove noisy points, but we shouldn't do a full classification. See classification procedure below.
     201
     202--------------------------
     203= Calibration =
     204
     205Calibration procedure is boresight first, then range correction and finally checks, validation and fine tuning
     206
     207== Parameters needing calibration ==
     208
     209Boresight parameters (pitch, roll, heading).
     210 * Angle between straight-down and what the sensor thinks is straight-down, as it's mounted in the plane.
     211   * Angle between a line from the sensor head (mirror centre) to the point on the ground at the centre of the swath and a line from the sensor head to the centre of the spheroid (or the reference frame's Z axis?).
     212 * Measured in calibration procedure
     213   * '''We need to do this'''
     214
     215Pitch error slope.
     216 * The mirror will not be mounted exactly flat to the laser so, as the mirror moves, the pitch of the beam will change by a small amount.
     217   * Roll and yaw either have no error slope (laser position central? geometry means no effect?) or a negligible effect (presumably, as there's no parameter)
     218 * Measure pitch at nadir and at swath edges to determine how the pitch changes - the first order for this is is the pitch error slope.
     219 * Measured in calibration procedure
     220   * Correct pitch error (at nadir) first
     221   * '''We need to do this'''
     222
     223Lever arm measurements:
     224 * IMU -> sensor head (centre of mirror?)
     225   * Measured in the factory and provided by Leica
     226 * IMU -> measurement point [front left corner of the casing]
     227   * Measured in factory and provided by Leica
     228 * measurement point -> GPS antenna centre
     229   * '''We need to measure this one with a survey'''
     230
     231Range offset correction (+range card calibration).
     232 * Correction for the slightly different timing of the 4 range cards in both banks in the system.
     233 * At a set distance, the range cards should all return the same result.
     234 * '''Measured by Leica but also measured and verified in calibration procedure.'''  (see below)
     235
     236Mirror torsion parameter.
     237 * This measures how much the mirror flexes at the edges of the swath, when under high acceleration, putting it out of position.
     238 * Later Leica mirrors (including ours) are much stiffer and apparently do not flex.
     239 * Fixed very high (negative) value (-100,000 N?) meaning "no measurable flex".
     240 * Can be measured during the calibration procedure, but should never be necessary.
     241
     242=== Factory calibrated ===
     243
     244Intensity Based Range Correction (IBRC).
     245 * A range correction based on the reflectivity of the target object ("reflections are slower on darker objects"?  perhaps this is more that a lower intensity return may take longer to be detected - i.e. takes longer for enough photons to come back to exceed the detection threshold).
     246 * Measured in factory and provided by Leica.
     247
     248Transitional Pulse Rate.
     249 * 2 pulse widths are used (4ns and 9ns) depending on the pulse frequency (higher frequencies require a shorter pulse time), with the system switching over to a shorter pulse at a set frequency (around 120KHz?).  This parameter measures the time difference for the pulses' return.
     250 * In our system, this distance is of the order of 11cm.
     251 * Measured in factory and provided by Leica.
     252
     253Encoder Offset (scan angle correction).
     254 * The rotating mirror has a (optical?) shaft encoder attached that tells it the position of the mirror.  The mirror will not be mounted exactly at nadir relative to the shaft encode and this value measures the offset between the centre of the scan pattern and the centre point of the encoder.
     255 * The value is measured in "ticks" and will appear quite high as the shaft encoder has a high resolution (order of millions of ticks).
     256 * Measured in factory and provided by Leica.
     257
     258
     259== Calibration site requirements ==
     260
     261Calibration flight pattern consists of:
     262 * 2 crosses at different heights (700m and 1350m)
     263 * a line, opposing line and a parallel line (at 2300m)
     264 * the parallel line should have a "sizeable" overlap (50%?)
     265
     266The features required for a perfect cal site are:
     267 * Need a source of multiple returns - tallish (15m) trees in a forest are best.  Try to include a treed/forested area in some parts of the flight lines (doesn't have to be in all, nor in the central area).  The multiple returns are required for the range card calibration (see below).
     268 * Straight, flat areas made of a hard substance that'll generate only one return pulse.  Roads or runways ;)  These are used in the boresight (roll) and range calibrations.
     269 * Sloping areas are used to detect pitch and heading errors in the boresight calibration.
     270   * A road running up a hill is good for pitch (vertical change in surface easily found in the image).  These are good for measuring along-track shifts.
     271   * Slopes with peaks (house rooftops are ideal) with the peak cutting across the line of flight ( `--->  /\` ).  Again good for measuring along-track shifts.
     272 * An accurate ground survey (see below).
     273 * Slow overflight for maximum point density.
     274
     275=== For range offset calculation ===
     276GCPs required, ideally 1cm vertical accuracy (between all measurements rather than absolute?).
     277
     278Around 30-40 GCPs should be within the area covered by a 14 degree swath (+/- 7 degrees either side of nadir) taken at an altitude of ~750m [= ground swath width of about 180m].
     279
     280=== General accuracy measurements ===
     281Other GCPs (number?) should be scattered around a wider area within the full swath width - typically run at 45 degrees [=620m wide on ground @ 750m alt] or to a max of 75 degrees [=1150m], though 75 degrees will introduce more errors..
     282
     283== Quality, accuracy, etc ==
     284
     285A nominal quality of 5-10cm (vertical) is suggested as a reasonable output.  If one has GCPs, it should be possible to do better (EA claims 1-2cm).
     286
     287
     288------------
     289
     290== Range offset calibration ==
     291
     292Range offset correction (+range card calibration) is to correct for the slightly different timing of the 4 range cards (R1-R4) in both banks (A & B) in the system, and to correct any overall ground offset.
     293
     294Two datasets are required:
     295 1. A real dataset with:
     296   1. a source of multiple returns, such a forest (for step 1 below)
     297   1. a strip with well known distances (for verification)
     298 1. BIT (Built-In Test) mode data, where the range cards are all electronically fed with identical fake data representing the same distance.  All cards should give the same result, so differences are used to calibrate each card against the others.
     299
     300First, we need to determine the timing differences between the 4 range cards (R1-R4) in each bank.  To do this, we use a dataset with multiple varying returns present - we need combinations of 2-4 returns (forests are good for this, being tall and porous enough to give multiple returns).  When there are less than 4 returns, R4 is a second measurement (not a copy of) of the last pulse - i.e. if there are 2 returns, you will have R1, R2 and R4 (= re-measurement of R2).  This is exploited to compute the difference in timing between R2 and R4 (averaging many 2-returns).  Similary 1-return and 3-return pulses are used to measure R1-R4 and R3-R4 differences.  The end result is a set of timing differences between all the cards in a bank.
     301
     302Second, we need to establish the timing differences between bank A and bank B.  As with the first step, we need the timing cards to measure exactly the same instant.  To do this, we use BIT mode data, where R1 in both bank receives the same electronically generated pulse at the same instant and are thus measuring the same event.  Averaging these numbers gives the timing offsets between the R1 cards, which can be combined with the first measurements to establish timing between all cards.
     303
     304Procedure:
     305
     306Can do range correction if the boresight results are good. This is a 2 stage process:
     307
     308 * 1. Nominal offset determination A1
     309 * 2. Define relative differences for A2,A3,A4 and B1,B2,B3,B4
     310
     311points have approx. the same range error within +/-7 degrees of Nadir, so we look only at this region firstly.
     312
     313 * In ALSPP filters dialog set the angles to +7 and -7 degrees, change the output directory (to 02a_Roff+-7deg if using suggested directory structure) and run the processing on the 4 low altitude flight lines.
     314 * Load the results into TerraScan and use the 30-40 GCPs of the calibration site.
     315 * Tools -> Output Control Report
     316 * Browse -> GCP file and remove bad points (maybe an error occurred in the surveying of a certain point)
     317 * Look at the dz value, the average dz is used for the nominal range offset A1.
     318 * Save the text file.
     319
     320Preferably using data including areas of forest and the BIT mode data, run RangeCardCal (from ALSPP tools menu) and enter the average dz value as A1 to get the other offsets. Add the outputs to the ALSPP dialog and save the settings reg file (to a new name)
     321
     322To check these results re-run using the full FOV (~45 degrees) and check average dz is less than 1cm or so, and standard deviation <5cm in TerraScan control report. (also look at cross sections)
     323
     324Then process the 4 high altitude flights in ALSPP and check in TerraScan (around nadir and swath edges)
     325
     326Finally load in all flights into TerraScan (within a fence if memory issues) and check them (ideally along a stream because this has a “good” profile) Can use the travel path tool in TerraScan for comparing cross sections along a path.
     327
     328= Boresight calibration =
     329
     330The basic method is similar to the imaging instruments, but exploits the measurement of range.  A set of flight lines and data points are chosen, in a particular order, such that specific calibration parameters are isolated.
     331
     332== Manual procedure and QC of automatic procedure ==
     333
     334=== Pitch ===
     335
     336Take opposing flight lines.  If there is a pitch error, the lidar will be sensing pulses ahead/behind (along track) the nadir point.  There will be a small overall range error, but the main effect will be that the data is shifted backwards/forwards of where it should be.
     337
     338Search for areas close to nadir where the height of the surface changes in an clear and predictable fashion, with reasonable sampling density (e.g. a road leading up a hill, or rooftops with their peaks going across-track).
     339
     340Take along-track profiles on both opposing flightlines.
     341 * If there is no pitch error, there will be no offset and the resulting profiles will coincide (the hill profiles will overlay and look like `/`).
     342 * If there is a pitch error, the profiles will be offset along track and the resulting profiles will not coincide (the hill profiles won't overlay and will look like `/  /`).  By measuring the along-track offset, one can estimate the pitch error.
     343
     344One must use profiles close to nadir to avoid being affected by the pitch-error-slope parameter (see below).
     345
     346Repeat until the pitch error has been removed.
     347
     348=== Roll ===
     349
     350If there is a small roll error, surfaces will be tilted up on one side of the swath and down on the other.  In opposing lines, these errors will be on different sides.
     351
     352 * Take opposing flight lines.
     353 * Find flat surfaces going across the swath (e.g. a road going across-track).
     354 * Take across-track profiles on the flat surfaces
     355 * If there is a roll error, the profiles will not align with one another and will have a X shape rather than an overlapping - shape (the flatter the X, the smaller the error)
     356
     357Vertical displacements due to roll error will be most noticeable at the edges of the swath.  For small errors, the nadir point will be roughly the same, for large ones, there will be some across-track shift, but that will be much harder to measure than the vertical errors.
     358
     359=== Heading / Yaw ===
     360
     361If there is a heading error, the left side of swath will move backwards while the right side will move forwards (or vice versa).  If you reverse the direction of flight (ie. with opposing flight lines), these errors will overlap (left side down in one direction matches right side up in the other) and not be visible.
     362
     363 * Instead, take two parallel flightlines with 30-50% overlap (more overlap = less chance of detection)
     364 * Along the mid line of the intersection, find areas where the height of the surface changes in an clear and predictable fashion, with reasonable sampling density (e.g. a road leading up a hill, or rooftops with their peaks going across-track).
     365 * If there is an along-track shift between features, there is a roll error (size of shift proportional to error)
     366 * If there is no error, features should overlap
     367
     368=== Pitch error slope ===
     369
     370The mirror will not be mounted exactly flat to the laser so, as the mirror moves, the pitch of the beam will change by a small amount.  The resulting errors are along-track offsets just like the pitch errors, but varying, with no error at nadir and maximum error at the edges of the swath.
     371
     372To correct this, first correct the pitch error at nadir (the overall pitch error), then determine the pitch error at the edges of the swath.  This will let you compute an error slope (first order linear).
     373
     374 * Straight, flat areas made of a hard substance that'll generate only one return pulse.  Roads or runways ;)  These are used in the boresight (roll) and range calibrations.
     375 * Sloping areas are used to detect pitch and heading errors in the boresight calibration.
     376   * A road running up a hill is good for pitch (vertical change in surface easily found in the image).  These are good for measuring along-track shifts.
     377   * Slopes with peaks (house rooftops are ideal) with the peak cutting across the line of flight ( --->  /\ ).  Again good for measuring along-track shifts.
     378
     379=== Mirror torsion error correction ===
     380
     381This shouldn't need to be done with newer LIDARs, but included here in case.  Leica suggests checking for torsion errors if there seem to be problems in the boresight calibration and reporting to them if found.
     382
     383Visible sign of torsion error is a smile effect.
     384
     385Detect torsion by:
     386 * choose highest altitude pair of crossing lines
     387 * pick a point at nadir on one swath and at the edge on the other
     388   * torsion will be at max for the edge swath and at 0 for the nadir swath
     389 * take cross sections to see if there is any consistent vertical difference
     390
     391== Automatic method (using Attune) ==
     392
     393'''Note that Attune apparently crashes if you use >400MB files, and crashes plenty anyway - save often!  Do an initial run with just a few tie points to make sure the lines will work.'''
     394
     395PROCEDURE:
     396 * In ALSPP uncheck the “average last returns” option in the settings dialog.
     397 * Check the output as attune files in the outputs dialog
     398 * Add all the flight data into the ALSPP, including the BIT mode data, and run the RangeCardCal program from the utilities menu.  Select the use all SCN files option when prompted. 
     399   * This gets the differences for range card banks A & B.  Takes differences R1-RL and averages them. Similarly for R2-RL, R3-RL, R4-RL.
     400 * Enter range offset A1 as 0 since it is unknown.
     401 * Enter the output Range offsets into the range corrections dialog of ALSPP. Only need R1 for A and B for now.
     402 * Uncheck the BIT mode data (we don't need to process this) and run the ALSPP processing.
     403 * Look at the filesizes of the output data.  If the LAS files are over 400MB in size then Attune will not run. If this is the case re-process with only the part of interest of the line.
     404   * Part of interest will be the area where all flight lines overlap.
     405 * GROUND CLASSIFICATION NEEDS TO BE DONE HERE
     406   * See the notes on ground classification
     407   * we do this so that we only use points on the ground in the tie pointing (since we don't want errors due to perspective or shadowing)
     408 * Start up Attune
     409 * Add ALS data -> add the real ATN.LAS files from the ALSPP output
     410   * The suggested pixel sizes (from top level calibration pdf) are 0.3m for 750m, 0.4m for 1350m and 0.8m for 2300m.
     411 * View the image pngs to make sure no data holes. (Some are OK. Re-load using a different resolution if too many holes. e.g. Try 0.35m for 750m)
     412   * 'a' centres the image
     413   * '+/-' to zoom in/zoom out
     414 * Now select tie points. We use streets for tie points since these should be on the ground so no (little) effects due to look angles and also has slow varying topography
     415 * Open tie point editor in Attune.
     416   * Press 'm'  to measure a point and then click where you want it. Do this for each image (selecting the same point). Then press 'sample all' to record the locations.
     417   * To change one, re-measure it and then just click 'sample point'.
     418 * Save the project after selecting 50-100 points. (Attune is very crash-able, save often)
     419 * Select points on roads with uniform intensity. Use lines of roads and field boundaries to get the same place in each image. Don't use buildings as markers due to perspective/shadow.
     420 * Edit project file properties.
     421   * Torsion constant =-100,000
     422   * Image observation Weights 0.2, 0.2, 0.1
     423   * Atmosphere same parameters as in the ALSPP processing
     424   * Set class as ground -> 2 (ground is usually class 2)
     425   * Adjustment criteria  maxiter=50, angular (?)=1.00e-08
     426 * Click Solve Calibration parameters and unselect Torsion, just want to solve roll, pitch and heading.
     427 * Then analyse the adjustment
     428   * A good result would have aposteriori reference of between 1 and 2.
     429   * No. of observations of 300 is good
     430   * Standard deviations of around 0.00001 for Roll and Pitch, 0.00005 for Heading.
     431   * Average residuals of 25cm for X and Y, 5cm for Z is good.
     432 * If the above criteria are not met (roughly...they are only guidelines)
     433   * Analyse results and remove or adjust any points with large residuals
     434     * Open all the images + point editor and then can select a point from the solution list and zoom to it on the images
     435     * You could just remove the point from one or two images (especially the high altitude images) or from all images.  Then recalculate the network adjustment and iterate until Aposteriori reference is approx 1-2 and average residuals are 0.25,0.25 and 0.05.
     436     * Can remove the points from the lower resolution images if it will help. We want more measurements in the higher resolution images than the lower ones if they are unclear to measure in (so don't just measure in them for the sake of it)
     437   * When happy save the solution
     438 * Return to ALSPP and add the Roll, Pitch and Heading values to the boresight calibration dialog. Change the outputs to LAS not Attune. Change the output directory too.  Re-run the processing.
     439 * Analyse the results in TerraScan
     440   * Check cross sections etc for misaligning flightlines.
     441   * To load all flightlines will probably need to use a fence (this is like a region of interest)
     442   * To check the Roll accuracy – check opposing flights and look at cross sections at either end of the swath for a tilt (across track).
     443   * To check the Pitch accuracy – check along track on slopes for offsets
     444   * To check the Heading accuracy – check the parallel lines for offsets
     445 * The boresight parameters can be manually twiddled (rather than using Attune) by reprocessing in ALS, changing the R,P,H values one at time.  Only process parts of the flightlines for speed benefits.
     446
     447After completing the Attune process, save the parameters as a reg file (for reference - you will need to manually transfer the numbers to avoid overwriting other parameters).  Then check the boresight parameters using the manual procedure above and adjust if required.
     448
     449=== Selecting tie points ===
     450
     451 * Better to have fewer good tie points than many bad ones
     452 * Focus mainly on the lower altitude lines
     453   * Place tie points on the higher altitude lines only when you're really sure of them - they will always have a greater error due to the pixel size.
     454 * Tarmac roads are good, but:
     455   * avoid paint on road (intensity problems and height difference)
     456   * choose continuous homogeneous areas
     457 * Avoid:
     458   * building corners (perspective)
     459   * grass (multiple returns, moves)
     460   * cars/people (moves)
     461   * areas with streaky intensity (likely to have ranging errors)
     462 * Try to select areas where you can use the nearby geometry to help you
     463   * e.g. follow straight road edges to where they intersect another feature, so you have more than just one pixel to guide you to the intersection point in other images
     464   * avoid using building edges (perspective shifts)
     465 * Location of tie points
     466   * Focus mainly in the core intersection area
     467   * Points around nadir
     468   * Points around the edges of the swath
     469   * Some generally scattered around
     470   * Some outside the core intersection area
     471   * Try to include some on slopes(?)
     472
     473
     474=== Ground classification ===
     475
     476Classification is the process of labelling the points in the point cloud by type.  Ground classification specifically refers to labelling points that're considered to be part of the ground(!)  This is a required step for the automatic boresight procedure.
     477
     478Steps:
     479 * remove very low, noisy points from consideration first
     480   * e.g. remove groups of up to 3 points > 1m below neighbours (iterate a few times so it settles)
     481 * classify groups of low points as ground (run N times to settle), takes account of neighbours
     482 * repeat with singletons
     483 * remove isolated points (>5m from any other point)
     484 * manually "add points to ground" for areas that should be ground but haven't been classified as such (e.g. peaks of hills) and rerun process above
     485
     486Run as a macro.  Terra->tools->macro->new.
     487
     488
     489--------------
     490= Random snippets =
     491
     492SCN file, DC=delta counter (time in ms since last GPS-second tick), ANG=angle in ticks, RI = return? (in m?).