使用PID和LQR控制器进行多旋翼飞行器控制

2023-05-16

任务内容

通过调整PID和LQR控制器以实现稳定悬停的多旋翼飞行器,运用在无论是在仿真中还是在实际系统中。

参考内容

LQR控制部分基础参考内容:

LQR控制器

参考链接:

Linear Quadratic Regulator (LQR) With Python Code Example

设计方案

A:高度和偏航控制——PID控制器

对于PID的参数整形,可以参考如下三种方案(根据实机情况选择其一,或将多种方案进行相互对比)

  1. 运用齐格勒-尼科尔斯法则(Ziegler-Nichols method)获取初始估测值。

    该方法是基于系统稳定性分析的PID整定方法.在设计过程中无需考虑任何特性要求,整定方法非常简单,但控制效果却比较理想.具体整定方法如下:

    首先,假设只有比例控制,置 k d = k i = 0 k_{d}=k_{i}=0 kd=ki=0,然后增加比例系数一直到系统首次出现等幅振荡(闭环系统的极点在jω轴上),此时获取系统开始振荡时的临界增益 K m K_{m} Km

    再将该比例系数根据下面的表格乘以对应的参数,这里乘以0.6

     调节器的类型  K p T i T d P 0.5 K e ∞ 0 P I 0.45 K e 1 1.2 T e 0 P I D 0.6 K e 0.5 T e 0.125 T e \begin{array}{|c|c|c|c|}\hline \text{ 调节器的类型 } & K_{p} & T_{i} & T_{d}\\\hline P & 0.5K_{e} & \infty & 0\\\hline PI & 0.45K_{e} & \frac{1}{1.2}T_{e} & 0 \\\hline PID & 0.6K_{e} & 0.5T_{e} & 0.125T_{e} \\\hline \end{array}  调节器的类型 PPIPIDKp0.5Ke0.45Ke0.6KeTi1.21Te0.5TeTd000.125Te

    其他参数按照以下公式计算:

    K p = 0.6 ∗ K m K d = K p ∗ π 4 ω K i = K p ∗ ω π K_{p}=0.6*K_{m}\\K_{d}=K_{p}*\frac{\pi}{4\omega}\\K_{i}=K_{p}*\frac{\omega}{\pi} Kp=0.6KmKd=Kp4ωπKi=Kpπω

    其中 K p K_{p} Kp为比例控制参数, K i K_{i} Ki为积分控制参数, K d K_{d} Kd为微分控制参数, ω \omega ω为振荡时的频率。

    用上述法则确定PID控制器的参数,使系统的超调量在10%~60%之间,其平均值约为25%。

  2. 使用仿真获取对应的增益值。

  3. 在真实系统中修改对应的增益值。

    方法:缓慢增加 P 直至振荡开始,然后慢慢加入少量D来抑制振荡,然后慢慢添加少量的I来纠正任何稳态误差。

B1:x,y位置控制——LQR控制器

对于多旋翼飞行器来说,线性运动方程表明了对于从位置坐标中获取的x坐标 p x p_{x} px和y坐标 p y p_{y} py以及滚转角 β \beta β和俯仰角 γ \gamma γ之间的完全解耦。

[ p ˙ x p ¨ x β ˙ ] = [ 0 1 0 0 0 g 0 0 0 ] [ p x p ˙ x β ] + [ 0 0 1 ] [ ω y ] \left[\begin{array}{l}\dot{p}_{x} \\\ddot{p}_{x} \\\dot{\beta}\end{array}\right]=\left[\begin{array}{lll}0 & 1 & 0 \\0 & 0 & g \\0 & 0 & 0\end{array}\right]\left[\begin{array}{l}p_{x} \\\dot{p}_{x} \\\beta\end{array}\right]+\left[\begin{array}{l}0 \\0 \\1\end{array}\right]\left[\omega_{y}\right] p˙xp¨xβ˙=0001000g0pxp˙xβ+001[ωy]

