|
Teleoperated Robot Hand
|
PID control and motor control API for robotic hand fingers. More...
#include "Constants.h"Go to the source code of this file.
Classes | |
| struct | PID_t |
| PID controller state structure. More... | |
Functions | |
| void | PositionControlFinger (uint32_t enc, uint32_t target, PID_t *pid, int pwm_channel, int phase_pin, float dt) |
| Perform PID-based position control for a single finger motor. | |
| void | SetPhase (float u, uint32_t motor_phase_pin) |
| Set motor direction based on signed control effort. | |
| bool | HomeFinger (uint32_t enc, uint32_t home_target, int pwm_channel, int phase_pin) |
| Home a single finger motor to a reference position. | |
| void | PID_Reset (PID_t *pid) |
| Reset a PID controller's internal state. | |
| void | InitPIDs () |
| Initialize all PID controllers used by the robotic hand. | |
Variables | |
Global PID controller instances | |
PID controllers for each finger and palm motor. | |
| PID_t | pid_thumb |
| PID_t | pid_index |
| PID_t | pid_middle |
| PID_t | pid_ring |
| PID_t | pid_pinkie |
| PID_t | pid_palm |
PID control and motor control API for robotic hand fingers.
This header defines:
Implementation details are provided in pid.cpp.
| bool HomeFinger | ( | uint32_t | enc, |
| uint32_t | home_target, | ||
| int | pwm_channel, | ||
| int | phase_pin ) |
Home a single finger motor to a reference position.
Drives the motor toward a known home encoder value using a proportional controller until the error falls below ::HOMING_THRESHOLD.
| enc | Current encoder reading. |
| home_target | Desired home encoder value. |
| pwm_channel | LEDC PWM channel controlling the motor. |
| phase_pin | GPIO pin controlling motor direction. |
| void InitPIDs | ( | ) |
Initialize all PID controllers used by the robotic hand.
Sets gains and output limits for all fingers and palm.
| void PID_Reset | ( | PID_t * | pid | ) |
Reset a PID controller's internal state.
Clears the integral accumulator and previous error term.
| pid | Pointer to PID controller structure. |
| void PositionControlFinger | ( | uint32_t | enc, |
| uint32_t | target, | ||
| PID_t * | pid, | ||
| int | pwm_channel, | ||
| int | phase_pin, | ||
| float | dt ) |
Perform PID-based position control for a single finger motor.
Computes the control effort using PID, sets motor direction, enforces a minimum PWM threshold, and applies the PWM output.
| enc | Current encoder reading. |
| target | Desired encoder target value. |
| pid | Pointer to PID controller for this finger. |
| pwm_channel | LEDC PWM channel controlling the motor. |
| phase_pin | GPIO pin controlling motor direction. |
| dt | Control loop timestep in seconds. |
| void SetPhase | ( | float | u, |
| uint32_t | motor_phase_pin ) |
Set motor direction based on signed control effort.
Uses the sign of the control signal to determine the motor rotation direction via the phase pin.
| u | Signed control output. |
| motor_phase_pin | GPIO pin controlling motor direction. |