Input/OutputΒΆ

Following are the requirements for input environment json file.

  • resolution: Canvas dimension n. eg: n=500 –> means 0-500, 0-500 along x-axis and y-axis respectively.

  • initial_state: x, y of the rear axle center at initial state. eg: [45, 45].

  • initial_orientation: Orientation angle in degree at initial state. eg: 45.

  • goal_state: x, y of the rear axle center at goal state. eg: [480, 50].

  • goal_orientation : Orientation angle in degree at goal state. eg: 90.

  • random_points: Number of random point for the algorithm. eg: 5000.

  • theta_norm: [x, y, theta] normalization vector for the distance function. Usually x and y be given equal weight and a constant for theta term. eg: [1, 1, 5].

  • tolerance: Allowed error tolerance for distance function. eg: 1.

  • geom_skip_factor: Used for drawing curves. This number defines the number of lines used while drawing curves. eg: value 1 would yield a better looking curve than value 5. However at a cost of memory.

  • collision_check_skip_factor: Frequency of collision detection while performing the integration. eg: value 1 would yield higher number of collision detection, while value 4 would skip at an interval of 4 while doing the integration. The former one would be a 4 times computational intensive than the later one.

  • total_steps_for_complete_integration: Defines the h value in the 4th order Runge-Kutta integration. Higher value yield better accuracy in integration and consequently better overall accuracy.

  • obstacles: Defines a list of obstacles objects as polygon. Following is the method to define obstacles in the environment.
    • shape: Has to be “polygon” for all obstacles

    • property: where the vertex data goes.
      • vertices: define the x, y coordinate as a list. eg: [[400, 80], [400, 0], [100, 0], [100, 80]]
  • car: meta data of car robot
    • linear_velocity: Velocity at which the car goes linearly. eg: 1.
    • max_turning_angle: Maximum angle between the axis along the car length and the front wheel when it is turned at its maximum.
    • front_axle_back_axle_distance: Distance between the front axle and rear axle of the car.
    • dimension: Defines the car dimension when its position (center of rear axle) is super imposed on 0, 0 of euclidean plane. Provide the xy coordinates as a list similar to obstacles–>property–>vertices.

Sample definition for input file is as follows.

{
  "resolution": 500,
  "initial_state": [45, 45],
  "initial_orientation": "45",
  "goal_state": [480, 50],
  "goal_orientation" : "90",
  "random_points": 25000,
  "theta_norm": [1, 1, 5],
  "tolerance": 1,
  "geom_skip_factor": 5,
  "collision_check_skip_factor": 4,
  "total_steps_for_complete_integration": 40,
  "obstacles": [
    {
      "shape": "polygon",
      "property": {
        "vertices": [
          [400, 80],
          [400, 0],
          [100, 0],
          [100, 80]
        ]
      }
    },
    {
      "shape": "polygon",
      "property": {
        "vertices": [
          [80, 300],
          [80, 200],
          [0, 200],
          [0, 300]
        ]
      }
    },
    {
      "shape": "polygon",
      "property": {
        "vertices": [
          [100, 500],
          [100, 350],
          [0, 350],
          [0, 500]
        ]
      }
    },
    {
      "shape": "polygon",
      "property": {
        "vertices": [
          [350, 500],
          [350, 400],
          [150, 400],
          [150, 500]
        ]
      }
    },
    {
      "shape": "polygon",
      "property": {
        "vertices": [
          [350, 300],
          [350, 110],
          [150, 110],
          [150, 300]
        ]
      }
    },
    {
      "shape": "polygon",
      "property": {
        "vertices": [
          [500, 500],
          [500, 300],
          [450, 300],
          [450, 500]
        ]
      }
    }

  ],
  "car": {
    "linear_velocity": 1,
    "max_turning_angle": 24.23,
    "front_axle_back_axle_distance": 25.62,
    "dimension": {
      "shape": "polygon",
      "property": {
        "vertices": [
          [
            35.02, 8.58
          ],
          [
            35.02, -8.58
          ],
          [
            -10.14, -8.58
          ],
          [
            -10.14, 8.58
          ]
        ]
      }
    }
  }
}

The output generated will have all the details similar to that of input json and additionally the tree details and path details will be embedded. Extra attributes are as follows.

  • control: Control input
  • tree_lines: Tree as a list of line segments
  • path_lines: Final path as a list of line segments

Following is a sample output file while running the RRT* for 10 iterations (To limit number of lines in this display).