[ p ˙ y p ¨ y γ ˙ ] = [ 0 1 0 0 0 − g 0 0 0 ] [ p y p ˙ y γ ] + [ 0 0 1 ] [ ω x ] \left[\begin{array}{c}\dot{p}_{y} \\\ddot{p}_{y} \\\dot{\gamma}\end{array}\right]=\left[\begin{array}{ccc}0 & 1 & 0 \\0 & 0 & -g \\0 & 0 & 0\end{array}\right]\left[\begin{array}{c}p_{y} \\\dot{p}_{y} \\\gamma\end{array}\right]+\left[\begin{array}{l}0 \\0 \\1\end{array}\right]\left[\omega_{x}\right] p˙yp¨yγ˙=0001000g0pyp˙yγ+001[ωx]

因此,我们可以使用俯仰率 ω y \omega_{y} ωy来控制一个机体坐标 x 位置误差,以及滚转率 ω x \omega_{x} ωx来控制一个机体坐标 y 位置误差。(内环 → 外环控制)

此任务的目标是分别为每个 x 和 y 设计一个 LQR 控制器。

Linear Quadratic Regulator,首字母缩略词 LQR 代表线性二次调节器器。名称本身指定此控制器设计方法适用的设置:

  • 系统的动态是线性的,
  • 要最小化的成本函数 (cost function) 是二次的,
  • 系统化的控制器将状态调节为零。

以下信息总结了合成一个无穷小界LQR控制器的步骤和方程。由此得到的控制器被称为“线性状态反馈控制器”,通常用矩阵“K”表示。状态反馈矩阵K对系统的每个输入有一行,对系统的每个状态有一列。

  • 连续时间和离散时间线性系统动力学分别记为

    x ˙ = A x + B u , x k + 1 = A D x k + B D u k \dot{x}=A x+B u, \quad x_{k+1}=A_{\mathrm{D}} x_{k}+B_{\mathrm{D}} u_{k} x˙=Ax+Bu,xk+1=ADxk+BDuk

    为了将连续时间系统矩阵A和B转换为离散时间系统矩阵 A D A_{D} AD B D B_{D} BD,使用MATLAB函数c2d,指定零阶保持 (zero order hold) 作为离散化方法。

  • 需要选择Q和R成本函数 (cost function) 矩阵来实现飞行器的期望飞行性能。在无限时间跨度 (infinite-horizon) 的LQR代价函数为:

    J ∞ = ∫ 0 ∞ ( x ( t ) ⊤ Q x ( t ) + u ( t ) ⊤ R u ( t ) ) d t J_{\infty}=\int_{0}^{\infty}\left(x(t)^{\top} Q x(t)+u(t)^{\top} R u(t)\right) d t J=0(x(t)Qx(t)+u(t)Ru(t))dt

  • Q是状态成本矩阵,其行数和列数与状态数相同,该矩阵权衡状态向量中每个状态的相对重要性,而R是输入成本矩阵,行数与控制输入的行数相同,列数与控制输入的列数相同,该矩阵惩罚执行器的工作量。

    要选择 Q 和 R 成本函数矩阵,应该考虑状态向量的不同元素。例如,也许您希望惩罚10厘米的 x 位置偏差与偏航 5 度偏差的量相同。

  • 使用 MATLAB 函数 care 和 dare 分别计算连续和离散时间的 Riccati 代数方程。可以参考MATLAB阅读帮助文档从而了解这些函数的计算。

  • 连续时间线性时间不变(LTI)的无限时间跨度 LQR 设计方程系统是(直接取自控制系统I讲义):

    0 = − A ⊤ P ∞ − P ∞ A + P ∞ B R − 1 B ⊤ P ∞ − Q u ( t ) = − K ∞ x ( t ) K ∞ = R − 1 B ⊤ P ∞ \begin{aligned}0 &=-A^{\top} P_{\infty}-P_{\infty} A+P_{\infty} B R^{-1} B^{\top} P_{\infty}-Q \\u(t) &=-K_{\infty} x(t) \\K_{\infty} &=R^{-1} B^{\top} P_{\infty}\end{aligned} 0u(t)K=APPA+PBR1BPQ=Kx(t)=R1BP

    其中:

    第一个方程是求解 P ∞ P_{\infty} P的 Riccati 方程

    第二个是实现的控制率 u ( t ) u(t) u(t)

    第三个是状态反馈增益矩阵 K ∞ K_{\infty} K

  • 离散时间 LTI 系统的无限时间跨度 LQR 设计方程为:

    0 = − P ∞ , D + A D ⊤ P D , ∞ A D − A D ⊤ P D , ∞ B D ( B D ⊤ P D , ∞ B D + R ) − 1 B D ⊤ P D , ∞ A D + Q u D ( k ) = − K D , ∞ x D ( k ) K D , ∞ = ( B D ⊤ P D , ∞ B D + R ) − 1 B D ⊤ P D , ∞ A D \begin{aligned}0 &=-P_{\infty, \mathrm{D}}+A_{\mathrm{D}}^{\top} P_{\mathrm{D}, \infty} A_{\mathrm{D}}-A_{\mathrm{D}}^{\top} P_{\mathrm{D}, \infty} B_{\mathrm{D}}\left(B_{\mathrm{D}}^{\top} P_{\mathrm{D}, \infty} B_{\mathrm{D}}+R\right)^{-1} B_{\mathrm{D}}^{\top} P_{\mathrm{D}, \infty} A_{\mathrm{D}}+Q \\u_{\mathrm{D}}(k) &=-K_{\mathrm{D}, \infty} x_{\mathrm{D}}(k) \\K_{\mathrm{D}, \infty} &=\left(B_{\mathrm{D}}^{\top} P_{\mathrm{D}, \infty} B_{\mathrm{D}}+R\right)^{-1} B_{\mathrm{D}}^{\top} P_{\mathrm{D}, \infty} A_{\mathrm{D}}\end{aligned} 0uD(k)KD,=P,D+ADPD,ADADPD,BD(BDPD,BD+R)1BDPD,AD+Q=KD,xD(k)=(BDPD,BD+R)1BDPD,AD

    其中下标 ( . ) D (.)_{D} (.)D表示适用于离散时间系统的变量

  • care 和 dare 函数都可以返回状态反馈增益矩阵,如果使用此矩阵,需要注意符号约定。

