double_pendulum.controller.pid
Submodules
double_pendulum.controller.pid.point_pid_controller
- class double_pendulum.controller.pid.point_pid_controller.PointPIDController(torque_limit=[1.0, 1.0], dt=0.01)
Bases:
AbstractController
PID controller with a fix state as goal.
- Parameters:
- torque_limitarray_like, optional
shape=(2,), dtype=float, default=[1.0, 1.0] torque limit of the motors [tl1, tl2], units=[Nm, Nm]
- dtfloat
timestep , unit=[s] (Default value=0.01)
- get_control_output_(x, t=None)
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]
- init_()
Initialize the controller.
- save_(save_dir)
Save the energy trajectory to file.
- Parameters:
- pathstring or path object
directory where the parameters will be saved
- set_goal(x)
set_goal. Set goal for the controller.
- Parameters:
- xarray_like, shape=(4,), dtype=float,
state of the double pendulum, order=[angle1, angle2, velocity1, velocity2], units=[rad, rad, rad/s, rad/s]
- set_parameters(Kp, Ki, Kd)
Set controller gains.
- Parameters:
- Kpfloat
Gain for position error
- Kifloat
Gain for integrated error
- Kdfloat
Gain for differentiated error
double_pendulum.controller.pid.trajectory_pid_controller
- class double_pendulum.controller.pid.trajectory_pid_controller.TrajPIDController(T=None, X=None, U=None, csv_path=None, use_feed_forward_torque=True, torque_limit=[0.0, 1.0], num_break=40)
Bases:
AbstractController
PID controller for following a trajectory.
- Parameters:
- Tarray_like
shape=(N,) time points of reference trajectory, unit=[s] (Default value=None)
- Xarray_like
shape=(N, 4) reference trajectory states order=[angle1, angle2, velocity1, velocity2] units=[rad, rad, rad/s, rad/s] (Default value=None)
- Uarray_like
shape=(N, 2) reference trajectory actuations/motor torques order=[u1, u2], units=[Nm] (Default value=None)
- 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. (Default value=None)
- use_feed_forward_torquebool
whether to use feed forward torque for the control output (Default value=True)
- torque_limitarray_like, optional
shape=(2,), dtype=float, default=[0.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]
- 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]
- init_()
Initialize the controller.
- save_(save_dir)
Save the energy trajectory to file.
- Parameters:
- pathstring or path object
directory where the parameters will be saved
- set_parameters(Kp, Ki, Kd)
Set controller gains.
- Parameters:
- Kpfloat
Gain for position error
- Kifloat
Gain for integrated error
- Kdfloat
Gain for differentiated error