Git Product home page Git Product logo

Comments (8)

AFusco99 avatar AFusco99 commented on August 22, 2024 1

Thank you I just tested both options and I was able to work with Mx variables

from adam.

DanielePucci avatar DanielePucci commented on August 22, 2024

CC @Giulero

from adam.

Giulero avatar Giulero commented on August 22, 2024

Hi @AFusco99! Can you provide a snippet of code on how you're using the library? Thanks!

from adam.

AFusco99 avatar AFusco99 commented on August 22, 2024

Yes, thanks

import casadi as cs
import numpy as np
model_path = "panda.urdf"
import adam
from adam.casadi import KinDynComputations

joints_name_list = [
           'panda_joint1', 'panda_joint2', 'panda_joint3', 'panda_joint4',
           'panda_joint5', 'panda_joint6', 'panda_joint7'
            ]
joint_angles=cs.MX.sym('q', 7)
root_link = 'panda_link0'
w_H_b = np.eye(4)
 kinDyn = KinDynComputations(model_path, joints_name_list, root_link)
frame="panda_hand"
Tmat=(kinDyn.forward_kinematics(frame,w_H_b,joint_angles))


This code is functional as long as joint_angles is defined as an SX symbolic variable however in my case I need to define it as an MX symbolic variable as I am using external functions and CasADI only supports MX variables in these cases.

from adam.

Giulero avatar Giulero commented on August 22, 2024

Got it! It shouldn't be possible to convert SX to MX and vice-versa (it seems open casadi/casadi#1870).

I created a branch with some modifications in order to let adam accept also MX types.

I opened this PR: #84. You might test changing the branch!

from adam.

Giulero avatar Giulero commented on August 22, 2024

Fyi: PR #84 merged

from adam.

Giulero avatar Giulero commented on August 22, 2024

Hi @AFusco99 ! I just noticed that you are using the forward_kinematics function.

I guess also that you could use the function forward_kinematics_fun function. This function returns the casadi function directly, and it should be possible to use it with SX, MX and DM (and numpy).

Your snippet would become

import casadi as cs
import numpy as np
model_path = "panda.urdf"
import adam
from adam.casadi import KinDynComputations

joints_name_list = [
           'panda_joint1', 'panda_joint2', 'panda_joint3', 'panda_joint4',
           'panda_joint5', 'panda_joint6', 'panda_joint7'
            ]
joint_angles=cs.MX.sym('q', 7)
root_link = 'panda_link0'
w_H_b = np.eye(4)
 kinDyn = KinDynComputations(model_path, joints_name_list, root_link)
frame="panda_hand"
T_mat_fun = kinDyn.forward_kinematics_fun(frame)
Tmat=T_mat_fun(w_H_b,joint_angles)

from adam.

Giulero avatar Giulero commented on August 22, 2024

@AFusco99, please have a look at #89. Anyway, using the *fun version of the function, you should be able to use MX!

from adam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.