B2:x,y位置控制——PID控制器

如果您还希望为(x, y)位置实现一个PID控制器,这是相关的任务描述。

基于A方案中实现一个针对高度和偏航的PID控制器的进一步任务:设计、实现和调整一个PID控制器来控制 x 和 y 位置。

回想一下,在B方案中提供的线性化的运动方程,表明了 x 位置和俯仰角与 y 位置和滚转角之间的完全解耦。

因此,我们可以使用俯仰率 ω y \omega_{y} ωy来控制机体坐标 x 位置误差,而滚转率 ω x \omega_{x} ωx来控制机体坐标 y 位置误差。

由于俯仰(或滚转)角度的动力学比x(或y)位置的动力学足够快,因此我们也可以用一个嵌套的控制器合理地控制位置误差。“外部控制”环取一个x位置误差,并请求一个俯仰角β来纠正误差,然后“内环”取这个请求的俯仰角β的误差,并请求一个关于机体坐标y轴的角速率ωy来纠正误差。

C:为x,y位置添加积分器

一旦您完成了先前B任务中(x, y)位置的LQR控制器的实现,请观察在跟踪(x, y)设定点时的稳态偏移量。尝试调整飞行器中的电池的位置几毫米,并再次观察稳态偏移量。

观察稳态偏移量,并在每个 x 和 y 位置控制器上添加一个积分器,以消除稳态偏移量。

算法逻辑

B1:x,y位置控制——LQR控制器

