How can I create a rail network, which is just a simple circle?

Hi @fhohnstein - there are a couple of notebooks in the flatland repo which might be of interest.

Scene-editor.ipynb should allow you to draw some rails by dragging the mouse. There are some buttons to load & save etc. It’s a bit broken when it comes to adding agents and targets though.

test-collision.ipynb creates a simple environment on-the-fly using env_edit_utils.py which is related to the editor. It applies simulated mouse-strokes, specified by (row,column) co-ordinates, similar to how the editor works. The one used in the test case is called “concentric_loops” and is defined in ddEnvSpecs like this:

        # Concentric Loops
        "concentric_loops": {
            "llrcPaths": [
                [(1,1), (1,5), (8, 5), (8,1), (1,1), (1,3)],
                [(1,3), (1,10), (8,10), (8,3)]
                ],
            
            "lrcStarts": [(1,3)],
            "lrcTargs": [(2,1)],
            "liDirs":  [1]
            },

When defining the “strokes” (llrcPaths means list of list of row,col paths to me :slight_smile:) you need to make the ends of the strokes overlap a bit, and then it can work out how to join the rails. (This applies if you’re doing it by hand in the editor too.)

Hope that helps!

3 Likes