Giter Club home page Giter Club logo

fopd-tuner's Introduction

FOPD-tuner

Fractional order proportional derivative controller tuner

Related Publications:

Bo Shang, Jianxin Liu, Tiebiao Zhao and YangQuan Chen, "Fractional order robust visual servoing control of a quadrotor UAV with larger sampling period," 2016 International Conference on Unmanned Aircraft Systems (ICUAS), Arlington, VA, 2016, pp. 1228-1234. PDF

1. License

FOPD-tunner is released under a MIT license.

If you use FOPD-tunner in an academic work, please cite:

@inproceedings{shang2016fractional,
  title={Fractional order robust visual servoing control of a quadrotor UAV with larger sampling period},
  author={Shang, Bo and Liu, Jianxin and Zhao, Tiebiao and Chen, YangQuan},
  booktitle={Unmanned Aircraft Systems (ICUAS), 2016 International Conference on},
  pages={1228--1234},
  year={2016},
  organization={IEEE}
}

2. Prerequisites

We have tested the library in MATLAB 2018a and Windows 7, but it should be easy to run in other platforms.

Control model

screenshot 2017-08-15 17 51 47

MATLAB System Identification Toolbox

Convert the identified model to this format:

screenshot 2017-08-15 20 25 37

Then we can get the parameter k and tau.

FOTF Toolbox

https://www.mathworks.com/matlabcentral/fileexchange/60874-fotf-toolbox

Oustaloup

3. Downloading FOPD-tunner library and run examples

Clone the repository:

git clone https://github.com/cnpcshangbo/FOPD-tunner.git

4. Run examples

Tune IOPID controller

Enter the folder named "1. iopid_tune_pid", open "iopid_tune.m", update the plant parameters identified with MATLAB System Identification Toolbox and set cross-over frequency omega_c and phase margin phi.

%% Setting plant parameters
global K T1 wc phi %inputs
K = -0.8592; %plant gain
T1 = 1.0710; %plant time constant
wc = 1.2; %crossoverfrequency
phi = 83.9; %phase margin

then run it to tune IOPID controller and get related parameters (integer order PID parameters kp, ki, kd, ).

Tune FOPD controller

Setting parameters

Open file "cal_lambda_ki_kp_bode.m". Set fractional order lambda to -1~0.

Note: When lambda is negative, a FOPI controller becomes a FOPD controller.

Plotting ki against lambda

Run the first cell of "cal_lambda_ki_kp_bode.m". You will see the three curves. Zoom the curves to find crosspoints. The coordinates of the crosspoints are lambda and ki.

Verify the crosspoints

Run the "Solution 1" cell of "cal_lambda_ki_kp_bode.m" to double check if the crosspoint is the REAL solution of the equations. If ki is complex number, there's no real solution. It means the phase curve at cross-over frequency can not be flat under current cross-over frequency omega_c and phase margin phi. Either change them or use optimization method to make the derivate of phase the smallest at cross-over frequency.

Verify the tuned FOPD controller

Run the "Verify the controller 1" cell of "cal_lambda_ki_kp_bode.m" to verify if the phase curve is flat at crossover frequency. At the same time kp will be displayed. The we can get the transfer function of the tuned FOPD controller.

Controller analysis with Simulink

Open the file "run_simulink.m", update the parameters and run the script. image image

Co-Simulation with Gazebo

We use the Robotics System Toolbox to cooperate with Gazebo. The Gazebo part follows Erlerobotics simulation.

Follow this document to take off the drone:

http://docs.erlerobotics.com/simulation/vehicles/erle_copter/tutorial_5 drone taken off

Launch MATLAB

Install Robotics System Toolbox. Initial ROS in MATLAB.

ROS with MATLAB node

Use the ROS Publish block in Simulink to publish topic for velocity setpoint. ROS Publish block

Use Simulink to move a drone in Gazebo

fopd-tuner's People

Contributors

cnpcshangbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fopd-tuner's Issues

How to integrate MATLAB optimization method for tuning?

First, we need to figure out what objective function to use for tuning parameters.

There're several options:

  • ITAE
  • Gain and phase margin, Bode loop shaping, flat phase specification
  • ITAE + ITAE (50%gain) + ITAE (150%gain)

What is the function that we want to tune?

  • ITAE
    If we use ITAE as the objective function, we need to make a MATLAB function that can output the ITAE value with inputs of three parameters to be tuned. That means the MATLAB function should be able to call a Simulink model, then fill parameters into the Simulink model, run it and collect the ITAE value.

  • PM (Phase margin)
    If we want to make PM to be minimum, we need to create a MATLAB function that can output the PM. This can be realized by using bode() function in MATLAB. Therefore, PM method is the simplest one which we need to try first.

To-do list:

  • Create objective function;
  • Determine the input value range and output range;
  • Put constrains into optimization script.

Arg equation doesn't match Bode plot?

From out derivation,

    APM1 = atan2(ki*w^lambda*sin(pi*lambda/2),(1+ki*w^lambda*cos(pi*lambda/2)))+atan2(1,T1*w).

It should have the same results as our Bode phase plot, however they don't match for the FOPD controller.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.