LQR 使用一种称为动态规划的技术。当飞行器在世界上移动时,在每个时间步长t处,使用一系列 for 循环(其中我们运行每个for循环N次)计算最佳控制输入,这些循环输出对应于最小总成本的 u(即控制输入)。

  • 初始化 LQR 函数:传入 7 个参数。

    LQR(Actual State x, Desired State xf, Q, R, A, B, dt);

    x_error = Actual State x – Desired State xf

  • 初始化时间步长 N

    通常将N设置为某个任意整数,如50。LQR 问题的解决方案以递归方式获得,从最后一个时间步开始,并及时向后工作到第一个时间步。

    换句话说,for 循环(我们将在一秒钟内到达这些循环)需要经过大量迭代(在本例中为 50 次)才能达到 P 的稳定值(我们将在下一步中介绍 P)。

  • 初始化 P 为包含 N+1 个元素的空列表

    P[N]=Q

    循环i从N到1,分别用以下公式 (Riccati方程) 计算 P[i-1]

    P[i-1] = Q + ATP[i]A – (ATP[i]B)(R + BTP[i]B)-1(BTP[i]A)

  • 初始化 K 和 u 分别为包含 N 个元素的空列表

    循环i从0到N-1,分别用以下公式计算状态反馈增益矩阵 K[i]

    K[i] = -(R + BTP[i+1]B)-1BTP[i+1]A

    K 将保持最佳反馈增益值。这是一个重要的矩阵,当乘以状态误差 x ( t ) x(t) x(t)时,将生成最佳控制输入 u ( t ) u(t) u(t)(请参阅下一步)。

  • 循环i从0到N-1,分别用以下公式计算控制输入

    u[i] = K[i] @ x_error

    我们对for循环进行N次迭代,直到我们得到最优控制输入u的稳定值(例如u = [线速度v,角速度ω])。我假设当N = 50时达到稳定值。

  • 返回最佳控制量u_star

    u_star = u[N-1]

    最佳控制输入u_star。这是我们在上面的上一步中计算的最后一个值。它位于u列表的最后。

    返回最佳控制输入。这些输入将被发送到我们的飞行器,以便它可以移动到新的状态(即新的x位置,y位置和偏航角γ)。

代码内容(部分)

这里以双轮小车为例,分析LQR控制系统的代码设计

import numpy as np

# Description: Linear Quadratic Regulator example 
#   (two-wheeled differential drive robot car)
 
######################## DEFINE CONSTANTS #####################################
# Supress scientific notation when printing NumPy arrays
np.set_printoptions(precision=3,suppress=True)
 
# Optional Variables
max_linear_velocity = 3.0 # meters per second
max_angular_velocity = 1.5708 # radians per second
 
def getB(yaw, deltat):
    """
    Calculates and returns the B matrix
    3x2 matix ---> number of states x number of control inputs
 
    Expresses how the state of the system [x,y,yaw] changes
    from t-1 to t due to the control commands (i.e. control inputs).
     
    :param yaw: The yaw angle (rotation angle around the z axis) in radians 
    :param deltat: The change in time from timestep t-1 to t in seconds
     
    :return: B matrix ---> 3x2 NumPy array
    """
    B = np.array([  [np.cos(yaw)*deltat, 0],
                                    [np.sin(yaw)*deltat, 0],
                                    [0, deltat]])
    return B
 
 
def state_space_model(A, state_t_minus_1, B, control_input_t_minus_1):
    """
    Calculates the state at time t given the state at time t-1 and
    the control inputs applied at time t-1
     
    :param: A   The A state transition matrix
        3x3 NumPy Array
    :param: state_t_minus_1     The state at time t-1  
        3x1 NumPy Array given the state is [x,y,yaw angle] ---> 
        [meters, meters, radians]
    :param: B   The B state transition matrix
        3x2 NumPy Array
    :param: control_input_t_minus_1     Optimal control inputs at time t-1  
        2x1 NumPy Array given the control input vector is 
        [linear velocity of the car, angular velocity of the car]
        [meters per second, radians per second]
         
    :return: State estimate at time t
        3x1 NumPy Array given the state is [x,y,yaw angle] --->
        [meters, meters, radians]
    """
    # These next 6 lines of code which place limits on the angular and linear 
    # velocities of the robot car can be removed if you desire.
    control_input_t_minus_1[0] = np.clip(control_input_t_minus_1[0],
                                                                            -max_linear_velocity,
                                                                            max_linear_velocity)
    control_input_t_minus_1[1] = np.clip(control_input_t_minus_1[1],
                                                                            -max_angular_velocity,
                                                                            max_angular_velocity)
    state_estimate_t = (A @ state_t_minus_1) + (B @ control_input_t_minus_1) 
             
    return state_estimate_t
     
