Skip to content

safe_control

track_trajectory_ackerman_clf_bayesian(x, x_g, dt=None, cbfs=None, cbf_gammas=None, numSteps=None, enable_learning=True, mean_dynamics_gen=partial(AckermanDrive, L=10.0), true_dynamics_gen=RacecarEnv, visualizer_class=Visualizer, controller_class=ControllerCLFBayesian, train_every_n_steps=20, **kw)

mean_dynamics is either ZeroDynamicsModel(m = 2, n = 3) or AckermanDrive(L = 10.0)

Source code in bayes_cbf/bulletcar/safe_control.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
def track_trajectory_ackerman_clf_bayesian(x, x_g, dt = None,
                                           cbfs = None,
                                           cbf_gammas = None,
                                           numSteps = None,
                                           enable_learning = True,
                                           mean_dynamics_gen=partial(AckermanDrive,
                                                                     L = 10.0),
                                           true_dynamics_gen=RacecarEnv,
                                           visualizer_class=Visualizer,
                                           controller_class=ControllerCLFBayesian,
                                           train_every_n_steps = 20,
                                           **kw):
    """
    mean_dynamics is either ZeroDynamicsModel(m = 2, n = 3) or AckermanDrive(L = 10.0)
    """
    obstacles = cbfs(x, x_g)
    visualizer = visualizer_class(
        PiecewiseLinearPlanner(x, x_g, numSteps, dt),
        dt,
        cbfs = obstacles
    )
    true_dynamics_model = true_dynamics_gen()
    for i, obs in enumerate(obstacles):
        true_dynamics_model.create_new_obstacle('obstacle_%d' % i,
                                                obs.center,
                                                obs.radius)
    return sample_generator_trajectory(
        dynamics_model=true_dynamics_model,
        D=numSteps,
        controller=controller_class(
            PiecewiseLinearPlanner(x, x_g, numSteps, dt,
                                   frac_time_to_reach_goal=0.95),
            coordinate_converter = lambda x, x_g: x,
            dynamics = LearnedShiftInvariantDynamics(
                dt = dt,
                mean_dynamics = mean_dynamics_gen(),
                enable_learning = enable_learning,
                train_every_n_steps = train_every_n_steps
            ),
            # dynamics = ZeroDynamicsBayesian(m = 2, n = 3),
            clf = CLFCartesian(
                Kp = torch.tensor([0.9, 1.5, 0.])
            ),
            cbfs = cbfs(x , x_g),
            cbf_gammas = cbf_gammas,
            visualizer = visualizer
        ).control,
        visualizer = visualizer,
        x0=x,
        dt=dt,
        **kw)