ITS using LEGO Mindstorm
Abstract
Intelligent Transport Systems (ITS) is a general term for information-andcommuication systems aimed at making the transport sector more safe,efficient and environmentally friendly. During the recent years, cars havebeen equipped with numerous ITS applications such as parking assistant,cruise control and even collision avoidance systems directly interferingwith the car to avoid an imminent collision. Car companies claim thatautonomous cars, i.e. cars capable of driving without human interference,will be on the market by the end of the decade.
Private Rapid Transport (PRT) is an emerging public transportationbranch combining several different applications developed for ITS. Themain difference between PRT and more tradition public transport systemsis that the vehicles are operating on demand. When customers places anorder, the system will summon the closest vehicle, which will pick up thecustomers and deliver them at the desired destination automatically. Toavoid interference with other vehicles and pedestrians, the vehicles willrun along specially built guideways usually separated by levitation. Thegoal is to make PRT a realistic alternative to the private car by offeringclose to the same privacy and flexibility. To offer the same flexibility as acar, the system must provide sufficient departure and destination stations.To achieve this, the guideways are intended to form a mesh networkscattered all over cities and their suburbs. However, no operational PRTsystems with more than five stations exist today.
Lego offers a wide range of products spanning from more or lessrealistic models of trains and other vehicles to advanced programmablerobots. Mindstorms is Legos robotic theme, which was introduced in1998. In this thesis, I have used EV3, which is the third generation ofLego Mindstorms. EV3 features many different advanced sensors andboth powerful and accurate servo motors that can be connected to andcontrolled by the EV3 intelligent brick. By installing the Lego JavaOperating System (LeJOS) on the intelligent brick, it is possible makeprograms in Java and use all the libraries included in the Java 7 StandardEdition. In addition, LeJOS makes the intelligent brick support WiFicommunication, leaving developers with their imagination as the biggestrestriction.
The different pieces are designed to be compatible with each other insome way, regardless of age or theme. This means that a simple Lego toyintended for children under the age of ten can be rebuilt and combinedwith Lego Mindstorms to become a sophisticated robot. In this thesis Ihave rebuilt three carriage Lego City trains into a single carriage PRTvehicles, referred to as pods.The purpose of this thesis is to determine whether or not it s possibleto simulate a real world PRT control system using Lego Mindstorms incombination with Lego City trains. Because it seems like no one elsehave ever attempted to do this, I have made a functional PRT system onmy own. The process is thoroughly described in this report and the workis mainly divided into two objectives:
1. Design a pod that can drive to a given location with smooth andrealistic movements2. Design a higher level control system that can command the pods tomove efficiently and safely between stations.
1. Although I used the physical pod design from my previous project atNTNU, designing the pods control program to keep track of the podsexact location was the most time consuming individual challenge in thisproject. Early on, I decided to use the color sensor to count sleepers,where each sleeper in the guideway represents a unique location. BecauseI could not find any other projects using the Lego color sensor for asimilar purpose, I had to interpret the raw data from the color sensor andprocess it into reliable location data on my own. When the color sensorwas able to detect each sleeper exactly once, it was relatively simple tocalculate the speed of the pod because I knew both the distance and timebetween each sleeper. To make the pod stop smoothly at a given location,I decided to use a quadratic function to calculate the required brakingdistance based on the current speed. I also tested different approaches,but without the same consistency as the quadratic function. In the end,the result is a pod stopping at a given location with an accuracy of 10cm. It accelerates and brakes smoothly. To communicate with a higherlevel control system, I have chosen to use MQTT.
2. I have chosen to use a control system architecture consisting ofa central, multiple guideway controllers and one switch operator perguideway controller.
The guideway controllers are responsible of one control area each.There is one control area per switching intersection in the guideway andpods can only enter a control area when ordered to by the guidewaycontroller in charge of that control area. Because the guideway controllersare the only units that can allow a pod to move, it is responsible for thesafety, i.e. make sure the pods do not crash into each other. In addition,the guideway controller sends switch commands to the switch operatorlocated in its area. When a pod approaches a switching intersection, theguideway controller looks up the pods destination station in a table andorders the switch operator to switch the tracks in the correct location toroute the pod the shortest path.
The switch operator receives switch orders from the guideway controller.The switch operator is always aware of the tracks direction. Ifthe tracks are in the correct direction when it receives a switching order,no further action is taken. If not, the tracks are switched in the correctdirection by rotating a motor connected to the switch handle.The central was intended to assign orders to pods automatically andconstantly monitor the position of each pod to be able to detect congestionand update the routing tables. Unfortunately, I did not have time tomake the central automatic. However, I have made a simple graphicaluser interface where an operator manually can assign orders to pods. Anorder can be set to repeat, which means that the pod will drive constantlybetween the two given stations. By assigning multiple pods repeatedorders to move between different stations, a lot of interesting situationsoccurs at both station tracks and merging intersections.
When I tested the control system by only using a simple computersimulation, I was able to reveal some logical errors. When I had correctedall these errors, I tested the control system in the lab. This instantlyexposed a lot of situations where the system failed, causing deadlockswhere one or more pods stopped at wrong locations because it wasn tordered to continue by the control system. After analyzing the results,I was able to correct most of the errors. However, I did not have timeto make the system work perfectly. Nevertheless, most of the times, thesystem now works as intended for many minutes before an error situationoccurs. By using the lab, I was able to expose errors I couldn t detectusing computer simulations. In addition, it was much easier to understandthe source of the errors from observing the pods behaviour. Based on thisexperience, I have found that Lego Mindstorms is sufficiently advancedand adaptable to simulate a simple PRT control system.