def lqr(actual_state_x, desired_state_xf, Q, R, A, B, dt):
    """
    Discrete-time linear quadratic regulator for a nonlinear system.
 
    Compute the optimal control inputs given a nonlinear system, cost matrices, 
    current state, and a final state.
     
    Compute the control variables that minimize the cumulative cost.
 
    Solve for P using the dynamic programming method.
 
    :param actual_state_x: The current state of the system 
        3x1 NumPy Array given the state is [x,y,yaw angle] --->
        [meters, meters, radians]
    :param desired_state_xf: The desired state of the system
        3x1 NumPy Array given the state is [x,y,yaw angle] --->
        [meters, meters, radians]   
    :param Q: The state cost matrix
        3x3 NumPy Array
    :param R: The input cost matrix
        2x2 NumPy Array
    :param dt: The size of the timestep in seconds -> float
 
    :return: u_star: Optimal action u for the current state 
        2x1 NumPy Array given the control input vector is
        [linear velocity of the car, angular velocity of the car]
        [meters per second, radians per second]
    """
    # We want the system to stabilize at desired_state_xf.
    x_error = actual_state_x - desired_state_xf
 
    # Solutions to discrete LQR problems are obtained using the dynamic 
    # programming method.
    # The optimal solution is obtained recursively, starting at the last 
    # timestep and working backwards.
    # You can play with this number
    N = 50
 
    # Create a list of N + 1 elements
    P = [None] * (N + 1)
     
    Qf = Q
 
    # LQR via Dynamic Programming
    P[N] = Qf
 
    # For i = N, ..., 1
    for i in range(N, 0, -1):
 
        # Discrete-time Algebraic Riccati equation to calculate the optimal 
        # state cost matrix
        P[i-1] = Q + A.T @ P[i] @ A - (A.T @ P[i] @ B) @ np.linalg.pinv(
            R + B.T @ P[i] @ B) @ (B.T @ P[i] @ A)      
 
    # Create a list of N elements
    K = [None] * N
    u = [None] * N
 
    # For i = 0, ..., N - 1
    for i in range(N):
 
        # Calculate the optimal feedback gain K
        K[i] = -np.linalg.pinv(R + B.T @ P[i+1] @ B) @ B.T @ P[i+1] @ A
 
        u[i] = K[i] @ x_error
 
    # Optimal control input is u_star
    u_star = u[N-1]
 
    return u_star
 
def main():
     
    # Let the time interval be 1.0 seconds
    dt = 1.0
     
    # Actual state
    # Our robot starts out at the origin (x=0 meters, y=0 meters), and 
    # the yaw angle is 0 radians. 
    actual_state_x = np.array([0,0,0]) 
 
    # Desired state [x,y,yaw angle]
    # [meters, meters, radians]
    desired_state_xf = np.array([2.000,2.000,np.pi/2])  
     
    # A matrix
    # 3x3 matrix -> number of states x number of states matrix
    # Expresses how the state of the system [x,y,yaw] changes 
    # from t-1 to t when no control command is executed.
    # Typically a robot on wheels only drives when the wheels are told to turn.
    # For this case, A is the identity matrix.
    # Note: A is sometimes F in the literature.
    A = np.array([  [1.0,  0,   0],
                                    [  0,1.0,   0],
                                    [  0,  0, 1.0]])
 
    # R matrix
    # The control input cost matrix
    # Experiment with different R matrices
    # This matrix penalizes actuator effort (i.e. rotation of the 
    # motors on the wheels that drive the linear velocity and angular velocity).
    # The R matrix has the same number of rows as the number of control
    # inputs and same number of columns as the number of 
    # control inputs.
    # This matrix has positive values along the diagonal and 0s elsewhere.
    # We can target control inputs where we want low actuator effort 
    # by making the corresponding value of R large. 
    R = np.array([[0.01,   0],  # Penalty for linear velocity effort
                [  0, 0.01]]) # Penalty for angular velocity effort
 
    # Q matrix
    # The state cost matrix.
    # Experiment with different Q matrices.
    # Q helps us weigh the relative importance of each state in the 
    # state vector (X, Y, YAW ANGLE). 
    # Q is a square matrix that has the same number of rows as 
    # there are states.
    # Q penalizes bad performance.
    # Q has positive values along the diagonal and zeros elsewhere.
    # Q enables us to target states where we want low error by making the 
    # corresponding value of Q large.
    Q = np.array([[0.639, 0, 0],  # Penalize X position error 
                                [0, 1.0, 0],  # Penalize Y position error 
                                [0, 0, 1.0]]) # Penalize YAW ANGLE heading error 
                   
    # Launch the robot, and have it move to the desired goal destination
    for i in range(100):
        print(f'iteration = {i} seconds')
        print(f'Current State = {actual_state_x}')
        print(f'Desired State = {desired_state_xf}')
         
        state_error = actual_state_x - desired_state_xf
        state_error_magnitude = np.linalg.norm(state_error)     
        print(f'State Error Magnitude = {state_error_magnitude}')
         
        B = getB(actual_state_x[2], dt)
         
        # LQR returns the optimal control input
        optimal_control_input = lqr(actual_state_x, 
                                    desired_state_xf, 
                                    Q, R, A, B, dt) 
         
        print(f'Control Input = {optimal_control_input}')
                                     
         
        # We apply the optimal control to the robot
        # so we can get a new actual (estimated) state.
        actual_state_x = state_space_model(A, actual_state_x, B, 
                                        optimal_control_input)  
 
        # Stop as soon as we reach the goal
        # Feel free to change this threshold value.
        if state_error_magnitude < 0.01:
            print("\nGoal Has Been Reached Successfully!")
            break
             
        print()
 
