Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Run example1 or example 2 code, getting error in vec_cross #1

Open
vbalaji21 opened this issue May 26, 2023 · 6 comments
Open

Comments

@vbalaji21
Copy link

This is the error log -

Undefined function or variable 'vec_cross'

I am using Matlab 2019a as stated in Readme.
I have also attached a picture of the error.
Please check it and let me know, I am looking forward to hearing from you.

error

@vkotaru
Copy link
Contributor

vkotaru commented May 26, 2023

Download and add https://github.com/HybridRobotics/geometric-toolbox to your path.
You can also replace it with cross the Matlab's cross

@vkotaru vkotaru closed this as completed May 26, 2023
@vbalaji21
Copy link
Author

Thanks a lot for your quick reply @vkotaru . I changed it to cross meanwhile and I added the geometric-toolbox to remove other such errors related to toolbox. I am able to move few steps further but it started giving me error stated below

Undefined function or variable 'afh_dynamics_mex'

Am I missing few other toolboxes to run the examples, Please let me know.
I have attached the screenshot of the error.

error_2

@vkotaru
Copy link
Contributor

vkotaru commented May 26, 2023

You are trying to use themex files. You need to first generate the mex files to use them. In the meantime I would recommend setting the dynamics to default, params.dynamics = 'default';

@vbalaji21
Copy link
Author

Thanks @vkotaru I made the change and generated mex by running the script matlab/utils/func_generators/generateMexFiles.m as suggested in Readme description. I am able to run all the examples except 2 examples - Example2 and sim2_TRAJ_nQ2.

I am getting this error for both of them - Undefined function or variable 'getNormDerivatives14_mex'

Am I generating the mex properly or Should I change some parameters for mex file generation for this ?

I have attached the error picture for reference

error3

@vkotaru
Copy link
Contributor

vkotaru commented May 27, 2023

As the name suggests its the mexed function for getNormDerivatives14.m, either replace getNormDerivatives14_mex with getNormDerivatives14 (i.e. don't use the mexed function), or generate the mex function for getNormDerivatives14.m

@vbalaji21
Copy link
Author

@vkotaru Thanks for the reply. I stopped using mex function by replacing - params.dynamics = 'default'.
I got an error in LQR control when running example 2. The error was on control input block of control_lqr.m
It showed a vector size mismatch, I printed and checked the sizes.

I have attached a picture and also print logs for it. Please let me know how to run examples normally, I am not sure whether I need to do some other steps to run it.

Picture -

error_4

Print log -

Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for
that dimension.

Error in control_lqr (line 27)
P = reshape(Pvec, m, m);

Error in example2>@(t,x)control_lqr(mdl,t,x) (line 109)
mdl.controller = @(t,x) control_lqr(mdl, t, x);

Error in DynamicalSystem/system_dynamics (line 101)
u = obj.calcCtrlInput(t,x);

Error in DynamicalSystem>@(t,x)system_dynamics(obj,t,x) (line 57)
odefun = @(t,x)system_dynamics(obj, t, x);

Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ode15s (line 152)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

Error in DynamicalSystem/simulate (line 62)
sol = solver(odefun, tspan, x0,options);

Error in example2 (line 117)
sol = mdl.simulate([t0, simtf], xInit, @ode15s);

@vkotaru vkotaru reopened this Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants