首页 > 其他分享 >ECPS 208 Control Systems控制系统

ECPS 208 Control Systems控制系统

时间:2023-05-20 14:36:48浏览次数:39  
标签:Control ... noise 208 ECPS controller traj state trajhandle


ECPS 208: Control Systems for Cyber Physical Systems
Homework Assignment Number 4
Higher Dimensional Quadcopter - Trajectory Control
Spring 2023
Consider the case of a 2D quadcopter. We would like to control the quadcopter for a variety of
2D trajectories (in the y-z directions): straight line trajectory, sine wave trajectory, step trajectory.
The files for this section are contained in the folder: “hw4 2d.zip”.
Figure 1: 2D Quadcopter Model.
1 Derivations
Our 2D quadcopter is depicted in Figure 1. The global, or inertia frame, is shown as {a2, a3} and
the body frame of the quadcopter is depicted as {b2, b3}. In the 2D motion, the roll angle ϕ is
shown and blue, and we can model the rotation matrix between the {A} and {B} frames as:
ARB =

cos(ϕ) − sin(ϕ)
sin(ϕ) − cos(ϕ)

(1)
The angular velocity is modeled as:
AωB = ϕ˙ (2)
We will make some simplifying assumptions in our model of the inputs. We assume only two
motors that can each apply a thrust F1, F2, located a distance L away from the quadcopters center
of mass. Our quadcopter has two inputs, u1 (thrust) and u2 (moment):
u1 = F1 + F2 (3)
u2 = L(F1 − F2) (4)
1
The state space of our system is defined by three states: y, z, and ϕ. The equations of motion
for the state variables can be derived as:
my¨ = −u1 sin(ϕ) (5)
mz¨ = −mg + u1 cos(ϕ) (6)
Ixxϕ¨ = u2 (7)
where Ixx is the moment of inertia about the x axis.
1.1 Linearization
Linearize the above state space equations about a hovering equilibrium. Assume as this hover that
ϕ = 0 and the thrust force balances out the gravity.
2 PD Control
We will design a PD controller and derive the equations for our inputs in the controller function.
As we have three states y, z, and ϕ, we will need a set of gains (Kp, Kd) for each state. We form
the following three differential equations that aim to converge the error of each state to zero:
(¨ydes − y¨) + Kpy(ydes − y) + Kdy( ˙ydes − y˙) = 0 (8)
(¨zdes − z¨) + Kpz(zdes − z) + Kdz( ˙zdes − z˙) = 0 (9)
(ϕ¨
des − ϕ¨) + Kpphi(ϕdes − ϕ) + Kdphi(ϕ˙
des − ϕ˙) = 0 (10)
The inputs u1 and u2 are derived as follows:
u1 = m(g + ¨z + Kpz(zdes − z) + Kdz( ˙zdes − z˙)) (11)
u2 = Ixx(ϕ¨ + Kpphi(ϕdes − ϕ) + Kdphi(ϕ˙
des − ϕ˙)) (12)
ϕ = −(¨ydes + Kpy(ydes − y) + Kdy( ˙ydes − y˙))/g (13)
ϕ˙ = (KpyKdy(ydes − y) + (K2
dy − Kpy) ∗ ( ˙ydes − y˙))/g (14)
2.1 PD Controller
Update the file “pd controller 2d.m” following the above equations. Set the controller gains to any
values you feel appropriate as代写ECPS 208 they will be tuned further in the following sections.
function [ u1, u2 ] = pd_controller_2d(~, state, des_state, params)
%CONTROLLER Controller for the planar quadrotor
%
% state: The current state of the robot with the following fields:
% state.pos = [y; z], state.vel = [y_dot; z_dot], state.rot = [phi],
% state.omega = [phi_dot]
%
% des_state: The desired states are:
2
% des_state.pos = [y; z], des_state.vel = [y_dot; z_dot], des_state.acc =
% [y_ddot; z_ddot]
%
% params: robot parameters
% Using these current and desired states, you have to compute the desired
% controls
kdy = ...;
kpy = ...;
kdz = ...;
kpz = ...;
kdphi = ...;
kpphi = ...;
phic = ...;
phic_dot = ...;
u1=...;
u2 = ...;
end
2.2 Trajectory Control
Use the following script “runsim.m” and tune your controller gains to have the quadcopter reach
its goal for each type of trajectory: (a) Straight Line Trajectory, (b) Sine Wave Trajectory, (c) Step
Trajectory. Bonus: feel free to try the Diamond Trajectory as well.
clear;
close all;
addpath(’utils’);
addpath(’trajectories’);
controlhandle = @pd_controller_2d;
% Choose which trajectory you want to test with:
% @traj_line, @traj_sine, @traj_step , @traj_diamond
trajhandle = @traj_line;
%trajhandle = @traj_sine;
%trajhandle = @traj_step;
%trajhandle = @traj_diamond;
[t, state] = simulation_2d(controlhandle, trajhandle);
3
3 Controller Robustness
In this section, we investigate the robustness of controller design with regards to uncertainties in
both modeling and sensing. Recall the general form of a closed loop control system in Figure 2.
Figure 2: General form of a closed loop control system.
3.1 Plant Disturbances
In our system, an example of a plant disturbance is an incorrect or incomplete model of the forces
acting on the quadcopter (thrust, air resistance, friction, etc.) or on the model parameters we have
measured about the quadcopter (e.g., mass, length).
Our noise model will simply add a wind disturbance to the y and z directions following:
y¨ = −u1 sin(ϕ)/m + λddy (15)
z¨ = −g + u1 cos(ϕ)/m + λddz (16)
where dy and dz are the added noise values due to random wind: d ∼ N (µ, σ2
) with µ = 0 and
σ = 1; and λd is our tunable scaling of disturbance noise.
Run the following script “runsim plant disturbances.m” with varying levels of noise (λd =
1, 2, 5, 10, 20) and trajectories (line, sine, step) and comment on the results.
clear;
close all;
addpath(’utils’);
addpath(’trajectories’);
controlhandle = @pd_controller_2d;
% Choose which trajectory you want to test with:
4
% @traj_line, @traj_sine, @traj_step , @traj_diamond
%trajhandle = @traj_line;
%trajhandle = @traj_sine;
trajhandle = @traj_step;
%trajhandle = @traj_diamond;
%Define the level of plant noise: lambda_d
%Our noise will be modeled as wind which affects y’’ and z’’.
noise_level = ...; %1, 2, 5, 10, 20
[t, state] = simulation_2d_plant_disturbance(controlhandle, trajhandle, noise_level);
3.2 Sensor Measurement Noise
Noise in sensor measurements is very common, and one benefit of control is accounting for variabilities in sensing noise. In our closed-loop controller, we assume access to a sensor that measures
the position and the velocity of the quadcopter in the direction. We will now study what happens
when the sensing in the system is not perfect. We introduce noise into the y and z position sensors
as follows:
ymeas = y + λnny (17)
zmeas = z + λnnz (18)
where ymeas and zmeas are the sensor measurements the controller has access to; ny and nz are
the added noise values due to sensing error: n ∼ N (µ, σ2
) with µ = 0 and σ = 1; and λn is our
tunable scaling of the sensor noise level.
Run the following script “runsim sensor noise.m” with varying levels of noise (λn = 0.01, .05, 0.1, 0.5)
and trajectories (line, sine, step) and comment on the results.
clear;
close all;
addpath(’utils’);
addpath(’trajectories’);
controlhandle = @pd_controller_2d;
% Choose which trajectory you want to test with:
% @traj_line, @traj_sine, @traj_step , @traj_diamond
%trajhandle = @traj_line;
%trajhandle = @traj_sine;
trajhandle = @traj_step;
%trajhandle = @traj_diamond;
%Define the level of sensor noise: lambda_n
%Our noise will be modeled as wind which affects y’’ and z’’.
noise_level = ...; % 0.01, .05, 0.1, 0.5
5
[t, state] = simulation_2d_sensor_noise(controlhandle, trajhandle, noise_level);
4 Bonus: 3D Trajectory Control
There are no graded questions within this section. We encourage you to explore the code at your
own interest. The files for this section are contained in the folder: “hw4 3d.zip”. Make sure to
remove the utils folder from your path to avoid errors if you have recently run the code for the 2D
case.
Consider the case of a 3D quadcopter. The code for the dynamics and controller has been
provided for you in the files within these folders. We would like to control the quadcopter for a
variety of 3D trajectories (in the x-y-z directions): Line, Helix, Waypoint. Feel free to experiment
with the code at your own interest. The waypoint trajectory is easily definable to measure your
own custom trajectory path.

 WX:codehelp

