Train navigation

Dreik Ingenjörskonst has developed a library for working with train navigation. What makes train navigation is special is that is constrained to a rail network. To fully define the position, a state combined of

  1. network segment (“which piece of rail”)
  2. continuous position along the segment
  3. flip direction (if the wagon is turned with or against the direction of increasing mileposts)
The network segment is identified by an integer referring to the network map. The state is therefore a combination of two discrete variables and a continuous variable.

The library uses the efficient sqlite database for storing the network map and associated information. The library can then answer questions like “given a state A, where do I end up if I travel X meters in direction D?”. The library responds to such queries with a set of zero or more possible states. Connecting the library with a fusion component, it is possible to traverse the network even when some sensors are unavailable. Typically, this happens when the train moves through a tunnel and the GPS is temporarily disabled.
Here is an example of the library in action. In this assignment, sensor fusion was also included but this is outside the library.
 
train_nav
The train comes from the right. The ellipsoids mark the uncertainty of navigation. Once the train comes out of the tunnel, the uncertainty shrinks as GPS signals can be received again. The ellipsoids are larger in the north/south direction because, in this example, the odometry is more accurate than the gyro signal.
In order to work with the library, several tools for interacting with the map exist. This is handy for importing an existing network into the database.
This library is used for two clients. It is not bound by license agreements to those clients, so it is possible to use it for new assignments.