Skip to content

Commit 05df96e

Browse files
Refactor Kamino tests to use Newton's ModelBuilder (#4107)
1 parent 9595fe4 commit 05df96e

68 files changed

Lines changed: 1980 additions & 15931 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

newton/_src/solvers/kamino/_src/core/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
KAMINO: Core Module
66
"""
77

8-
from .builder import ModelBuilderKamino
98
from .control import ControlKamino
109
from .data import DataKamino
1110
from .model import ModelKamino
@@ -15,4 +14,4 @@
1514
# Module interface
1615
###
1716

18-
__all__ = ["ControlKamino", "DataKamino", "ModelBuilderKamino", "ModelKamino", "StateKamino"]
17+
__all__ = ["ControlKamino", "DataKamino", "ModelKamino", "StateKamino"]

newton/_src/solvers/kamino/_src/core/bodies.py

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55

66
from __future__ import annotations
77

8-
from dataclasses import dataclass, field
8+
from dataclasses import dataclass
99

1010
import warp as wp
1111

12-
from .....core.types import override
1312
from .....sim import BodyFlags
14-
from .types import Descriptor
1513

1614
###
1715
# Module interface
@@ -20,7 +18,6 @@
2018
__all__ = [
2119
"RigidBodiesData",
2220
"RigidBodiesModel",
23-
"RigidBodyDescriptor",
2421
"convert_base_origin_to_com",
2522
"convert_body_com_to_origin",
2623
"convert_body_origin_to_com",
@@ -44,75 +41,6 @@
4441
###
4542

4643

47-
@dataclass
48-
class RigidBodyDescriptor(Descriptor):
49-
"""
50-
A container to describe a single rigid body in the model builder.
51-
52-
Attributes:
53-
name: The name of the body.
54-
uid: The unique identifier of the body.
55-
m_i: Mass of the body [kg].
56-
i_r_com_i: Translational offset of the body center of mass [m].
57-
i_I_i: Moment of inertia matrix in local coordinates [kg·m²].
58-
q_i_0: Initial absolute pose of the body in world coordinates.
59-
u_i_0: Initial absolute twist of the body in world coordinates.
60-
wid: Index of the world to which the body belongs.
61-
bid: Index of the body w.r.t. its world.
62-
"""
63-
64-
###
65-
# Attributes
66-
###
67-
68-
m_i: float = 0.0
69-
"""Mass of the body."""
70-
71-
i_r_com_i: wp.vec3f = field(default_factory=wp.vec3f)
72-
"""Translational offset of the body center of mass w.r.t the reference frame expressed in local coordinates."""
73-
74-
i_I_i: wp.mat33f = field(default_factory=wp.mat33f)
75-
"""Moment of inertia matrix of the body expressed in local coordinates."""
76-
77-
q_i_0: wp.transformf = field(default_factory=wp.transformf)
78-
"""Initial absolute pose of the body expressed in world coordinates."""
79-
80-
u_i_0: wp.spatial_vectorf = field(default_factory=wp.spatial_vectorf)
81-
"""Initial absolute twist of the body expressed in world coordinates."""
82-
83-
###
84-
# Metadata - to be set by the WorldDescriptor when added
85-
###
86-
87-
wid: int = -1
88-
"""
89-
Index of the world to which the body belongs.
90-
Defaults to `-1`, indicating that the body has not yet been added to a world.
91-
"""
92-
93-
bid: int = -1
94-
"""
95-
Index of the body w.r.t. its world.
96-
Defaults to `-1`, indicating that the body has not yet been added to a world.
97-
"""
98-
99-
@override
100-
def __repr__(self) -> str:
101-
"""Returns a human-readable string representation of the RigidBodyDescriptor."""
102-
return (
103-
f"RigidBodyDescriptor(\n"
104-
f"name: {self.name},\n"
105-
f"uid: {self.uid},\n"
106-
f"m_i: {self.m_i},\n"
107-
f"i_I_i:\n{self.i_I_i},\n"
108-
f"q_i_0: {self.q_i_0},\n"
109-
f"u_i_0: {self.u_i_0}\n"
110-
f"wid: {self.wid},\n"
111-
f"bid: {self.bid},\n"
112-
f")"
113-
)
114-
115-
11644
@dataclass
11745
class RigidBodiesModel:
11846
"""

0 commit comments

Comments
 (0)