December 01, 2022
Train localization as a software problem
November 27, 2022
How to fix the traffic jam in India
Fixing something is usually done by putting the resources towards the right place. One attempt might be to build more roads in the attempt that this will reduce the amount of traffic jams. But the most efficient resource allocation is done at a different location, namely the railroad system. Similar to the car roads, the train system in india has a high demand but low amount of ressources. And building new railroad networks is expensive. A cost effective alternative is to measure the existing traffic with more sensors.
So a cheap version to improve the efficiency is to buy a simple arduino based sensor and count how many trains are arriving at the trains station and how many are leaving. Also the sensor counts the time and date.
Such a single sensor won't be able to fix all the problems of India, but it is a first step towards a possible solution to the traffic jam problem.
September 24, 2019
What Robotics enthusiasts can learn from model railroad

On the first look, both domains have nothing in common. Robotics is focussed around artificial intelligence, and writing software for a real robot is only one applications under many. In contrast, model railroad is primarely a mechanical toy not equipped with artificial intelligence. Both domains have weaks and strength which fits together very well. For example, the robotics community has the problem, that they have developed advanced software for creating neural networks, experts systems and AI programming languages, but they have no idea what to do with the technology in a real project. In contrast, model railroad experts are well equipped with practical applications but what is missing is a theoretical concept.
It's obvious to combine both domains into a single one. In the literature it is called a rail guided robot, or a digital model railroad. It depends from which point of view the subject is discussed. One option is to put existing AI technology into a model railroad. That means to control the trains with neural networks. The other option is, to put existing train tracks into a robotics project. this results into railway guided vehicles.
The reason why a combination make sense is because the foreign domain can solve the issue from the home domain. Let us give some examples. In robotics, the main problem has to do with the large state space. Suppose, a walking robot was constructed which contains of 20 dof. THe problem is, that nobody knows how to control such a complicated device. Sure, the AI Community has developed many frameworks but using them for control a concrete robot is complicated. The situation will become much easier if the idea is not to control a walking robot, but an electric train. A train is equal to a half degree of freedom. The speed value can become zero or slow moving ahead. More is not needed.
Now, let us observe the situation from the perspective of model railroad experts. A typical model railroad contains of 10 different trains, plus 20 switches on the train track. The problem is, that the average train expert has no idea how to control this system. He can press the buttons manual, but this become a stressful job after a time. The problem is, that within in the railroad community there are no things available like programming languages, cognitive architectures nor neural networks. In most cases the model railroad can't run autonomously. Exactly the missing features are provided by the AI Community. They have developed lots of tool which can control 10 trains plus a handful switches easily. That means, for AI experts, a train track is a very easy problem, which is less sophisticated what they are trained.
Example
A basic setup which can be realized with any model railway system is a locomotive which drives in a circle. From a technical point of view, the motor in the locomotive accepts electric current and this drives the vehicle on the track. The interesting point is, that the locomotive drives in the circle without a steering wheel. All what is needed is the forward movement. This hardware setup can be utilized by AI engineers for realizing a control system. The neural network has to mainstain the speed parameter of the locomotive constant. The result is a neural network controlled electric vehicle. It's a practical application which is useful in reality and it can be realized with a minimum effort of know how.
The most interesting feature is, that each community which is AI experts, and model railroad enthusiasts are not aware that their knowledge is relevant for solving the task. From the perspective of model railroad, a simple circle without any swichtes and with a single locomotive is very easy to realize. They do not assume, that this kind of problem is relevant. And from the other perspective, the AI experts, a neural network which is working with the propagation algorithm is also a bread and butter technology which seems not relevant on the first look. Combinging both technologies together results into something new which is very advanced.
Take a look at the weakness
For understanding why both domains can be combined easily, it's important to take a look at the weakness of each domain. In the model railroad domain there are some tutorials available about how to use virtual model trains and program the vehicles. A short look into the tutorial comes to the conclusion, that the quality is low. That means, railroad experts are bad programmers, they have no idea how to create software, nor how to build artificial intelligence.
The model railroad community is not the only one who has a deficit. In short look into the AI Community and neural networks experts shows, that some documentation is available about how to build physical robots and even cars. The problem here is, that the AI experts have no idea how to realize the mechanical parts nor the electric component. The reason is, that Artificial Intellligence is mainly a software driven technology, but is not located in the reality.
So in general, both domains have a large weakness and the foreign domain can add the missing feature easily. It's important to communicate between both areas back and forth to get access to the missing knowledge.
Entry projects in classical robotics
Before it make sense to explain why model railroad is a good starting point, there is a need to describe low entry projects in robotics. A beginner friendly project which is not too complicated is the Micromouse competition. The aim is to control a wheeled robot in a maze to the goal. Another easy to realize robotics projects is a line following robot which can be build with Lego Mindstorms. The interesting point is, that with model railroads, the entry barrier can be lowered much more.
The reason is, that a micromouse robot is compared to a train controlled robot and advanced machine. Because the micromouse can drive backward, forward, rotate to the left, rotate to the right. And addtionally, there are obstacles available. Creating the control algorithm which can handles there requirements is compared to a biped robot an easy problem, but compared to model train controller and advanced task. Model railroad trains are interesting because they are lowering the control requirements to the minimum. They are more beginner friendly than a micromouse challenge.
Railway as a graph

