|
ME 405 Term Project
|
Public Member Functions | |
| __init__ (self, kp, ki, sp_sh, battery, effort_limits=(-100, 100)) | |
| reset (self) | |
| run (self, fb) | |
Public Attributes | |
| kp = kp | |
| ki = ki | |
| sp_sh = sp_sh | |
| effort_min | |
| effort_max = effort_limits | |
| float | integrator = 0.0 |
| last_time = ticks_ms() | |
| float | output = 0.0 |
| float | last_output = 0.0 |
| battery = battery | |
Static Public Attributes | |
| int | GEAR_RATIO = 3952/33 |
| int | CPR_MOTOR = 12 |
| int | CPR_WHEEL = GEAR_RATIO*CPR_MOTOR |
| int | RAD_PER_COUNT = 2 * math.pi / CPR_WHEEL |
Proportional-Integral (PI) controller for velocity control in rad/s.
Attributes:
kp: Proportional gain (share object with get() method)
ki: Integral gain (share object with get() method)
sp_sh: Setpoint share object with get() method (desired velocity in rad/s)
battery: Battery object for droop compensation (optional)
effort_limits: Tuple defining min and max effort (%)
| closed_loop.ClosedLoop.__init__ | ( | self, | |
| kp, | |||
| ki, | |||
| sp_sh, | |||
| battery, | |||
| effort_limits = (-100, 100) ) |
| closed_loop.ClosedLoop.reset | ( | self | ) |
Reset controller integrator and state.
| closed_loop.ClosedLoop.run | ( | self, | |
| fb ) |
Compute control output (effort %) from velocity feedback and measured battery voltage.
Args:
fb: Feedback velocity in rad/s.
Returns:
u: Control effort output (%).
| closed_loop.ClosedLoop.battery = battery |
|
static |
|
static |
| closed_loop.ClosedLoop.effort_max = effort_limits |
| closed_loop.ClosedLoop.effort_min |
|
static |
| float closed_loop.ClosedLoop.integrator = 0.0 |
| closed_loop.ClosedLoop.ki = ki |
| closed_loop.ClosedLoop.kp = kp |
| float closed_loop.ClosedLoop.last_output = 0.0 |
| closed_loop.ClosedLoop.last_time = ticks_ms() |
| float closed_loop.ClosedLoop.output = 0.0 |
|
static |
| closed_loop.ClosedLoop.sp_sh = sp_sh |