MATLAB Answers

why I am getting error while tuning using control system tuner

5 views (last 30 days)
While I am trying to select signals for quick loop tuning, I am getting on this error repeatedly. I don't fully understand how can t can be negative during simulatiion and error raised by the above image. Can anyone please explain
Shravista Kashyap
Shravista Kashyap on 20 Aug 2020
After opening the control system tuner app, I have selected the gain blocks to tune and then I have selected the the actuator signals to motor as input, then after compiling I start getting this error. The simulink diagram can be seen at below links
The actual input the control block shown in the diagram( see the above link) is from a matlab function block called minJerkTraj. The code is as shown below. Also I have used the blocks Matlab System blocks and simscape models imported using robotics toolbox.
function [Acc,X,Vel] = minJerkTraj(boundary_cond,t)
% boundary_ cond is nX6 array of pos and euler angles
% boundary_cond = [x,y,z,alpha,beta,gamma]
% t is time inputs provided by simulink clock block
% it calculates the minimum jerk trajectory for given boundar conditions without any
% restrictions on velocity at waypoints except for maintaining the continuity at waypoints
% Acc = Accelaration 6X1 vector (Acc = [angular_accelaration; accelaration])
% X = trajectory points(6X1 (X = [euler angles;pos])
% Vel = Velocity 6X1 vector 6X1 (Vel = [omega;velocity])
D = @(t) [1, t, t^2, t^3, t^4, t^5
0, 1, 2*t, 3*t^2, 4*t^3, 5*t^4
0, 0, 2, 6*t, 12*t^2, 20*t^3
0, 0, 0, 6, 24*t, 60*t^2];
T = timeVariation(boundary_cond); % fuction that calculates the time vector nX1
eulAng_b = boundary_cond(:,4:6);
quat_b = quaternion(eulAng_b,'euler','ZYZ','frame');
logi = zeros(length(T),1); % logical index stating for in which ranges of time it comes the waypoints come in i.e.[T(i),T(i+1)]
for i = 1:length(T)
logi(i) = t<=T(i);
if sum(logi) == length(T)
j1 = 1;
j1 = length(T)-sum(logi);
[quat,omega,alpha] = rottraj(quat_b(j1),quat_b(j1+1),T(j1:j1+1),t);
eulerAng = euler(quat,'ZYZ','frame');
boundary_cond = boundary_cond(:,1:3);
% this function generates the coefficients required to calculate the fifth degree polynomial in time
C = trajGen(boundary_cond,T);
% no of time range possibel i.e. if size of T is 4 then [T1,T2],[T2,T3],[T3,T4]
m1 = size(boundary_cond,1)-1;
% calculates the index to fetch the coefficients from the matrix C
cIndex = 1:m1;
ci = cIndex(m1-sum(t<=T(2:end))+1);
temp = D(t)*C(6*ci-5:6*ci,:);
X = [eulerAng(:);temp(1,:)'];
Vel = [omega(:);temp(2,:)'];
Acc = [alpha(:);temp(3,:)'];

Sign in to comment.

Accepted Answer

Arkadiy Turevskiy
Arkadiy Turevskiy on 7 Oct 2020
We won't be able to provide a better answer without access to your model and a function. Can you please contact tech support?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!