{
    "car": {
        "dimension": {
            "property": {
                "vertices": [
                    [
                        35.02,
                        8.58
                    ],
                    [
                        35.02,
                        -8.58
                    ],
                    [
                        -10.14,
                        -8.58
                    ],
                    [
                        -10.14,
                        8.58
                    ]
                ]
            },
            "shape": "polygon"
        },
        "front_axle_back_axle_distance": 25.62,
        "linear_velocity": 1,
        "max_turning_angle": 50
    },
    "collision_check_skip_factor": 4,
    "control": null,
    "epsilon": 10,
    "geom_skip_factor": 5,
    "goal_orientation": "90",
    "goal_state": [
        480,
        50
    ],
    "initial_orientation": "45",
    "initial_state": [
        45,
        45
    ],
    "obstacles": [
        {
            "property": {
                "vertices": [
                    [
                        400,
                        80
                    ],
                    [
                        400,
                        0
                    ],
                    [
                        100,
                        0
                    ],
                    [
                        100,
                        80
                    ]
                ]
            },
            "shape": "polygon"
        },
        {
            "property": {
                "vertices": [
                    [
                        80,
                        300
                    ],
                    [
                        80,
                        200
                    ],
                    [
                        0,
                        200
                    ],
                    [
                        0,
                        300
                    ]
                ]
            },
            "shape": "polygon"
        },
        {
            "property": {
                "vertices": [
                    [
                        100,
                        500
                    ],
                    [
                        100,
                        350
                    ],
                    [
                        0,
                        350
                    ],
                    [
                        0,
                        500
                    ]
                ]
            },
            "shape": "polygon"
        },
        {
            "property": {
                "vertices": [
                    [
                        350,
                        500
                    ],
                    [
                        350,
                        400
                    ],
                    [
                        150,
                        400
                    ],
                    [
                        150,
                        500
                    ]
                ]
            },
            "shape": "polygon"
        },
        {
            "property": {
                "vertices": [
                    [
                        350,
                        300
                    ],
                    [
                        350,
                        125
                    ],
                    [
                        150,
                        125
                    ],
                    [
                        150,
                        300
                    ]
                ]
            },
            "shape": "polygon"
        },
        {
            "property": {
                "vertices": [
                    [
                        500,
                        500
                    ],
                    [
                        500,
                        300
                    ],
                    [
                        450,
                        300
                    ],
                    [
                        450,
                        500
                    ]
                ]
            },
            "shape": "polygon"
        }
    ],
    "path_lines": [],
    "random_points": 10,
    "resolution": 500,
    "stats": {
        "best_z_near_count": 0,
        "re_wiring_count": 0
    },
    "theta_norm": [
        1,
        1,
        5
    ],
    "tolerance": 1,
    "total_steps_for_complete_integration": 45,
    "tree_lines": [
        [
            [
                45.0,
                45.0
            ],
            [
                46.68902138519762,
                46.68902138519762
            ]
        ],
        [
            [
                46.68902138519762,
                46.68902138519762
            ],
            [
                48.37804277039524,
                48.37804277039524
            ]
        ],
        [
            [
                48.37804277039524,
                48.37804277039524
            ],
            [
                50.06706415559286,
                50.06706415559286
            ]
        ],
        [
            [
                50.06706415559286,
                50.06706415559286
            ],
            [
                51.75608554079048,
                51.75608554079048
            ]
        ],
        [
            [
                51.75608554079048,
                51.75608554079048
            ],
            [
                53.4451069259881,
                53.4451069259881
            ]
        ],
        [
            [
                53.4451069259881,
                53.4451069259881
            ],
            [
                55.13412831118572,
                55.13412831118572
            ]
        ],
        [
            [
                55.13412831118572,
                55.13412831118572
            ],
            [
                56.82314969638334,
                56.82314969638334
            ]
        ],
        [
            [
                56.82314969638334,
                56.82314969638334
            ],
            [
                58.51217108158096,
                58.51217108158096
            ]
        ],
        [
            [
                58.51217108158096,
                58.51217108158096
            ],
            [
                60.20119246677858,
                60.20119246677858
            ]
        ],
        [
            [
                60.20119246677858,
                60.20119246677858
            ],
            [
                61.8902138519762,
                61.8902138519762
            ]
        ],
        [
            [
                61.8902138519762,
                61.8902138519762
            ],
            [
                63.57923523717382,
                63.57923523717382
            ]
        ],
        [
            [
                63.57923523717382,
                63.57923523717382
            ],
            [
                65.26825662237144,
                65.26825662237144
            ]
        ],
        [
            [
                65.26825662237144,
                65.26825662237144
            ],
            [
                66.95727800756906,
                66.95727800756906
            ]
        ],
        [
            [
                66.95727800756906,
                66.95727800756906
            ],
            [
                68.64629939276668,
                68.64629939276668
            ]
        ],
        [
            [
                68.64629939276668,
                68.64629939276668
            ],
            [
                70.3353207779643,
                70.3353207779643
            ]
        ],
        [
            [
                70.3353207779643,
                70.3353207779643
            ],
            [
                72.02434216316192,
                72.02434216316192
            ]
        ],
        [
            [
                72.02434216316192,
                72.02434216316192
            ],
            [
                73.71336354835954,
                73.71336354835954
            ]
        ],
        [
            [
                73.71336354835954,
                73.71336354835954
            ],
            [
                75.40238493355716,
                75.40238493355716
            ]
        ],
        [
            [
                75.40238493355716,
                75.40238493355716
            ],
            [
                77.09140631875478,
                77.09140631875478
            ]
        ],
        [
            [
                77.09140631875478,
                77.09140631875478
            ],
            [
                78.7804277039524,
                78.7804277039524
            ]
        ],
        [
            [
                78.7804277039524,
                78.7804277039524
            ],
            [
                80.46944908915002,
                80.46944908915002
            ]
        ],
        [
            [
                80.46944908915002,
                80.46944908915002
            ],
            [
                82.15847047434764,
                82.15847047434764
            ]
        ],
        [
            [
                82.15847047434764,
                82.15847047434764
            ],
            [
                83.84749185954526,
                83.84749185954526
            ]
        ],
        [
            [
                83.84749185954526,
                83.84749185954526
            ],
            [
                85.53651324474288,
                85.53651324474288
            ]
        ],
        [
            [
                85.53651324474288,
                85.53651324474288
            ],
            [
                87.2255346299405,
                87.2255346299405
            ]
        ],
        [
            [
                87.2255346299405,
                87.2255346299405
            ],
            [
                88.91455601513812,
                88.91455601513812
            ]
        ],
        [
            [
                88.91455601513812,
                88.91455601513812
            ],
            [
                90.60357740033574,
                90.60357740033574
            ]
        ],
        [
            [
                90.60357740033574,
                90.60357740033574
            ],
            [
                92.29259878553336,
                92.29259878553336
            ]
        ],
        [
            [
                92.29259878553336,
                92.29259878553336
            ],
            [
                93.98162017073098,
                93.98162017073098
            ]
        ],
        [
            [
                93.98162017073098,
                93.98162017073098
            ],
            [
                95.6706415559286,
                95.6706415559286
            ]
        ],
        [
            [
                95.6706415559286,
                95.6706415559286
            ],
            [
                97.35966294112622,
                97.35966294112622
            ]
        ],
        [
            [
                97.35966294112622,
                97.35966294112622
            ],
            [
                99.04868432632384,
                99.04868432632384
            ]
        ],
        [
            [
                99.04868432632384,
                99.04868432632384
            ],
            [
                100.73770571152146,
                100.73770571152146
            ]
        ],
        [
            [
                100.73770571152146,
                100.73770571152146
            ],
            [
                102.42672709671908,
                102.42672709671908
            ]
        ],
        [
            [
                102.42672709671908,
                102.42672709671908
            ],
            [
                104.1157484819167,
                104.1157484819167
            ]
        ],
        [
            [
                104.1157484819167,
                104.1157484819167
            ],
            [
                105.80476986711432,
                105.80476986711432
            ]
        ],
        [
            [
                105.80476986711432,
                105.80476986711432
            ],
            [
                107.49379125231194,
                107.49379125231194
            ]
        ],
        [
            [
                107.49379125231194,
                107.49379125231194
            ],
            [
                109.18281263750956,
                109.18281263750956
            ]
        ],
        [
            [
                109.18281263750956,
                109.18281263750956
            ],
            [
                110.87183402270718,
                110.87183402270718
            ]
        ],
        [
            [
                110.87183402270718,
                110.87183402270718
            ],
            [
                112.5608554079048,
                112.5608554079048
            ]
        ],
        [
            [
                112.5608554079048,
                112.5608554079048
            ],
            [
                114.24987679310242,
                114.24987679310242
            ]
        ],
        [
            [
                114.24987679310242,
                114.24987679310242
            ],
            [
                115.93889817830004,
                115.93889817830004
            ]
        ],
        [
            [
                115.93889817830004,
                115.93889817830004
            ],
            [
                117.62791956349766,
                117.62791956349766
            ]
        ],
        [
            [
                117.62791956349766,
                117.62791956349766
            ],
            [
                119.31694094869528,
                119.31694094869528
            ]
        ],
        [
            [
                119.31694094869528,
                119.31694094869528
            ],
            [
                117.72513079490345,
                117.53765474779746
            ]
        ],
        [
            [
                117.72513079490345,
                117.53765474779746
            ],
            [
                116.34042845565972,
                115.59283640612307
            ]
        ],
        [
            [
                116.34042845565972,
                115.59283640612307
            ],
            [
                115.17991144126633,
                113.5064713350668
            ]
        ],
        [
            [
                115.17991144126633,
                113.5064713350668
            ],
            [
                114.25789238824274,
                111.3042906394195
            ]
        ],
        [
            [
                114.25789238824274,
                111.3042906394195
            ],
            [
                113.58574254182383,
                109.01345377609223
            ]
        ],
        [
            [
                113.58574254182383,
                109.01345377609223
            ],
            [
                113.1717515145867,
                106.66221359699794
            ]
        ],
        [
            [
                113.1717515145867,
                106.66221359699794
            ],
            [
                113.02102505080018,
                104.27956790711148
            ]
        ],
        [
            [
                113.02102505080018,
                104.27956790711148
            ],
            [
                113.13542205736807,
                101.8949018350359
            ]
        ],
        [
            [
                113.13542205736807,
                101.8949018350359
            ],
            [
                113.51353167796204,
                99.53762542671326
            ]
        ],
        [
            [
                113.51353167796204,
                99.53762542671326
            ],
            [
                114.15069069308855,
                97.23681093183039
            ]
        ],
        [
            [
                114.15069069308855,
                97.23681093183039
            ],
            [
                115.03904103149534,
                95.02083425625986
            ]
        ],
        [
            [
                115.03904103149534,
                95.02083425625986
            ],
            [
                116.1676266836299,
                92.91702500249748
            ]
        ],
        [
            [
                45.0,
                45.0
            ],
            [
                46.68902138519762,
                46.68902138519762
            ]
        ],
        [
            [
                46.68902138519762,
                46.68902138519762
            ],
            [
                48.37804277039524,
                48.37804277039524
            ]
        ],
        [
            [
                48.37804277039524,
                48.37804277039524
            ],
            [
                50.06706415559286,
                50.06706415559286
            ]
        ],
        [
            [
                50.06706415559286,
                50.06706415559286
            ],
            [
                51.75608554079048,
                51.75608554079048
            ]
        ],
        [
            [
                51.75608554079048,
                51.75608554079048
            ],
            [
                53.4451069259881,
                53.4451069259881
            ]
        ],
        [
            [
                53.4451069259881,
                53.4451069259881
            ],
            [
                55.13412831118572,
                55.13412831118572
            ]
        ],
        [
            [
                55.13412831118572,
                55.13412831118572
            ],
            [
                56.82314969638334,
                56.82314969638334
            ]
        ],
        [
            [
                56.82314969638334,
                56.82314969638334
            ],
            [
                58.51217108158096,
                58.51217108158096
            ]
        ],
        [
            [
                58.51217108158096,
                58.51217108158096
            ],
            [
                60.20119246677858,
                60.20119246677858
            ]
        ],
        [
            [
                60.20119246677858,
                60.20119246677858
            ],
            [
                61.8902138519762,
                61.8902138519762
            ]
        ],
        [
            [
                61.8902138519762,
                61.8902138519762
            ],
            [
                63.57923523717382,
                63.57923523717382
            ]
        ],
        [
            [
                63.57923523717382,
                63.57923523717382
            ],
            [
                65.26825662237144,
                65.26825662237144
            ]
        ],
        [
            [
                65.26825662237144,
                65.26825662237144
            ],
            [
                66.95727800756906,
                66.95727800756906
            ]
        ],
        [
            [
                66.95727800756906,
                66.95727800756906
            ],
            [
                68.64629939276668,
                68.64629939276668
            ]
        ],
        [
            [
                68.64629939276668,
                68.64629939276668
            ],
            [
                70.3353207779643,
                70.3353207779643
            ]
        ],
        [
            [
                70.3353207779643,
                70.3353207779643
            ],
            [
                72.02434216316192,
                72.02434216316192
            ]
        ],
        [
            [
                72.02434216316192,
                72.02434216316192
            ],
            [
                73.71336354835954,
                73.71336354835954
            ]
        ],
        [
            [
                73.71336354835954,
                73.71336354835954
            ],
            [
                75.40238493355716,
                75.40238493355716
            ]
        ],
        [
            [
                75.40238493355716,
                75.40238493355716
            ],
            [
                76.41579776467573,
                76.41579776467573
            ]
        ]
    ]
}