The reason why model trains can be controlled much easier than a micromouse is because a railway network is forming a graph. If we abstract from different sizes and switches, every railroad can be converted into nodes which are connected by arrows. Modelling this in a computer program is a beginner task and routing a packet through the graph is more easier than driving a normal robot to the goal.
The sown graph contains of a small number of train blocks which are connected with switches. What the operator can do is to drive a train on the network and adjust the position of the switches. In contrast to a normal robotics problem, the remote control vehicle has a reduced amount of decisions. The train is not allowed to decide anything, but the path is given by the environment. From a computer science perspective this is a very easy to solve task, much easier than normal AI problems which have a very large state space. Most normal AI problems are open ended tasks. That means, the robot can decide anything and the problem is not specified in detail. In contrast, a routing problem in a graph which on which a vehicle is cruising is the perfect task for AI newbies. Even if they have no idea about reinforcement learning, neural networks or PDDL they can solve the routing problem easily.
A second advantage is, that the hardware for realizing the given graph in reality is available out of the box. All the model train manufactoring companies are able to deliver the needed parts in a great quality. And even more, the consumer can decide between a locomotive in the green color which is older, or new engine which is given in the black color which is available in the reality as well.
What i want to explain is, that railway model is the perfect testbed for teaching Artificial Intelligence to the newbies. It's much better than Lego Mindstorms or the micromouse challenge.
September 21, 2019
Short introduction into railroad modelling
The more modern technology is called digital control. This is working with a data transmission protocol. The current is combined with information packet and both are received by the decoder in the train. It is working very similar to a local area network and each train has a network interface card. The technology is a bit different from normal computer networks because the electric current and the networking information are combined into the same signal. In computer terms it's called powerline https://en.wikipedia.org/wiki/Power-line_communication
What makes model railroad a bit difficult to grasp is because each manufactorer has developed it's own data transmission protocol. Some recent developments are working the Arduino micocontroller but there is a need for a decoder in each train for receive the informations. A possible standard is called Digital Command Control (DCC).
From the outside perspective, DCC is working similar to a WLAN device. Each trains has an imaginary WLAN adress and it's possible to send a signal to it. The difference is, that in case of model railroads the signals are transmitted not over the air, but inside the train track. The reason is, that all the trains are driven by an electric motor and this needs electric current. This is perhaps to most obvious difference to Lego Mindstorms robotics, which are working with onboard batteries. The advantage is, that an electric train can work 24/7.
Model trains for teaching artificial intelligence
From the classical perspective artificial intelligence is teached in the universities with robotics applications. The famous Lego Mindstorms kit is a well known programming environment for creating practical robots. The problem with the robot machinery is, that nobody can define what a robot is. In the history of films, a robot is some kind of futuristic device which comes from outer space. A famous humanoid robot is Lt. Commander Data from Startrek, but the T-800 in Terminator is also a robot.
On the first look the idea of using a robot as an education tool to teach artificial Intelligence make sense, because intelligent machinery is something not available today but should be invented in the future. The disadvantage is that it remains unclear, what a robot is and how to program it.
The better idea is to search for different platform for teaching Artificial Intelligence which is not a robot but a railroad model. A short look into train models have shown, that this kind of toy has a long history. The first electric models were build around 1900 and the time before, purely mechanical railroads were used. Also the community is growing. The latest technological advancement is called DCC control which was invented in the late 1980s. It's a network packet protocol similar to the Ethernet standard for addressing individuals motors on the track.
The normal pattern of utilizing model trains is by manual control. But with a computer in the loop it's possible to automate the process. That is what the tech model railroad club have done in the 1950s. So we can say, that model railroads are an ideal testbed for creating complicated Artificial Intelligence control systems which are working with symbolic reasoning, neural networks, image recognition and so forth. The dominant advantage over the sad Lego mindstorms product is, that model railroads are supported very well by commercial manufactorers. There are endless numbers of starter kits, add ons and realistic model trains available. That means, the community is already there and doesn't need to invented from scratch. In contrast, there is no robotics playing community, because it's harder to do with a robotics kit something useful.
On the first look, it's sounds like too much of complexity to figure out the details of model railroads if the aim is to introduce model predictive control. The advantage is, that even the AI part of the project fails, the model train will work quite well. It's possible to run a model railroad without artificial intelligence in the loop, this makes it easier to approach the subject slowly. Let us compare this with Lego Mindstorms. A robot has the tendency, that without programming the device, the toy will do nothing. If the self written Java code has an error, the Mindstorms robot won't move a single millimeter. This is frustrating and results into failed projects. In case of railroad models, the chance of failure is lowered. The low end education goal is to teach the basics of electrics and physics. And the higher goal is to explain what artificial Intelligence is. This makes a model railroad the natural choice for increased difficulty.