# Entry point for the program
main()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用PID和LQR控制器进行多旋翼飞行器控制 的相关文章

  • 单相Boost功率因数校正电路(PFC)设计与仿真(Simulink & Saber):第一章 PFC基础知识与电路参数设计

    写在前面 教程是根据Mathworks公司的有源功率因数校正教程 点这里跳转 和那日沙等老师编著的 电力电子 电机控制系统的建模及仿真 改写的 设计思路基本与之一致 嫌看文章麻烦的同学可以直接跳转看视频和查阅相关书籍 Simulink仿真部
  • PID算法应用于室内温度控制的C语言实现

    我最近在学习PID算法 对此很感兴趣 所以与大伙分享下 有不足的地方欢迎指出 非常谢谢 PID算法的基本内容本篇博客就不做阐述了 网上有很多资料 文章的主题是用C语言实现PID算法 为了更好的理解 我采用软件模拟室内温度控制的方式与大伙分享
  • 单端反激——隔离型DC/DC变换器的设计及仿真

    单端反激 隔离型DC DC变换器的设计及仿真 技术指标 1 原理分析 2 参数设计 3 仿真验证 技术指标 输入电压 V s m i n
  • # Arduino小车PID调速——整定参数初试水

    Arduino小车PID调速 整定参数初试水 在实现了小车较为可靠的测速基础上 便可以正式开展PID调速实验了 本文是基于使用Arduino平台上由Brett Beauregard大神写的PID库进行参数整定的 侧重于在对PID算法有基本了
  • PID算法与PID自整定算法

    本文是由于研发恒温槽项目故需要了解PID控制算法和PID自整定算法 为方便本人日后需要故作此记录 直接粘贴代码吧 这是PID位置式控温算法 函数名 void Pid positional float speed 用途 PID输出 说明 参数
  • 【STM32CubeMX】位置式PID调节控制输出电压(超详解)

    本文将借助STM32CubeMX来配置ADC DMA DAC USART 并利用PID位置式算法实现对输出电压进行AD采集通过PID算法调节DAC 获取到我们想要的电压值 讲解的主要知识 何为PID以及为何需要PID STM32CubeMX
  • PID算法理论,运用,代码编写详解

    什么是PID 我相信能来看这篇文章的应该都知道什么是PID PID就是一种控制算法 利用比例运算 P 积分运算 I 和微分运算 D 一起控制某一事件 当然也可以只运用其中一个也可以两两结合 运用举例 比如我们家里都会有的那个电热水器 有点热
  • PID控制算法(PID控制原理与程序流程)

    PID控制算法 PID控制原理与程序流程 暗影玄极 博客园 cnblogs com
  • 将手柄传递到管道中

    说我有 node foo js node bar js 有没有办法将 foo 的标准输入句柄传递给 bar js 我有一个罕见的情况 我想在管道中进行向后通信 至少我知道我可以发送node bar js的pidnode foo js 鉴于
  • C - 获取用popen打开的进程的PID

    我有一个用 C 编写的程序 它使用 popen 打开另一个程序 我想获取该程序的 pid 或某种处理程序 以便在一定时间限制后 或者在它超出某些 ram 和 stdout 限制时杀死它 我认为这必须用ptrace来完成 它需要PID 但我不
  • 以编程方式获取另一个进程的父进程pid?

    我尝试谷歌 但发现getppid 它获取的父pidcurrent过程 我需要类似的东西getppid some other pid 有这样的事吗 基本上获取某个进程的 pid 并返回父进程的 pid 我认为最简单的事情是打开 proc 并解
  • 如何迭代 PCB 以显示 Linux 内核模块中的信息?

    我想编写一个 Linux 内核模块 它可以显示所有正在运行的进程的 PID 我有以下代码 procInfo c My Kernel Module for process info include
  • 子进程和父进程ID

    只是与子进程块中的父 pid 值混淆了 我的程序如下 int main int argc char argv pid t pid pid fork if pid 1 perror fork failure exit EXIT FAILURE
  • 使用批处理查找java PID

    我需要从 Windows 批处理控制台知道 java 进程 PID echo off set p CD FOR F tokens 1 A IN JAVA HOME bin jps exe v find p DO SET str A echo
  • os.kill 没有引发 OSError,但是我没有看到给定的 pid 正在运行

    在我的 ubuntu 服务器上运行以下命令 python c import os os kill 5555 0 这样做是为了查看 pid 5555 是否正在运行 根据我的理解 如果 pid 没有运行 这应该会引发 OSError 这不会对我
  • 检查给定 pid 的进程是否存在

    给定 Linux 进程的 pid 我想从 C 程序检查该进程是否仍在运行 Issue a kill 2 http linux die net man 2 kill系统调用0作为信号 如果调用成功 则说明存在该pid的进程 如果呼叫失败并且e
  • 确定监听某个端口的进程pid

    正如标题所示 我正在运行多个游戏服务器 并且每个服务器都有相同的name但不同PID和port数字 我想匹配PID正在监听某个端口的服务器 然后我想终止这个进程 我需要它来完成我的 bash 脚本 这可能吗 因为在网上还没有找到解决方案 您
  • fork()返回0,但是子进程getpid()!=0。为什么?

    这是测试 fork 系统调用的 C 代码 include
  • 如何查看linux中特定进程每5秒的内存消耗情况

    我只是想知道如何找到特定进程在特定时间 比如5秒 的内存消耗 我是linux新手 因此 详细的步骤将不胜感激 Use top p PID其中 PID 是进程 ID 应显示有关进程的信息 包括使用的系统内存百分比 类型d以及一个以秒为单位的整
  • 多处理时如何获取每个进程ID

    我有一些问题 因为我是 Python 和 Pyside 的新手 我有N个进程同时运行 由于这些进程需要一些时间才能完成其工作 因此最终用户可能想要取消特定进程 因此 我需要一种方法来了解进程的 ID 以便将此功能添加到程序中 有一个answ

