Example #1
0
def make_settings(stepsize, aggregation, axis_limits, filename):
    'make the reachability settings object'

    # see hylaa.settings for a list of reachability settings
    settings = HylaaSettings(stepsize, 250.0)  # step: 0.1, bound: 200.0

    settings.plot.filename = filename

    #settings.approx_model = HylaaSettings.APPROX_LGG

    if aggregation == 'deagg':
        settings.stop_on_aggregated_error = False
        #settings.process_urgent_guards = True

        settings.aggstrat.deaggregate = True  # use deaggregation
        settings.aggstrat.deagg_preference = Aggregated.DEAGG_LEAVES_FIRST
    elif aggregation == 'unagg':

        # dont use aggregation
        settings.aggstrat = aggstrat.Unaggregated()
    else:
        assert aggregation == 'agg', f"unknown aggregation value {aggregation}"

    settings.stdout = HylaaSettings.STDOUT_NONE

    #settings.plot.plot_mode = PlotSettings.PLOT_IMAGE
    #settings.plot.filename = "rendezvous_full_passivity.png"
    settings.plot.plot_size = (8, 4)

    settings.plot.video_pause_frames = 2
    settings.plot.plot_mode = PlotSettings.PLOT_IMAGE
    #settings.plot.filename = "rendezvous_full_passivity.mp4"

    # single plot
    settings.plot.xdim_dir = [0] * 1
    settings.plot.ydim_dir = [1] * 1
    settings.plot.grid = False
    settings.plot.label = []
    settings.plot.extra_collections = []

    ls = LabelSettings()
    settings.plot.label.append(ls)

    ls.big(size=24)
    ls.title = ''

    ls.x_label = '$x$'
    ls.y_label = '$y$'

    y = 57.735
    line = [(-100, y), (-100, -y), (0, 0), (-100, y)]
    c1 = collections.LineCollection([line],
                                    animated=True,
                                    colors=('gray'),
                                    linewidths=(1),
                                    linestyle='dashed')

    rad = 5.0
    line = [(-rad, -rad), (-rad, rad), (rad, rad), (rad, -rad), (-rad, -rad)]
    c2 = collections.LineCollection([line],
                                    animated=True,
                                    colors=('red'),
                                    linewidths=(2))

    settings.plot.extra_collections.append([c1, c2])

    settings.plot.label[0].axes_limits = axis_limits

    return settings
Example #2
0
def make_settings(stepsize, aggregation):
    'make the reachability settings object'

    # see hylaa.settings for a list of reachability settings
    settings = HylaaSettings(stepsize, 250.0)  # step: 0.1, bound: 200.0

    #settings.approx_model = HylaaSettings.APPROX_LGG

    if aggregation == 'deagg':
        settings.stop_on_aggregated_error = False
        #settings.process_urgent_guards = True

        settings.aggstrat.deaggregate = True  # use deaggregation
        settings.aggstrat.deagg_preference = Aggregated.DEAGG_LEAVES_FIRST
    elif aggregation == 'unagg':

        # dont use aggregation
        settings.aggstrat = aggstrat.Unaggregated()
    else:
        assert aggregation == 'agg', f"unknown aggregation value {aggregation}"

    settings.stdout = HylaaSettings.STDOUT_VERBOSE

    #settings.plot.plot_mode = PlotSettings.PLOT_IMAGE
    settings.plot.plot_size = (8, 9)
    settings.plot.video_pause_frames = 15
    settings.plot.video_fps = 25

    video = True

    if video:
        settings.plot.plot_mode = PlotSettings.PLOT_VIDEO
        settings.plot.filename = "rendezvous_full_passivity.mp4"
    else:
        settings.plot.plot_mode = PlotSettings.PLOT_IMAGE
        settings.plot.filename = "rendezvous_full_passivity.png"

    # multiplot
    settings.plot.xdim_dir = [0] * 3
    settings.plot.ydim_dir = [1] * 3
    settings.plot.grid = False
    settings.plot.label = []
    settings.plot.extra_collections = []

    for _ in range(3):
        ls = LabelSettings()
        settings.plot.label.append(ls)

        ls.big(size=24)

        ls.x_label = '$x$'
        ls.y_label = '$y$'

        y = 57.735
        line = [(-100, y), (-100, -y), (0, 0), (-100, y)]
        c1 = collections.LineCollection([line],
                                        animated=True,
                                        colors=('gray'),
                                        linewidths=(1),
                                        linestyle='dashed')

        rad = 5
        line = [(-rad, -rad), (-rad, rad), (rad, rad), (rad, -rad),
                (-rad, -rad)]
        c2 = collections.LineCollection([line],
                                        animated=True,
                                        colors=('red'),
                                        linewidths=(2))

        settings.plot.extra_collections.append([c1, c2])

    settings.plot.label[0].axes_limits = [-950, 200, -450, 70]
    #settings.plot.label[1].axes_limits = [-150, 50, -70, 70]
    settings.plot.label[1].axes_limits = [-150, 100, -80, 80]

    settings.plot.label[2].axes_limits = [-40, 40, -30, 30]

    return settings
