Skip to content

Commit

Permalink
fix typos and copy paste leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlottaSartore committed Dec 5, 2023
1 parent bb5a963 commit ab08cf9
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/adam/casadi/casadi_like.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ def horzcat(*x) -> "CasadiLike":
Returns:
CasadiLike: horizontal concatenation of elements
"""
# here the logic is a bit convoluted: x is a tuple containing CasadiLike
# cs.vertcat accepts *args. A list of cs types is created extracting the value
# from the CasadiLike stored in the tuple x.
# Then the list is unpacked with the * operator.

y = [xi.array if isinstance(xi, CasadiLike) else xi for xi in x]
return CasadiLike(cs.horzcat(*y))

Expand Down
2 changes: 1 addition & 1 deletion src/adam/core/spatial_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def spatial_inertia(
IO[:3, :3] = self.factory.eye(3) * mass
return IO

def spatial_inertial_with_parameter(self, I, mass, c, rpy):
def spatial_inertial_with_parameters(self, I, mass, c, rpy):
"""
Args:
I (npt.ArrayLike): inertia values parametric
Expand Down
6 changes: 3 additions & 3 deletions src/adam/parametric/casadi/computations_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def __init__(
root_link (str, optional): the first link. Defaults to 'root_link'.
"""
math = SpatialMath()
n_param_link = len(links_name_list)
self.densities = cs.SX.sym("densities", n_param_link)
self.length_multiplier = cs.SX.sym("length_multiplier", n_param_link)
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)
factory = URDFParametricModelFactory(
path=urdfstring,
math=math,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def compute_volume(self):
elif self.geometry_type == Geometry.SPHERE:
visual_data_new = 0.0
visual_data_new = self.visual_data.radius * self.length_multiplier
volume = 4 * math.pi * visual_data_new ** 3 / 3
volume = 4 * math.pi * visual_data_new**3 / 3
return volume, visual_data_new

"""Function that computes the mass starting from the densities, the length multiplier and the link"""
Expand Down Expand Up @@ -256,7 +256,7 @@ def compute_inertia_parametric(self):
I.izz = I.iyy
return I
elif self.geometry_type == Geometry.SPHERE:
I.ixx = 2 * self.mass * self.visual_data_new ** 2 / 5
I.ixx = 2 * self.mass * self.visual_data_new**2 / 5
I.iyy = I.ixx
I.izz = I.ixx
return I
Expand All @@ -276,7 +276,7 @@ def spatial_inertia(self) -> npt.ArrayLike:
o[1] = self.origin[1]
o[2] = self.origin[2]
rpy = self.origin[3:]
return self.math.spatial_inertial_with_parameter(I, mass, o, rpy)
return self.math.spatial_inertial_with_parameters(I, mass, o, rpy)

def homogeneous(self) -> npt.ArrayLike:
"""
Expand Down
1 change: 0 additions & 1 deletion src/adam/parametric/numpy/computations_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ def jacobian_dot(
length_multiplier: np.ndarray,
densities: np.ndarray,
) -> np.ndarray:

"""Returns the Jacobian derivative relative to the specified frame
Args:
Expand Down
4 changes: 3 additions & 1 deletion tests/parametric/test_CasADi_computations_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
model_path, joints_name_list, link_name_list, root_link
)

original_density = [628.0724496264945]
original_density = [
628.0724496264945
] # This is the original density value associated to the chest link, computed as mass/volume
original_length = np.ones(len(link_name_list))


Expand Down
4 changes: 3 additions & 1 deletion tests/parametric/test_Jax_computations_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def SX2DM(x):
model_path, joints_name_list, link_name_list, root_link
)

original_density = [628.0724496264945]
original_density = [
628.0724496264945
] # This is the original density value associated to the chest link, computed as mass/volume
original_length = np.ones(len(link_name_list))

n_dofs = len(joints_name_list)
Expand Down
4 changes: 3 additions & 1 deletion tests/parametric/test_NumPy_computations_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def SX2DM(x):
# comp.set_frame_velocity_representation(Representations.BODY_FIXED_REPRESENTATION)
# comp_w_hardware.set_frame_velocity_representation(Representations.BODY_FIXED_REPRESENTATION)

original_density = [628.0724496264945]
original_density = [
628.0724496264945
] # This is the original density value associated to the chest link, computed as mass/volume
original_length = np.ones(len(link_name_list))

n_dofs = len(joints_name_list)
Expand Down
4 changes: 3 additions & 1 deletion tests/parametric/test_pytorch_computations_parametric.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def SX2DM(x):
# comp.set_frame_velocity_representation(Representations.BODY_FIXED_REPRESENTATION)
# comp_w_hardware.set_frame_velocity_representation(Representations.BODY_FIXED_REPRESENTATION)

original_density = [628.0724496264945]
original_density = [
628.0724496264945
] # This is the original density value associated to the chest link, computed as mass/volume
original_length = np.ones(len(link_name_list))

n_dofs = len(joints_name_list)
Expand Down

0 comments on commit ab08cf9

Please sign in to comment.