This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor's Statement of Intellectual Property Transfer | |
I certify that: | |
(a) I have read and understood the statement below on Ownership and Transfer of Intellectual Property; | |
(b) for any contribution I make to the CasADi project, I will make all reasonable efforts to determine the legal owners of the contribution, and I will obtain the permission of the owners of the contribution to make the contribution available under the terms of this agreement; | |
(c) if I am employed, I have discussed contributing to CasADi with my employer and have obtained their permission to transfer the intellectual property rights or have determined that they do not assert ownership rights to my contributions; | |
(d) I hereby transfer and assign all rights, title, and interest, including all intellectual property rights, in any contributions that I make to the CasADi project, to the CasADi copyright holders; | |
(e) I will not knowingly submit any contribution of which I am not the owner or for which I do not have the owner's permission, n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Load the matrices from files | |
actual = casadi.Sparsity.from_file('debug_fatrop_actual.mtx'); | |
A = casadi.Sparsity.from_file('debug_fatrop_A.mtx'); | |
B = casadi.Sparsity.from_file('debug_fatrop_B.mtx'); | |
C = casadi.Sparsity.from_file('debug_fatrop_C.mtx'); | |
D = casadi.Sparsity.from_file('debug_fatrop_D.mtx'); | |
I = casadi.Sparsity.from_file('debug_fatrop_I.mtx'); | |
errors = row(casadi.Sparsity.from_file('debug_fatrop_errors.mtx')); | |
% Create a new figure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casadi import * | |
# Example on how to use the DaeBuilder class | |
# Joel Andersson, UW Madison 2017 | |
# Start with an empty DaeBuilder instance | |
dae = DaeBuilder('rocket') | |
# Add input expressions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This file was automatically generated by CasADi 3.6.5+. | |
* It consists of: | |
* 1) content generated by CasADi runtime: not copyrighted | |
* 2) template code copied from CasADi source: permissively licensed (MIT-0) | |
* 3) user code: owned by the user | |
* | |
*/ | |
#ifdef __cplusplus | |
extern "C" { | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casadi import * | |
# Generate 3D data to fit | |
x = np.linspace(0,2,10) | |
y = np.linspace(2,4,10) | |
z = np.linspace(3,5,10) | |
[X,Y,Z] = np.meshgrid(x,y,z) | |
xyz_flat = np.vstack((X.ravel(),Y.ravel(),Z.ravel())).T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casadi import * | |
opti = Opti() | |
x = opti.variable(10) | |
y = opti.variable(10) | |
opti.subject_to(x>=0) | |
opti.subject_to(x+y==0) | |
opti.subject_to(y>=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = 10 # Limite memory size | |
x_latest = MX.sym("x_latest",nx) | |
g_latest = MX.sym("g_latest",nx) | |
x_prev = MX.sym("x_prev",nx) | |
g_prev = MX.sym("g_prev",nx) | |
s_latest = x_latest-x_prev | |
y_latest = g_latest-g_prev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import casadi as cs | |
import numpy as np | |
xp = [1, 2, 3] | |
fp = [3, 2, 0] | |
x = [2.5,1.1] | |
print(np.interp(x=x,xp=xp,fp=fp)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XYZ_ref = [ simOut.EndEffector_AbsPos{1}.Values.Data,simOut.EndEffector_AbsPos{2}.Values.Data,simOut.EndEffector_AbsPos{3}.Values.Data ]'; | |
Nsim = size(Gantry_out_D.Data,1); | |
XYZ = zeros(3,Nsim); | |
for k=1:Nsim | |
XYZ(:,k) = ForwardKinematicsFun(Gantry_out_D.Data(k,2),... | |
Axis1_Out_D.Data(k,2)/180*pi,... | |
Axis2_Out_D.Data(k,2)/180*pi,... | |
Axis3_Out_D.Data(k,2)/180*pi,... | |
Axis4_Out_D.Data(k,2)/180*pi,... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from casadi import * | |
x = MX.sym("x",30) | |
x0 = DM.rand(x.shape) | |
print("Reference approach") | |
# Repetitive | |
c = 0 |
NewerOlder