Example #3
0
def make_settings(safe, passive_time=120):
    'make the reachability settings object'

    # see hylaa.settings for a list of reachability settings
    settings = HylaaSettings(0.1, 300.0)  # step: 0.1, bound: 200.0
    settings.plot.plot_mode = PlotSettings.PLOT_NONE  #IMAGE
    settings.stdout = HylaaSettings.STDOUT_VERBOSE

    #settings.aggstrat = aggstrat.Unaggregated()
    #settings.stop_on_concrete_error = False

    settings.stop_on_aggregated_error = False
    #settings.process_urgent_guards = True

    settings.aggstrat.deaggregate = True  # use deaggregation
    settings.aggstrat.deagg_preference = aggstrat.Aggregated.DEAGG_LEAVES_FIRST

    settings.plot.filename = f"rendezvous_t{passive_time:03}.png"
    settings.plot.plot_size = (8, 10)

    settings.plot.xdim_dir = [0, 0, 2]
    settings.plot.ydim_dir = [1, 1, 3]
    settings.plot.label = [LabelSettings(), LabelSettings(), LabelSettings()]

    settings.plot.label[0].big(size=26)
    settings.plot.label[0].title_size = 22
    settings.plot.label[1].big(size=26)
    settings.plot.label[2].big(size=26)

    settings.plot.label[0].x_label = '$x$'
    settings.plot.label[0].y_label = '$y$'

    settings.plot.label[1].x_label = '$x$'
    settings.plot.label[1].y_label = '$y$'

    settings.plot.label[2].x_label = '$x_{vel}$'
    settings.plot.label[2].y_label = '$y_{vel}$'

    settings.plot.label[0].axes_limits = [-950, 200, -450, 200]
    #settings.plot.label[1].axes_limits = [-10, 10, -10, 10]
    settings.plot.label[1].axes_limits = [-110, 10, -110, 110]
    settings.plot.label[2].axes_limits = [-5, 5, -5, 5]

    y = 57.735
    line = [(-100, y), (-100, -y), (0, 0), (-100, y)]
    c1 = collections.LineCollection([line],
                                    animated=True,
                                    colors=('gray'),
                                    linewidths=(2),
                                    linestyle='dashed')
    c1_copy = collections.LineCollection([line],
                                         animated=True,
                                         colors=('gray'),
                                         linewidths=(2),
                                         linestyle='dashed')

    rad = 0.2
    line = [(-rad, -rad), (-rad, rad), (rad, rad), (rad, -rad), (-rad, -rad)]
    c2 = collections.LineCollection([line],
                                    animated=True,
                                    colors=('red'),
                                    linewidths=(2))
    c2_copy = collections.LineCollection([line],
                                         animated=True,
                                         colors=('red'),
                                         linewidths=(2))

    meters_per_sec_limit = 0.055 if safe else 0.05
    meters_per_min_limit = meters_per_sec_limit * 60
    x = meters_per_min_limit * math.cos(math.pi / 8.0)
    y = meters_per_min_limit * math.sin(math.pi / 8.0)

    line = [(-x, y), (-y, x), (y, x), (x, y), (x, -y), (y, -x), (-y, -x),
            (-x, -y), (-x, y)]
    vel_oct = collections.LineCollection([line],
                                         animated=True,
                                         colors=('gray'),
                                         linewidths=(2),
                                         linestyle='dashed')

    r = meters_per_min_limit
    patch_col = collections.PatchCollection([Circle((0, 0), r)], alpha=0.25)

    settings.plot.extra_collections = [[c1_copy, c2_copy], [c1, c2],
                                       [vel_oct, patch_col]]

    return settings
