
## The `laser_data` data structure ##

Laser data is passed around in a structure which is quite 
rich and in some ways redundant to achieve ease of use. 

In C, the structure's name is `struct laser_data`. In Ruby,
it is `class LaserData`. In Matlab, it's a generic structure.

A description of the fields follows (assume the structure is 
called `ld`).

Regarding the pose of the robot:

`ld.true_pose`
: Pose of the robot (m,m,rad), in world coordinates.

`ld.odometry`
: Odometry (`true_pose` corrupted by noise).

`ld.estimate`
: Estimate of `true_pose`.

Regarding the rays:

`ld.nrays`
: Number of rays.

`ld.min_theta` and `ld.max_theta`
: Minimum and maximum theta (radians).

`ld.theta[i]`
: Direction of i-th ray with respect to the robot (radians).

`ld.readings[i]`
: Sensor reading (meters). If the reading is not valid, 
  then `ld.readings(i) == NAN`.

`ld.valid[i]`
:	In C, it assumes values `0` and `1`. 
	In Ruby, it assumes values `true` or `false`.
	(**TODO**: choose how to serialize).

	This field is true if this ray is valid, and, in particular,
	`ld.readings[i]` is valid. Invalid rays 
	occur when the obstacle is farther than the sensor horizon.

`ld.true_alpha[i]`
: Orientation of the normal of the surface (radians, relative to 
robot). It is `NAN` if not valid.

`ld.alpha[i]`
: Estimated orientation of the surface (radians, 
relative to robot). It is an estimate of `ld.true_alpha[i]`.

`ld.alpha_valid[i]`
:  True if previous field is valid.

`ld.cov_alpha[i]`
: Estimated covariance of `ld.alpha[i]`.

Additional fields used during the computation:

`ld.cluster[i]`
: Cluster to which point i belongs. This is used for computing
the orientation (at the moment a really dumb algorithm is used
for clustering). If `cluster[i] == -1`, the point does not belong
to any cluster.

`ld.points[i].p`
: Point coordinates (cartesian). Computed from the polar coordinates
`theta[i]` and `readings[i]`.

`ld.points_w[i].p`
: Point coordinates (cartesian) in a "world" reference frame. Computed with the function `ld_compute_world_coords(LDP, double pose[3])`.

`ld.hostname`
: This is parsed from the Carmen data field.

`ld.tv`
: This is a `struct timeval` field giving a timestamp for the laser scan. Please see the section on parsing to learn how this is parsed from the Carmen log.


