Since I decided to control the robot at work, I summarized it to know the following. ・ Review of basic knowledge of control engineering ・ How to draw control system and PID control with python ・ To understand the Kalman filter and self-position estimation by understanding the state space model
Hiroki Minami, Ohmsha, "Introduction to Control Engineering with Python"
Contents of Chapter 3 of "Introduction to Control Engineering with Python"
Import the following libraries
import sympy import control
The code is shown below
# chapter 3-2 Transfer function model
Np = [0,1]
Dp = [1,2,3]
P = control.tf(Np, Dp)
print(P)
output
1
-------------
s^2 + 2 s + 3
The code is shown below
#3-3 State space model
A = '1 1 2; 2 1 1; 3 4 5'
B = '2; 0; 1'
C = '1 1 0'
D = '0'
P = control.ss(A,B,C,D)
print(P)
sysA, sysB, sysC, sysD = control.ssdata(P)
print(sysA)
output
A = [[1. 1. 2.]
[2. 1. 1.]
[3. 4. 5.]]
B = [[2.]
[0.]
[1.]]
C = [[1. 1. 0.]]
D = [[0.]]
[[1. 1. 2.]
[2. 1. 1.]
[3. 4. 5.]]
-Using libraries such as control and sympy, Laplace transform and transfer function notation can be done so easily.
Recommended Posts