Example #4
0
def make_settings(unsafe_box):
    'make the reachability settings object'

    # see hylaa.settings for a list of reachability settings
    settings = HylaaSettings(1.0, 20.0)
    settings.process_urgent_guards = True
    settings.stdout = HylaaSettings.STDOUT_VERBOSE

    settings.plot.video_pause_frames = 5
    settings.plot.video_fps = 5
    settings.plot.plot_mode = PlotSettings.PLOT_NONE
    settings.plot.interactive_skip_count = 5

    #settings.plot.plot_mode = PlotSettings.PLOT_VIDEO
    #settings.plot.filename = "deagg_example.mp4"

    settings.stop_on_aggregated_error = False
    settings.aggstrat.deaggregate = True  # use deaggregation
    settings.aggstrat.deagg_preference = Aggregated.DEAGG_LEAVES_FIRST

    settings.plot.extra_collections = []
    settings.plot.label = []

    ls = LabelSettings()
    ls.axes_limits = [-1, 12, -1, 6]
    settings.plot.label.append(ls)

    ls.big(size=24)

    ls.x_label = '$x$'
    ls.y_label = '$y$'

    cols = []

    line = [(3.5, -20), (3.5, 20)]
    cols.append(
        collections.LineCollection([line],
                                   animated=True,
                                   colors=('gray'),
                                   linewidths=(2),
                                   linestyle='dashed'))

    line = [(-20, 3.5), (20, 3.5)]
    cols.append(
        collections.LineCollection([line],
                                   animated=True,
                                   colors=('gray'),
                                   linewidths=(2),
                                   linestyle='dashed'))

    # x >= 1.1 x <= 1.9, y >= 2.7, y <= 4.3
    line = []
    line.append((unsafe_box[0][0], unsafe_box[1][0]))
    line.append((unsafe_box[0][1], unsafe_box[1][0]))
    line.append((unsafe_box[0][1], unsafe_box[1][1]))
    line.append((unsafe_box[0][0], unsafe_box[1][1]))
    line.append((unsafe_box[0][0], unsafe_box[1][0]))

    cols.append(
        collections.LineCollection([line],
                                   animated=True,
                                   colors=('red'),
                                   linewidths=(2),
                                   linestyle='dashed'))

    settings.plot.extra_collections.append(cols)

    return settings
Example #5
0
def make_settings(safe):
    'make the reachability settings object'

    # see hylaa.settings for a list of reachability settings
    settings = HylaaSettings(1.0, 200.0)  # step: 0.1, bound: 200.0

    settings.stop_on_aggregated_error = False
    settings.process_urgent_guards = True

    #settings.aggstrat = MyAggergated()
    settings.aggstrat.deaggregate = True  # use deaggregation
    settings.aggstrat.deagg_preference = Aggregated.DEAGG_LEAVES_FIRST

    settings.stdout = HylaaSettings.STDOUT_VERBOSE

    settings.plot.plot_mode = PlotSettings.PLOT_NONE
    settings.plot.filename = "rendezvous_full_passivity.png"
    settings.plot.plot_size = (8, 9)

    #settings.plot.video_pause_frames = 10
    #settings.plot.plot_mode = PlotSettings.PLOT_VIDEO
    #settings.plot.filename = "rendezvous_full_passivity.mp4"

    settings.plot.xdim_dir = [0] * 3
    settings.plot.ydim_dir = [1] * 3
    settings.plot.grid = False
    settings.plot.label = []
    settings.plot.extra_collections = []

    for _ in range(3):
        ls = LabelSettings()
        settings.plot.label.append(ls)

        ls.big(size=24)

        ls.x_label = '$x$'
        ls.y_label = '$y$'

        y = 57.735
        line = [(-100, y), (-100, -y), (0, 0), (-100, y)]
        c1 = collections.LineCollection([line],
                                        animated=True,
                                        colors=('gray'),
                                        linewidths=(1),
                                        linestyle='dashed')

        rad = 0.2
        line = [(-rad, -rad), (-rad, rad), (rad, rad), (rad, -rad),
                (-rad, -rad)]
        c2 = collections.LineCollection([line],
                                        animated=True,
                                        colors=('red'),
                                        linewidths=(2))

        settings.plot.extra_collections.append([c1, c2])

    settings.plot.label[0].axes_limits = [-950, 400, -450, 70]
    #settings.plot.label[1].axes_limits = [-150, 50, -70, 70]
    settings.plot.label[1].axes_limits = [-80, 5, -30, 5]
    settings.plot.label[2].axes_limits = [-3, 1.5, -1.5, 1.5]

    return settings