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
get_angle/get_angle.h@0:489498e8dae5, 2017-08-25 (annotated)
- 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?
User | Revision | Line number | New 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: calculating real-time angle |
dudu941014 | 0:489498e8dae5 | 8 | // Tool Versions: “Keil 5” or “Mbed Complie Online” |
dudu941014 | 0:489498e8dae5 | 9 | // Description: this part is to get real-time angle from angle sensor |
dudu941014 | 0:489498e8dae5 | 10 | // |
dudu941014 | 0:489498e8dae5 | 11 | // |
dudu941014 | 0:489498e8dae5 | 12 | ////////////////////////////////////////////////////////////////////////////////// |
dudu941014 | 0:489498e8dae5 | 13 | #include "mbed.h" |
dudu941014 | 0:489498e8dae5 | 14 | |
dudu941014 | 0:489498e8dae5 | 15 | extern float angle; |
dudu941014 | 0:489498e8dae5 | 16 | extern float angle_offset; |
dudu941014 | 0:489498e8dae5 | 17 | extern AnalogIn angle_voltage; |
dudu941014 | 0:489498e8dae5 | 18 | |
dudu941014 | 0:489498e8dae5 | 19 | |
dudu941014 | 0:489498e8dae5 | 20 | void angle_update(void); |