Started over again.
First build a new elevator contraption with the possibility to rotate the box collector to a delivery position or another rack. Having it slide with a top rail did not work that well, so made it self supporting on a sled. That worked rather well. But with the first version of the racks it still had problems with the alignment, so I looked into building a new rack. The problem with fischertechnik is the standard 15mm dimension. There are basic building blocks to do 5mm and 7.5mm, but with the static building materials these do not exist. Going up a full 15mm would result in the boxes being able to fall of of one of the rails, so it needed to be something in between.
These static parts have struts to make the stronger constructions and they also come in steps of 15mm for the normal ones, but do have odd dimensions for the crosses. One of them being 84.8mm which turned out to be perfect for the job. The 90mm could be used for the crosses to make a sturdy construction.
Fitted the box collector with sharp angled parts to allow the box to be guided in.
The new rack is 6cm wider then the first one (from 46.5 to 52.5) so not a big deal. The overall construction reduces quite a bit in size. The first setup used 4 * 2 of the black bottom plates to house the racks and the rails for the lift. The new one will be 3 * 2.
The random pick and place code ran for a while without running into problems. So all in all a good result after several iterations.
Now a bit of work on the second rack to reflect the new idea and combine it into one big system. Adapt the code to handle the rotation, and that will be it for the warehouse part.