From 213ff9595094ffb5d90dfe1421cd003920a06a44 Mon Sep 17 00:00:00 2001 From: giulero Date: Mon, 10 Jun 2024 18:21:05 +0200 Subject: [PATCH] Refactor KinDynComputationsParametric constructor to accept cs_type parameter --- src/adam/parametric/casadi/computations_parametric.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/adam/parametric/casadi/computations_parametric.py b/src/adam/parametric/casadi/computations_parametric.py index 37459821..85f92dda 100644 --- a/src/adam/parametric/casadi/computations_parametric.py +++ b/src/adam/parametric/casadi/computations_parametric.py @@ -1,7 +1,7 @@ # Copyright (C) 2021 Istituto Italiano di Tecnologia (IIT). All rights reserved. # This software may be modified and distributed under the terms of the # GNU Lesser General Public License v2.1 or any later version. -from typing import List +from typing import List, Union import casadi as cs import numpy as np @@ -24,6 +24,7 @@ def __init__( joints_name_list: list, links_name_list: list, root_link: str = "root_link", + cs_type: Union[cs.SX, cs.DM] = cs.SX, gravity: np.array = np.array([0.0, 0.0, -9.80665, 0.0, 0.0, 0.0]), f_opts: dict = dict(jit=False, jit_options=dict(flags="-Ofast")), ) -> None: @@ -34,7 +35,7 @@ def __init__( links_name_list (list): list of the parametrized links root_link (str, optional): the first link. Defaults to 'root_link'. """ - math = SpatialMath() + math = SpatialMath(cs_type) n_param_links = len(links_name_list) self.densities = cs.SX.sym("densities", n_param_links) self.length_multiplier = cs.SX.sym("length_multiplier", n_param_links)