Teleoperated Robot Hand
Loading...
Searching...
No Matches
pid.h
Go to the documentation of this file.
1
12
13#ifndef PID_H
14#define PID_H
15
16#include "Constants.h"
17
23typedef struct {
24 float kp;
25 float ki;
26 float kd;
27 float integral;
28 float prev_error;
29 float out_min;
30 float out_max;
31} PID_t;
32
33void PositionControlFinger(uint32_t enc, uint32_t target,
34 PID_t *pid, int pwm_channel, int phase_pin,
35 float dt);
36
37void SetPhase(float u, uint32_t motor_phase_pin);
38bool HomeFinger(uint32_t enc, uint32_t home_target,
39 int pwm_channel, int phase_pin);
40
41void PID_Reset(PID_t *pid);
42void InitPIDs();
43
48extern PID_t pid_thumb;
49extern PID_t pid_index;
50extern PID_t pid_middle;
51extern PID_t pid_ring;
52extern PID_t pid_pinkie;
53extern PID_t pid_palm;
55
56#endif
Hardware configuration, calibration values, and shared data types.
void PID_Reset(PID_t *pid)
Reset a PID controller's internal state.
Definition pid.cpp:62
void SetPhase(float u, uint32_t motor_phase_pin)
Set motor direction based on signed control effort.
Definition pid.cpp:103
bool HomeFinger(uint32_t enc, uint32_t home_target, int pwm_channel, int phase_pin)
Home a single finger motor to a reference position.
Definition pid.cpp:160
void InitPIDs()
Initialize all PID controllers used by the robotic hand.
Definition pid.cpp:44
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.
Definition pid.cpp:122
PID controller state structure.
Definition pid.h:23