A method for autonomously controlling movements of container handling vehicles operating in a storage and retrieval system comprising a grid structure with storage columns and a corresponding rail system above the storage columns for guiding movements of the vehicles adapted for transferring storage containers to and from the storage columns , where each vehicle comprises a vehicle controller connected to driving means and sensors for controlling movements of the vehicle along the rail system relative to movements of other vehicles , where the method is characterized in performing the following steps in the vehicle controller of each vehicle : a) using a map defining rail layout according to two-dimensional coordinates corresponding to grid cells defined by the circumference of the horizontal extent of storage columns of the storage and retrieval system and defining traffic rules for each grid cell and its corresponding rails, and defining time slots for each grid cell for when the traffic rules are applicable, the traffic rules define where and when vehicles can move on the rail system , and where the map is the same for all vehicles operating in the storage and retrieval system ; b) synchronizing the vehicle controller to a clock common for all vehicles ; c) receiving an instruction from a master controller instructing the vehicle to move to a specified destination on the rail system relative to the map; d) letting the vehicle controller determine a route to follow on the rail system from a current position of the vehicle to the specified destination based on the map, the traffic rules, distance to other vehicles and movements of the other vehicles ; e) controlling the movements of the vehicle along the rail system from its current position to the specified destination according to the determined route, and f) repeating steps d) and e) until the vehicle has reached the specified destination. a) using a map defining rail layout according to two-dimensional coordinates corresponding to grid cells defined by the circumference of the horizontal extent of storage columns of the storage and retrieval system and defining traffic rules for each grid cell and its corresponding rails, and defining time slots for each grid cell for when the traffic rules are applicable, the traffic rules define where and when vehicles can move on the rail system , and where the map is the same for all vehicles operating in the storage and retrieval system ; b) synchronizing the vehicle controller to a clock common for all vehicles ; c) receiving an instruction from a master controller instructing the vehicle to move to a specified destination on the rail system relative to the map; d) letting the vehicle controller determine a route to follow on the rail system from a current position of the vehicle to the specified destination based on the map, the traffic rules, distance to other vehicles and movements of the other vehicles ; e) controlling the movements of the vehicle along the rail system from its current position to the specified destination according to the determined route, and f) repeating steps d) and e) until the vehicle has reached the specified destination. <EOS>