# Math model sensor

## Sensor Model¶

For Sensor models, given the robot states and inputs, how can we calculate sensor observations (measurements)?

### Lidar¶

We have two lidars perpendicular to each other. Assuming both sensors are at point O, What is the distance to corresponding landmarks (a point the laser is pointing at)?

Hint

In a geometric method, try writing a triangles among points of the robot, origin and landmarks,
then use Trigonometry to solve for the lidar laser length (aka measurement).

Explore special cases.

Hint

In a Line-Circle Intersection approach, landmarks are consider as intersection of a line (lidar) and a circle (arena wall).
You can calculate the equation of a line for each lidar. The equation of a circle is given.

Consider what is boundary condition of the intersection.

You don't need to derive analytical solutions in this approach. You can relatively easily implement this in Python using geometric libraries.

### Compass¶

Compass consist of two magnetic sensors perpendicular to each other. They read strength of the magnetic field in range of -1 to 1. For instance, if one of the magnetometer is pointing north exactly, it reads 1, while the perpendicular magnetometer reads 0. We assume that the environment y-axis is pointing north.

Note

Magnetometer is especially very sensitive to environment noises ^{1}.

- Geographical locations of the sensor, whether close to the pole or to the equator, changes strength or the magnetic field, and the magnetic north is off from true north.
- The Earth's magnetic field drift over the time.
- Nearby magnetic sources (hard/soft iron disturbance) bais the readings.
- Nearby ferrous material
- The impact of the Earth's vertical magnetic feild needs to be compensated: Your local plane (a tangential plane on the Earth at your place) is not parallel to the magnetic force, and then you will measure a local z direction field.

Some of the noises can be compensated or calibrated, but especially time-varing noises caused by nearby electric currnt, such as actuators are difficult to eliminate entirely.