Skip to content

Commit

Permalink
Replace DeprecationWarning with warnings.warn for root_link argument …
Browse files Browse the repository at this point in the history
…in KinDynComputations classes
  • Loading branch information
Giulero committed Jan 8, 2025
1 parent b2f19e1 commit d02bf2b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/adam/casadi/computations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import casadi as cs
import numpy as np

Expand Down Expand Up @@ -34,9 +36,7 @@ def __init__(
self.g = gravity
self.f_opts = f_opts
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down
6 changes: 3 additions & 3 deletions src/adam/jax/computations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import jax.numpy as jnp
import numpy as np

Expand Down Expand Up @@ -32,9 +34,7 @@ def __init__(
self.NDoF = self.rbdalgos.NDoF
self.g = gravity
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down
5 changes: 2 additions & 3 deletions src/adam/numpy/computations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import numpy as np

Expand Down Expand Up @@ -32,9 +33,7 @@ def __init__(
self.NDoF = model.NDoF
self.g = gravity
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
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
@@ -1,5 +1,7 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import casadi as cs
import numpy as np

Expand Down Expand Up @@ -49,9 +51,7 @@ def __init__(
self.g = gravity
self.f_opts = f_opts
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down
6 changes: 3 additions & 3 deletions src/adam/parametric/jax/computations_parametric.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import jax.numpy as jnp
import numpy as np
from jax import grad, jit, vmap
Expand Down Expand Up @@ -38,9 +40,7 @@ def __init__(
self.joints_name_list = joints_name_list
self.representation = Representations.MIXED_REPRESENTATION # Default
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down
6 changes: 3 additions & 3 deletions src/adam/parametric/numpy/computations_parametric.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import numpy as np

from adam.core.constants import Representations
Expand Down Expand Up @@ -36,9 +38,7 @@ def __init__(
self.joints_name_list = joints_name_list
self.representation = Representations.MIXED_REPRESENTATION # Default
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down
6 changes: 3 additions & 3 deletions src/adam/parametric/pytorch/computations_parametric.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.

import warnings

import numpy as np
import torch

Expand Down Expand Up @@ -39,9 +41,7 @@ def __init__(
self.urdfstring = urdfstring
self.representation = Representations.MIXED_REPRESENTATION # Default
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down
8 changes: 4 additions & 4 deletions src/adam/pytorch/computation_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# This software may be modified and distributed under the terms of the
# GNU Lesser General Public License v2.1 or any later version.

import warnings

import jax
import jax.numpy as jnp
import numpy as np
Expand Down Expand Up @@ -40,10 +42,8 @@ def __init__(
self.g = gravity
self.funcs = {}
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)

warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)


def set_frame_velocity_representation(
self, representation: Representations
Expand Down
6 changes: 3 additions & 3 deletions src/adam/pytorch/computations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (C) Istituto Italiano di Tecnologia (IIT). All rights reserved.


import warnings

import numpy as np
import torch

Expand Down Expand Up @@ -35,9 +37,7 @@ def __init__(
self.NDoF = self.rbdalgos.NDoF
self.g = gravity
if root_link is not None:
raise DeprecationWarning(
"The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF"
)
warnings.warn("The root_link argument is not used. The root link is automatically chosen as the link with no parent in the URDF", DeprecationWarning, stacklevel=2)

def set_frame_velocity_representation(
self, representation: Representations
Expand Down

0 comments on commit d02bf2b

Please sign in to comment.