-
Notifications
You must be signed in to change notification settings - Fork 0
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
Evaluate state (Kin) quantities exploiting CasADi code-generation #10
Conversation
I compared 4s of a kinematic simulation of an 8x8 mesh W/O codegen. If we increase the length of the simulation 10s the gap increase even more This PR could be beneficial also for #2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting! so the mex file is generated every time you run a new simulation and then deleted at the end? Do you think it may be convenient to keep also the generated mex files somewhere or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments for curiosity ;)
It looks fine to me btw!
C.add(obj.csdFn.rC_from_mBodyTwist0_2_jointsAngVelPJ); | ||
C.add(obj.csdFn.get_mBodyVelQuat0_from_mBodyTwist0) | ||
C.generate(); | ||
mex mystica_stateKin.c -largeArrayDims |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For curiosity :)
Once the function mystica_stateKin
is generated, does it live in the workspace and be called in every part of the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is it computationally expensive to generate it?
I might understand why you don't check if the function already exists.
To check if the content of the function changed, you have to generate it again :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generate the MEX files in the current folder. So, until you do not change the current directory, they can be called everywhere
@@ -59,6 +59,7 @@ | |||
%% Saving Workspace | |||
|
|||
clear ans k kVec motorsCurrent mBodyPosQuat_0 tout dataLiveStatistics | |||
mystica.utils.deleteGeneratedMEX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it also work without parenthesis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In matlab yes :)
C.add(obj.csdFn.rC_from_mBodyTwist0_2_jointsAngVelPJ); | ||
C.add(obj.csdFn.get_mBodyVelQuat0_from_mBodyTwist0) | ||
C.generate(); | ||
mex mystica_stateKin.c -largeArrayDims |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is it computationally expensive to generate it?
I might understand why you don't check if the function already exists.
To check if the content of the function changed, you have to generate it again :D
Exactly!
The generated MEX files are model dependent. If I want to keep them I have to add a check to verify that the model is not changed. |
Thanks @gabrielenava and @Giulero |
If you are using |
This PR decreases the computational time for evaluating jacobian, ...