Funny error when using parameters of the drone in the assignement
2 views (last 30 days)
Show older comments
I am able to stabilize with a drone through a GUI that requires me to create a controller on Matlab but I have some huge difficulties to make it take off because of a funny error:
Subscript indices must either be real positive integers or logicals.
a MatLab error I don't understand... Has des actually to become an integer? I don't think so ;)
I have tried to create the following equation to deal with the test:
I am okay with the fact that I don't get the first member of the equation right now. But I would be glad if you had any idea how to find it.
My main issue is that even without having this first member I have the error I mentioned above, can you help me debug it?
function [ u ] = pd_controller(~, s, s_des, params)
%PD_CONTROLLER PD controller for the height
%
% s: 2x1 vector containing the current state [z; v_z]
% s_des: 2x1 vector containing desired state [z; v_z]
% params: robot parameters
u = 0;
K = [10 5];
% z(t) = dsolve(diff(z,t) == t*z)
% FILL IN YOUR CODE HERE
u= params.mass(K*s-K*s_des+params.gravity);
%u = params.mass*(params.gravity);
end
The error log is:
>> runsim
Initializing figures...
Simulation Running....
Subscript indices must either be real positive integers or logicals.
Error in controller (line 17)
u= params.mass(K*s-K*s_des+params.gravity);
Error in sys_eom (line 5)
u_des = controlhandle(t, s, s_des, params);
Error in height_control>@(t,s)sys_eom(t,s,controlhandle,trajhandle,params)
Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in height_control (line 80)
[tsave, xsave] = ode45(@(t,s) sys_eom(t, s, controlhandle, trajhandle, params), timeint, x);
Error in runsim (line 17)
[t, z] = height_control(trajhandle, controlhandle);
0 Comments
Answers (1)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!