-
Notifications
You must be signed in to change notification settings - Fork 45
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
Printing matrices in casadi #288
Comments
Hi there! That said, you can evaluate the graph. You must, however, first convert the graph (the MX) to a import biorbd_casadi as casadi
from casadi import MX
import numpy as np
# Get a model
model = biorbd.Model("pendulum.bioMod")
# Create a symbolic variable of dimension (nq x 1) that will be used to create the graph
q_symbolic = MX.sym("q", model.nbQ(), 1)
# Create the casadi function
com_func = biorbd.to_casadi_func('com', model.CoM, q_symbolic) # Alternatively you can create yourself the function using casadi.Function
# Evaluate the graph with actual data
q = np.random.rand(model.nbQ()) # This can also be casadi.DM
com = com_func(q) # This a DM, but can be converted to array using "com = np.array(com)"
print(com) Hope this helps! |
Interesting, thanks a lot! |
Hi!
I was wondering why it is not possible to print vectors/matrices when working with a casadi model using
.to_array()
. Is there another option to do that?A minimal example:
The text was updated successfully, but these errors were encountered: