double_pendulum.controller.trajectory_following
Submodules
double_pendulum.controller.trajectory_following.feed_forward
- class double_pendulum.controller.trajectory_following.feed_forward.FeedForwardController(T, U, torque_limit=[1.0, 1.0], num_break=40)
Bases:
AbstractController
FeedforwardController Controller which executes a feedforward torque trajectory
- Parameters:
- Tarray_like
shape=(N,) time points of reference trajectory, unit=[s] (Default value=None)
- Uarray_like
shape=(N, 2) reference trajectory actuations/motor torques order=[u1, u2], units=[Nm] (Default value=None)
- torque_limitarray_like, optional
shape=(2,), dtype=float, default=[1.0, 1.0] torque limit of the motors [tl1, tl2], units=[Nm, Nm]
- num_breakint
number of break points used for interpolation (Default value = 40)
- get_control_output_(x, t)
The function to compute the control input for the double pendulum’s actuator(s).
- Parameters:
- xarray_like, shape=(4,), dtype=float,
state of the double pendulum, order=[angle1, angle2, velocity1, velocity2], units=[rad, rad, rad/s, rad/s]
- tfloat, optional
time, unit=[s] (Default value=None)
- Returns:
- array_like
shape=(2,), dtype=float actuation input/motor torque, order=[u1, u2], units=[Nm]
- save_(save_dir)
Save controller parameters
- Parameters:
- save_dirstring or path object
directory where the parameters will be saved
double_pendulum.controller.trajectory_following.trajectory_controller
- class double_pendulum.controller.trajectory_following.trajectory_controller.TrajectoryController(csv_path, torque_limit=[0.0, 1.0], kK_stabilization=False)
Bases:
AbstractController
Controllers which executes a feedforward torque trajectory and optionally stabilizes the trajectory with linear feedback.
- Parameters:
- csv_pathstring or path object
path to csv file where the trajectory is stored. csv file should use standarf formatting used in this repo. If T, X, or U are provided they are preferred.
- torque_limitarray_like, optional
shape=(2,), dtype=float, default=[0.0, 1.0] torque limit of the motors [tl1, tl2], units=[Nm, Nm]
- kK_stabilizationbool
Whether to stabilize the trajectory with linear feedback gains (K matrix and additive k vector) (Default value=False)
- get_control_output_(x, t)
The function to compute the control input for the double pendulum’s actuator(s).
- Parameters:
- xarray_like, shape=(4,), dtype=float,
state of the double pendulum, order=[angle1, angle2, velocity1, velocity2], units=[rad, rad, rad/s, rad/s]
- tfloat, optional
time, unit=[s] (Default value=None)
- Returns:
- array_like
shape=(2,), dtype=float actuation input/motor torque, order=[u1, u2], units=[Nm]
- get_init_trajectory()
Get the initial (reference) trajectory used by the controller.
- Returns:
- numpy_array
time points, unit=[s] shape=(N,)
- numpy_array
shape=(N, 4) states, units=[rad, rad, rad/s, rad/s] order=[angle1, angle2, velocity1, velocity2]
- numpy_array
shape=(N, 2) actuations/motor torques order=[u1, u2], units=[Nm]
- class double_pendulum.controller.trajectory_following.trajectory_controller.TrajectoryInterpController(csv_path, torque_limit=[0.0, 1.0], kK_stabilization=False, num_break=40)
Bases:
AbstractController
TrajectoryController Controllers which executes a feedforward torque trajectory and optionally stabilizes the trajectory with linear feedback. The trajectory can be interpolated with polynomials.
- Parameters:
- csv_pathstring or path object
path to csv file where the trajectory is stored. csv file should use standarf formatting used in this repo. If T, X, or U are provided they are preferred.
- torque_limitarray_like, optional
shape=(2,), dtype=float, default=[0.0, 1.0] torque limit of the motors [tl1, tl2], units=[Nm, Nm]
- kK_stabilizationbool
Whether to stabilize the trajectory with linear feedback gains (K matrix and additive k vector) (Default value=False)
- num_breakint
number of break points used for interpolation (Default value = 40)
- get_control_output_(x, t)
The function to compute the control input for the double pendulum’s actuator(s).
- Parameters:
- xarray_like, shape=(4,), dtype=float,
state of the double pendulum, order=[angle1, angle2, velocity1, velocity2], units=[rad, rad, rad/s, rad/s]
- tfloat, optional
time, unit=[s] (Default value=None)
- Returns:
- array_like
shape=(2,), dtype=float actuation input/motor torque, order=[u1, u2], units=[Nm]
- get_init_trajectory()
Get the initial (reference) trajectory used by the controller.
- Returns:
- numpy_array
time points, unit=[s] shape=(N,)
- numpy_array
shape=(N, 4) states, units=[rad, rad, rad/s, rad/s] order=[angle1, angle2, velocity1, velocity2]
- numpy_array
shape=(N, 2) actuations/motor torques order=[u1, u2], units=[Nm]
- save_(save_dir)
Save controller parameters
- Parameters:
- save_dirstring or path object
directory where the parameters will be saved