随机推荐

  • mavros常用消息类型表

    mavros订阅消息 xff1a global position 订阅GPS数据 消息名称 xff1a mavros global position global 类型名称 xff1a sensor msgs NavSatFix h 类型所
  • Solidworks踩坑随笔

    Solidworks无法打开问题终极解决办法 网上流传的solidworks无法打开的解决办法有如下几种 xff1a 使用solidworks安装包自带的修复工具修复 缺点 xff1a 耗费时间长 xff0c 而且不一定能找到原来下载的安装
  • 大疆A3、N3、M100飞控ONBOARDSDK二次开发经验分享

    开发流程 步骤一 选择开发方式 先去大疆的开发者网站 xff08 https developer dji com xff09 看资料 xff0c 我选择的是ONBOARD SDK stm32 xff08 图一 xff09 步骤二 观看官方资
  • Boost库教程

    Boost库教程 1 Lexical Cast 用于高效文本格式转化 using boost lexical cast 例 xff1a 将A转换为string类型 lexical cast A 错误消息使用try catch 捕捉 异常名为
  • 软路由连接NAS做链路聚合

    软路由连接NAS做链路聚合 群晖NAS支持多种链路聚合方式 xff0c 如自适应负载平衡 IEEE 802 3ad动态Link Aggregation 平衡XOR等方式 xff0c 其中 xff0c IEEE 802 3ad动态Link A
  • 软路由网络部署配置

    软路由网络部署配置 一 作为交换机二 作为一级路由器三 作为旁路由模式一 xff1a 主路由开 DHPC 43 N1 关 DHPC 非全局 xff09 设置步骤 模式二 xff1a 主路由开 DHPC 43 N1 关DHPC 全局 方法一方
  • PX4 vision_to_mavros定位

    PX4官方给出以下做法从而使用intel realsense t265深度相机作为视觉估计的硬件选择 在这里我使用pixhawk 4和realsense t265以及Jetson TX2机载计算机以及benewake tfmini激光测高模
  • Top 50 有趣网站

    50 经典桌面 这个名叫东子的偏执狂不知花了多少 工夫 xff0c mydeskcity com的谌萘看锏 了40G xff0c 很多图片都是站长本人在国 外搜集后 xff0c 自己进行加工的作品 http www mydeskcity c
  • PX4避障和轨迹规划(3DVFH*)

    采用伴侣计算机 Companion Computer 的方案 xff0c 通过使用mavros的obstacle distance插件订阅 mavros obstacle send话题 xff0c 进而通过local planner本地轨迹
  • PX4飞控控制投放装置

    PX4飞控控制投放装置原理跟相机触发方式一样 xff0c 都是通过映射辅助AUX通道实现对应的信号发送 相机触发方法参考如下链接 xff1a Camera Trigger PX4 User Guide 触发方法有很多种 xff0c 这里我们
  • PX4板载计算机外部控制

    板载计算机外部控制主要是使用第三方机载计算机 xff08 如 xff1a Intel Aero Jetson TX2 Jetson Nano 其他类型minipc xff09 等通过mavlink协议实现对飞控参数的获取和机载端控制 xff
  • PX4无人机配置4G空地多机组网系统

    前言 使用4G网络实现无人机地面端与天空端实时通信 xff0c 并基于蒲公英cloudVPN组网技术实现广域网内的异地组网 xff0c 进一步实现不限制距离的空地多机远程组网系统 cloudVPN组网无需公网IP xff0c 需要注册一个花
  • OpenWRT配置Zerotier实现内网映射

    OpenWRT加入zerotier xff1a zerotier使用教程 OPENWRT LEDE 配置ZeroTier网络教程 子绘绘的博客 CSDN博客 Openwrt路由通过Zerotier组网实现异地内网互访 Linux加入zero
  • PX4云台控制

    一 云台硬件配置 云台采用storm32bgc无刷三轴云台 xff0c 该云台支持通过飞控控制与WBUS多通道接收机控制 这里我们采用通过pixhawk4飞控进行控制 pwm控制模式 采用三条3pin杜邦线将飞控辅助通道AUX1 3连接至云
  • 行人和人脸识别数据集

    推荐一个可应用于无人车 无人机 监控识别相关的数据集 行人和人脸检测数据集 xff08 FEEMS xff09 xff1a GitHub neverland7D Face and Pedestrian Detection Dataset F
  • Acuro二维码识别与降落对准

    什么是Aruco码 xff1f Aruco码能做什么 xff1f 搜索任务 自主降落等辅助标识 替代复杂任务中较难识别的目标 xff08 短期替代 长期替代 xff09 SLAM中的地标 反解无人机位置 实现定点 最容易识别的目标之一 1
  • ADRC控制算法在多旋翼飞行器上的应用

    基础理论知识 xff1a 程序中涉及的部分知识点参考如下链接 xff1a ADRC算法以及参数整定 xff1a 关于ADRC算法以及参数整定 xff08 调参 xff09 的一些心得体会 西涯先生的博客 CSDN博客 adrc控制算法 AD
  • 补充总结:现代控制理论

    补充内容 xff1a 现代控制理论与经典控制理论的区别 xff1a 经典控制理论主要是借助于传递函数研究系统输出与输入的关系 xff0c 而不管系统到底内部结构如何 xff0c 好比一个未知的 黑匣子 现代控制理论相对而言是要研究系统内部的
  • 网上英语学习资源大整理

    翻译 http www bilinguist com 汉英论坛 xff0c 高手云集 url http www chinatranslate net url 中国翻译网 xff0c 号称全国最大的翻译专业网站 url http gb tra
  • 使用PID和LQR控制器进行多旋翼飞行器控制

    任务内容 通过调整PID和LQR控制器以实现稳定悬停的多旋翼飞行器 xff0c 运用在无论是在仿真中还是在实际系统中 参考内容 LQR控制部分基础参考内容 xff1a LQR控制器 参考链接 xff1a Linear Quadratic R