📄 threeservos_init.m
字号:
function threeservos_init% Task scheduling and control.%% This example extends the simple PID control example (located in% $DIR/examples/simple_pid) to the case of three PID-tasks running% concurrently on the same CPU controlling three different servo% systems. The effect of the scheduling policy on the global control% performance is demonstrated.% Initialize TrueTime kernelttInitKernel(6, 3, 'prioRM'); % nbrOfInputs, nbrOfOutputs, rate-monotonic% Task parametersperiods = [0.006 0.005 0.004];names = {'pid_task1', 'pid_task2', 'pid_task3'};rChans = [1 3 5];yChans = [2 4 6];uChans = [1 2 3];% Create the three tasksfor i = 1:3 data.K = 0.96; data.Ti = 0.12; data.Td = 0.049; data.N = 10; data.h = periods(i); data.u = 0; data.Iold = 0; data.Dold = 0; data.yold = 0; data.rChan = rChans(i); data.yChan = yChans(i); data.uChan = uChans(i); % Offset=0 and prio=1 for all tasks ttCreatePeriodicTask(names{i}, 0, periods(i), 1, 'pidcode', data);end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -