this code is for inverted pendulum balancer. it is based on two-loop PID controller. One controller is for Angle and another one is for velocity.

Dependencies:   HCSR04 L298HBridge mbed

Committer:
dudu941014
Date:
Fri Aug 25 21:10:23 2017 +0000
Revision:
0:489498e8dae5
this code is for inverted pendulum balancer. it is based on two-loop PID controller. one PID controller is for angle and another one is for velocity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dudu941014 0:489498e8dae5 1 //////////////////////////////////////////////////////////////////////////////////
dudu941014 0:489498e8dae5 2 // Company: edinburgh of university
dudu941014 0:489498e8dae5 3 // Engineer: ZEjun DU
dudu941014 0:489498e8dae5 4 //
dudu941014 0:489498e8dae5 5 // Create Date: 2017/08/20 13:06:52
dudu941014 0:489498e8dae5 6 // Design Name: Inverted Pendulum Balancer
dudu941014 0:489498e8dae5 7 // Module Name: basic PID algorithm
dudu941014 0:489498e8dae5 8 // Tool Versions: “Keil 5” or “Mbed Complie Online”
dudu941014 0:489498e8dae5 9 // Description: this funcition is to control and manage the PID mode
dudu941014 0:489498e8dae5 10 // the main loop only need to invoke this module's funcition
dudu941014 0:489498e8dae5 11 //
dudu941014 0:489498e8dae5 12 //////////////////////////////////////////////////////////////////////////////////
dudu941014 0:489498e8dae5 13
dudu941014 0:489498e8dae5 14 #ifndef STABILIZER_H
dudu941014 0:489498e8dae5 15 #define STABILIZER_H
dudu941014 0:489498e8dae5 16
dudu941014 0:489498e8dae5 17 #include "mbed.h"
dudu941014 0:489498e8dae5 18 #include "L298HBridge.h"
dudu941014 0:489498e8dae5 19
dudu941014 0:489498e8dae5 20 extern float M_Thr;
dudu941014 0:489498e8dae5 21 extern float M_Alt;
dudu941014 0:489498e8dae5 22 extern int PID_ctrl;
dudu941014 0:489498e8dae5 23 extern int Velocity_ctrl;
dudu941014 0:489498e8dae5 24
dudu941014 0:489498e8dae5 25 void stabilize_task(void);
dudu941014 0:489498e8dae5 26
dudu941014 0:489498e8dae5 27 #endif