Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: BilateralTeleoperation
PID.h
- Committer:
- sangbae
- Date:
- 2022-09-26
- Revision:
- 1:f39ce45861fb
File content as of revision 1:f39ce45861fb:
//Ben Katz, 2013
//PID Controller class
#include "mbed.h"
#ifndef PID_H
#define PID_H
class PIDController{
public:
PIDController(float desired_position, float desired_torque, float p_gainp, float d_gainp, float i_gain_p, float p_gain_c, float i_gain_c);
~PIDController();
float goal_position;
float current_position;
float kp_p;
float kd_p;
float ki_p;
float kp_c;
float ki_c;
float c_error;
float error_sum;
float command;
float torque_command;
float c_torque;
float error;
float old_error;
float integral_error;
int counter;
Timer timer;
float torque;
float direction;
float past_currents [5];
float command_position(void);
float command_torque(void);
float command_position_tm(void);
private:
};
#endif