Skip to content

Commit d8cadb8

Browse files
committed
Implement MR comment
1 parent 8ac978d commit d8cadb8

4 files changed

Lines changed: 16 additions & 15 deletions

File tree

newton/_src/solvers/kamino/_src/solvers/warmstart.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -977,15 +977,16 @@ class WarmstarterContacts:
977977
This class supports multiple warm-starting strategies, selectable via the `Method` enum:
978978
- `KEY_AND_POSITION`:
979979
Warm-starts contacts by matching geom-pair keys and contact-point positions.
980-
- `KEY_AND_POSITION_WITH_TANGENT_NET_FORCE`:
981-
Warm-starts matched normal reactions and balances tangential force per geom-pair.
980+
- `KEY_AND_POSITION_WITH_TANGENTIAL_NET_FORCE`:
981+
Warm-starts contacts by matching geom-pair keys and contact-point positions,
982+
while distributing the cached net tangential force uniformly across the geom-pair.
982983
- `GEOM_PAIR_NET_FORCE`:
983984
Warm-starts contacts using the net body-CoM contact force per geom-pair.
984985
- `GEOM_PAIR_NET_WRENCH`:
985986
Warm-starts contacts using the net body-CoM contact wrench per geom-pair.
986987
- `KEY_AND_POSITION_WITH_NET_FORCE_BACKUP`:
987988
Warm-starts contacts by matching geom-pair keys and contact-point positions,
988-
- with a backup strategy using the net body-CoM contact force per geom-pair.
989+
with a backup strategy using the net body-CoM contact force per geom-pair.
989990
- `KEY_AND_POSITION_WITH_NET_WRENCH_BACKUP`:
990991
Warm-starts contacts by matching geom-pair keys and contact-point positions,
991992
with a backup strategy using the net body-CoM contact wrench per geom-pair.
@@ -1020,10 +1021,10 @@ class Method(IntEnum):
10201021
with a backup strategy using the net body-CoM contact wrench per geom-pair.
10211022
"""
10221023

1023-
KEY_AND_POSITION_WITH_TANGENT_NET_FORCE = 5
1024+
KEY_AND_POSITION_WITH_TANGENTIAL_NET_FORCE = 5
10241025
"""
1025-
Warm-start matched normal reactions and distribute the pair's net
1026-
tangential force uniformly across its cached contact count.
1026+
Warm-start contacts by matching geom-pair keys and contact-point positions,
1027+
while distributing the cached net tangential force uniformly across the geom-pair.
10271028
"""
10281029

10291030
@classmethod
@@ -1147,7 +1148,7 @@ def warmstart(self, model: ModelKamino, data: DataKamino, contacts: ContactsKami
11471148
pair_contact_counts=self._pair_contact_counts,
11481149
)
11491150

1150-
case WarmstarterContacts.Method.KEY_AND_POSITION_WITH_TANGENT_NET_FORCE:
1151+
case WarmstarterContacts.Method.KEY_AND_POSITION_WITH_TANGENTIAL_NET_FORCE:
11511152
warmstart_contacts_by_matched_geom_pair_key_and_position(
11521153
model=model,
11531154
data=data,
@@ -1197,7 +1198,7 @@ def warmstart(self, model: ModelKamino, data: DataKamino, contacts: ContactsKami
11971198
" - GEOM_PAIR_NET_WRENCH (2),"
11981199
" - KEY_AND_POSITION_WITH_NET_FORCE_BACKUP (3),"
11991200
" - KEY_AND_POSITION_WITH_NET_WRENCH_BACKUP (4),"
1200-
" - KEY_AND_POSITION_WITH_TANGENT_NET_FORCE (5)."
1201+
" - KEY_AND_POSITION_WITH_TANGENTIAL_NET_FORCE (5)."
12011202
)
12021203

12031204
def update(self, contacts: ContactsKamino | None = None):

newton/_src/solvers/kamino/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,12 +854,12 @@ class DVISolverConfig:
854854
"key_and_position",
855855
"geom_pair_net_force",
856856
"key_and_position_with_net_force_backup",
857-
"key_and_position_with_tangent_net_force",
858-
] = "key_and_position_with_tangent_net_force"
857+
"key_and_position_with_tangential_net_force",
858+
] = "key_and_position_with_tangential_net_force"
859859
"""
860860
The contact warmstart method used when `warmstart_mode` is `containers`.
861861
See :class:`WarmstarterContacts.Method` for available options.
862-
Defaults to `key_and_position_with_tangent_net_force`.
862+
Defaults to `key_and_position_with_tangential_net_force`.
863863
"""
864864

865865
@override
@@ -929,7 +929,7 @@ def validate(self) -> None:
929929
"key_and_position",
930930
"geom_pair_net_force",
931931
"key_and_position_with_net_force_backup",
932-
"key_and_position_with_tangent_net_force",
932+
"key_and_position_with_tangential_net_force",
933933
}
934934
if self.contact_warmstart_method not in implemented_contact_warmstart_methods:
935935
raise ValueError(

newton/_src/solvers/kamino/tests/test_solvers_dvi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def test_00_config_selection(self):
352352
self.assertEqual(config.dvi.max_alternating_iterations, 32)
353353
self.assertEqual(config.dvi.inequality_sweeps_per_iteration, 2)
354354
self.assertEqual(config.dvi.bilateral_solve_interval, 1)
355-
self.assertEqual(config.dvi.contact_warmstart_method, "key_and_position_with_tangent_net_force")
355+
self.assertEqual(config.dvi.contact_warmstart_method, "key_and_position_with_tangential_net_force")
356356
self.assertFalse(config.dynamics.preconditioning)
357357

358358
sparse_config = SolverKamino.Config(dynamics_solver="dvi", sparse_dynamics=True, sparse_jacobian=True)
@@ -386,7 +386,7 @@ def test_00_config_selection(self):
386386
"key_and_position",
387387
"geom_pair_net_force",
388388
"key_and_position_with_net_force_backup",
389-
"key_and_position_with_tangent_net_force",
389+
"key_and_position_with_tangential_net_force",
390390
):
391391
self.assertEqual(
392392
kamino_config.DVISolverConfig(contact_warmstart_method=method).contact_warmstart_method, method

newton/examples/kamino/example_kamino_robot_dr_legs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self, viewer: newton.viewer.ViewerBase, args=None):
105105
self.config.dvi.max_alternating_iterations = 4
106106
self.config.dvi.inequality_sweeps_per_iteration = 3
107107
self.config.dvi.bilateral_solve_interval = 1
108-
self.config.dvi.contact_warmstart_method = "key_and_position_with_tangent_net_force"
108+
self.config.dvi.contact_warmstart_method = "key_and_position_with_tangential_net_force"
109109
self.solver = newton.solvers.SolverKamino(self.model, config=self.config)
110110

111111
# Set joint armature and viscous damping for better

0 commit comments

Comments
 (0)