标签:Control,...,noise,208,ECPS,controller,traj,state,trajhandle
From: https://www.cnblogs.com/messagejava/p/17417163.html

相关文章

  • flutter系列之:使用AnimationController来控制动画效果
    目录简介构建一个要动画的widget让图像动起来总结简介之前我们提到了flutter提供了比较简单好用的AnimatedContainer和SlideTransition来进行一些简单的动画效果,但是要完全实现自定义的复杂的动画效果,还是要使用AnimationController。今天我们来尝试使用AnimationController来实现......
  • ARM DMA Controller PL330 使用经验分享
    总体简介DMAC提供一个AXI主接口来执行DMA传输,并提供两个APB从接口来控制其操作。DMAC采用TrustZone技术,其中一个APB接口运行在secure状态,另一个运行在非secure状态。secure策略是ARM的TrustZone技术一部分。整个DMA操作受一个小的指令集控制,这是与传统链表BD模式的不同之处。......
  • Stable Diffusion 的 ControlNet 扩展
    本文介绍如何安装ControlNet扩展?和ControlNet的模型安装,同时给了两个例子。一、ControlNet扩展安装进入StableDiffusion界面,点击扩展标签,选择从URL安装,然后输入ControlNet网址(https://github.com/Mikubill/sd-webui-controlnet),粘贴到对应的地方,然后点击安装。完成......
  • P1344 [USACO4.4] 追查坏牛奶 Pollutant Control (网络流)
    P1344[USACO4.4]追查坏牛奶PollutantControl(网络流)题目链接目录P1344[USACO4.4]追查坏牛奶PollutantControl(网络流)题目描述输入格式输出格式样例#1样例输入#1样例输出#1提示题目大意思路分析code双倍经验思路code后记不会网络流的可以看这个题目描述你第一天接......
  • How to use micro:bit V2 to control built-in sensors All In One
    Howtousemicro:bitV2tocontrolbuilt-insensorsAllInOnemicro:bitV2&PythonMakeCodeMakeCodeformicro:bithttps://makecode.microbit.org/https://www.microsoft.com/zh-cn/makecodeAdafruitCircuitPlaygroundExpresshttps://makecode.a......
  • Jmeter部署到Linux实现分发压测时,controller机器回收测试报告时卡死
    问题检查与定位:检查slave-A和slave-B两台执行机,执行机已经finished,无报错,说明执行机已完成测试任务采集到的日志批量分析后得出的结论:在完成并发测试后,vuser要进行释放,由于没有完全释放导致controller机器一直等待(像卡死),而实际上是等待,问题定位后,进行检查发现:问题1: reportge......
  • AMD Xilinx AXI Interrupt Controller 中断优先级
    中断优先级AXIInterruptController支持中断优先级。在VivadoBlockDesign中,bit-0连接的中断优先级最高,越靠近bit-0的中断优先级最高。AXIInterruptController的手册pg099中的描述如下:Prioritybetweeninterruptrequestsisdeterminedbyvectorposition.Theleas......
  • flutter系列之:使用AnimationController来控制动画效果
    目录简介构建一个要动画的widget让图像动起来总结简介之前我们提到了flutter提供了比较简单好用的AnimatedContainer和SlideTransition来进行一些简单的动画效果,但是要完全实现自定义的复杂的动画效果,还是要使用AnimationController。今天我们来尝试使用AnimationController来......
  • How to use the Raspberry Pi and Python to control a DHT11 wet and temperate modu
    HowtousetheRaspberryPiandPythontocontrolaDHT11wetandtemperatemoduleAllInOne如何使用树莓派和Python来控制温湿度模块demos(......
  • 问题记录之mysql:Job for mysqld.service failed because the control process exited
    今天服务器连接mysql发现一直超时(查出的原因是磁盘满了)清了磁盘以后,mysqld.service 还是无法启动执行命令及报错如下:(注意,因为磁盘满的问题,我的mysql并不是正常途径关闭的)控制进程以错误代码退出导致无法以正常的方式启动它了,错误说明:Jobformysqld.servicefailedbecauset......