Actuator-FSA-Wiki
目录
文件目录说明
上手指南
安装步骤
简要示例
开发指南
执行器控制原理
伺服三环控制
由于计算机控制是一种采样控制,它只能根据采样时刻的偏差计算控制量,而不能像模拟控制那样连续输出控制量,进行连续控制。由于这一特点,P I D PID P I D 控制器中的积分项和微分项不能直接使用,必须进行离散化处理。离散化处理的方法为:以 T T T 作为采样周期,k k k 作为采样序号,则离散采样时间 k T kT k T 对应着连续时间 t t t ,用矩形法数值积分近似代替积分,用一阶后向差分近似代替微分,可作如下近似变换:
t ≈ k T ( k = 0 , 1 , 2 , … ) (1) t \approx kT \left(k = 0, 1, 2, \dots \right)
\tag{1}
t ≈ k T ( k = 0 , 1 , 2 , … ) ( 1 )
∫ e ( t ) d t ≈ T ∑ j = 0 k e ( j T ) = T ∑ j = 0 k e j (2) \int e(t) dt \approx T \sum_{j = 0}^{k} e(jT) = T \sum_{j = 0}^{k} e_{j}
\tag{2}
∫ e ( t ) d t ≈ T j = 0 ∑ k e ( j T ) = T j = 0 ∑ k e j ( 2 )
d d t e ( t ) ≈ e ( k T ) − e [ ( k − 1 ) T ] T = e k − e k − 1 T (3) \frac{d}{dt} e(t) \approx \frac{e(kT) - e[(k - 1) T]}{T} = \frac{e_{k} - e_{k - 1}}{T}
\tag{3}
d t d e ( t ) ≈ T e ( k T ) − e [( k − 1 ) T ] = T e k − e k − 1 ( 3 )
上式中,为了表达方便,将类似于 e ( j T ) e(jT) e ( j T ) 简化成 e j e_{j} e j 等。
位置控制
e j = q d j − q j e_{j} = q_{d_{j}} - q_{j}
e j = q d j − q j
e ˙ j = K p p o s e j G θ − q ˙ j G ω \dot{e}_{j} = K_{p}^{pos} e_{j} G_{\theta} - \dot{q}_{j} G_{\omega}
e ˙ j = K p p os e j G θ − q ˙ j G ω
I q s e t j = K p v e l e ˙ j + T K i v e l ∑ j = 0 k e ˙ j I_{q_{set_{j}}} = K_{p}^{vel} \dot{e}_{j} + T K_{i}^{vel} \sum_{j = 0}^{k} \dot{e}_{j}
I q se t j = K p v e l e ˙ j + T K i v e l j = 0 ∑ k e ˙ j
速度控制
e ˙ j = q ˙ d j − q ˙ j G ω \dot{e}_{j} = \dot{q}_{d_{j}} - \dot{q}_{j} G_{\omega}
e ˙ j = q ˙ d j − q ˙ j G ω
I q s e t j = K p v e l e ˙ j + T K i v e l ∑ j = 0 k e ˙ j I_{q_{set_{j}}} = K_{p}^{vel} \dot{e}_{j} + T K_{i}^{vel} \sum_{j = 0}^{k} \dot{e}_{j}
I q se t j = K p v e l e ˙ j + T K i v e l j = 0 ∑ k e ˙ j
电流控制
理想情况下,用户给定 I q I_{q} I q 值后 FSA 将会瞬间输出最大为 τ = K t I q \tau = K_{t} I_{q} τ = K t I q 的力矩,此处的 K t K_{t} K t 为电流力矩系数,执行器出厂后 K t K_{t} K t 值即确定。
Tips:
只有在执行器堵转 的情况下才能输出 τ = K t I q \tau = K_{t} I_{q} τ = K t I q 的力矩。
PD 控制
e j = q d j − q j e_{j} = q_{d_{j}} - q_{j}
e j = q d j − q j
τ j = K p p d e j + K d p d ( 0 − q ˙ j ) \tau_{j} = K_{p}^{pd} e_{j} + K_{d}^{pd} \left(0 - \dot{q}_{j} \right)
τ j = K p p d e j + K d p d ( 0 − q ˙ j )
符号表
符号
单位
释义
q q q
d e g \rm{deg} deg
实际位置
q d q_{d} q d
d e g \rm{deg} deg
目标位置
q ˙ \dot{q} q ˙
d e g / s \rm{deg/s} deg/s
实际速度
q d ˙ \dot{q_{d}} q d ˙
d e g / s \rm{deg/s} deg/s
目标速度
I q I_{q} I q
A \rm{A} A
Q 轴电流
τ \tau τ
N ⋅ m \rm{N \cdot m} N ⋅ m
力矩
e e e
d e g \rm{deg} deg
位置误差
e ˙ \dot{e} e ˙
d e g / s \rm{deg/s} deg/s
速度误差
T T T
s \rm{s} s
控制周期
API 介绍
通信
配置
控制
使能/失能
1 2 3 4 5 6 7 8 9 10 11 12 13 int Actuator::enable_set (char *ip) ;int Actuator::disable_set (char *ip) ;enable_set ("192.168.137.101" ); disable_set ("192.168.137.101" );
1 2 3 4 5 6 7 8 9 10 11 12 13 def set_enable (server_ip )def set_disable (server_ip )fi_fsa.set_enable("192.168.137.101" ) fi_fsa.set_disable("192.168.137.101" )
设置工作模式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 int Actuator::set_mode_of_operation (char *ip, uint8_t mode) ;class FsaModeOfOperation {public : int NONE = 0 ; int CURRENT_CLOSE_LOOP_CONTROL = 4 ; int VELOCITY_CONTROL = 3 ; int POSITION_CONTROL = 1 ; int TRAPEZOIDAL_CONTROL = 5 ; }; FsaModeOfOperation modeOfOper; set_mode_of_operation ("192.168.137.101" , modeOfOper.VELOCITY_CONTROL);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 def set_mode_of_operation (server_ip, mode_of_operation )class FSAModeOfOperation : NONE = 0 TORQUE_CONTROL = 6 CURRENT_CONTROL = 4 VELOCITY_CONTROL = 3 POSITION_CONTROL = 1 CURRENT_CLOSE_LOOP_CONTROL = 4 POSITION_CONTROL_PD = 7 fi_fsa.set_mode_of_operation("192.168.137.101" , fi_fsa.FSAModeOfOperation.VELOCITY_CONTROL)
发送控制指令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 int Actuator::set_position_control (char *ip, double pos, double vel, double acc) ;int Actuator::set_velocity_control (char *ip, double vel, double cur_ff) ;int Actuator::set_current_control (char *ip, double current_val) ;int Actuator::set_position_control (char *ip, double pos, double vel, double acc) ;set_position_control ("192.168.137.101" , 90 , 0 , 0 ); set_velocity_control ("192.168.137.101" , 90 , 0 ); set_current_control ("192.168.137.101" , 1 );
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 def set_position_control (server_ip, position, velocity_ff=0.0 , current_ff=0.0 )def set_velocity_control (server_ip, velocity, current_ff=0.0 )def set_current_control (server_ip, current )def set_position_control (server_ip, position, velocity_ff=0.0 , current_ff=0.0 )fi_fsa.set_position_control("192.168.137.101" , 90 , 0 , 0 ) fi_fsa.set_velocity_control("192.168.137.101" , 90 , 0 ) fi_fsa.set_current_control("192.168.137.101" , 1 )