Skip to content

Commit ca9cb1e

Browse files
committed
Remove some comments, function renames to reflect original names
1 parent 016a28a commit ca9cb1e

File tree

6 files changed

+15
-31
lines changed

6 files changed

+15
-31
lines changed

genesis/engine/simulator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def __init__(
103103
self._dt: float = options.dt
104104
self._substep_dt: float = options.dt / options.substeps
105105
self._substeps: int = options.substeps
106-
self._substeps_local: int | None = options.substeps_local # todo change it ? None -> zero
106+
self._substeps_local: int | None = options.substeps_local
107107
self._requires_grad: bool = options.requires_grad
108-
self._steps_local: int | None = options._steps_local # todo change it ? None -> zero
108+
self._steps_local: int | None = options._steps_local
109109

110110
self._cur_substep_global = 0
111111
self._gravity = np.array(options.gravity, dtype=gs.np_float)

genesis/engine/solvers/rigid/collider_decomp.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ def reset(self, envs_idx: npt.NDArray[np.int32] | None = None) -> None:
272272
)
273273
self._contacts_info_cache = {}
274274

275-
# ?? only used with hibernation ??
276275
def clear(self, envs_idx=None):
277276
if envs_idx is None:
278277
envs_idx = self._solver._scene._envs_idx

genesis/engine/solvers/rigid/contact_island.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def __init__(self, collider: "Collider"):
7979

8080
# num all collision edges in world
8181
self.n_edges = ti.field(dtype=gs.ti_int, shape=self.solver._B)
82-
8382
self.n_islands = ti.field(dtype=gs.ti_int, shape=self.solver._B)
8483
self.n_stack = ti.field(dtype=gs.ti_int, shape=self.solver._B)
8584

@@ -95,7 +94,7 @@ def __init__(self, collider: "Collider"):
9594
self.entity_idx_to_next_entity_idx_in_hibernated_island.fill(INVALID_NEXT_HIBERNATED_ENTITY_IDX)
9695

9796
@ti.kernel
98-
def clear_island_mapping(self):
97+
def clear__island_mapping(self):
9998
ti.loop_config(serialize=self.solver._para_level < gs.PARA_LEVEL.ALL)
10099
for i_e, i_b in ti.ndrange(self.solver.n_entities, self.solver._B):
101100
self.entity_edge[i_e, i_b].n = 0
@@ -127,7 +126,7 @@ def add_edge(self, link_a, link_b, i_b):
127126
self.n_edges[i_b] = n_edge + 1
128127

129128
@ti.kernel
130-
def add_all_contact_edges(self):
129+
def add_island__all_contact_edges(self):
131130
ti.loop_config(serialize=self.solver._para_level < gs.PARA_LEVEL.ALL)
132131
for i_b in range(self.solver._B):
133132
for i_col in range(self.collider._collider_state.n_contacts[i_b]):
@@ -137,7 +136,7 @@ def add_all_contact_edges(self):
137136
self.add_edge(link_a, link_b, i_b)
138137

139138
@ti.kernel
140-
def add_all_hibernated_island_edges(self):
139+
def add_island__all_hibernated_island_edges(self):
141140
_B = self.solver._B
142141
n_entities = self.solver.n_entities
143142
ti.loop_config(serialize=self.solver._para_level < gs.PARA_LEVEL.ALL)
@@ -155,9 +154,9 @@ def add_all_hibernated_island_edges(self):
155154
self.add_edge(any_link_a, any_link_b, i_b)
156155

157156
def construct(self):
158-
self.clear_island_mapping()
159-
self.add_all_contact_edges()
160-
self.add_all_hibernated_island_edges()
157+
self.clear__island_mapping()
158+
self.add_island__all_contact_edges()
159+
self.add_island__all_hibernated_island_edges()
161160
self.preprocess_island__map_entities_to_edges()
162161
self.construct_islands()
163162
self.postprocess_island__assign_contact_data_to_temp_islands()

genesis/engine/solvers/rigid/rigid_solver_decomp.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,9 @@ def _init_constraint_solver(self):
921921
def substep(self):
922922
# from genesis.utils.tools import create_timer
923923

924-
924+
# Note: ContactIsland param is needed when supporting hibernation. But the attribute does not exist
925+
# in the solver when hibernation is disabled. In that case, we create a dummy ContactIsland object
926+
# needed for compilation, but not being used in the kernel.
925927
if not hasattr(self, "optional_contact_island"):
926928
if hasattr(self, "constraint_solver") and hasattr(self.constraint_solver, "contact_island"):
927929
self.optional_contact_island = self.constraint_solver.contact_island
@@ -961,9 +963,6 @@ def substep(self):
961963
collider_state=self.collider._collider_state,
962964
rigid_global_info=self._rigid_global_info,
963965
static_rigid_sim_config=self._static_rigid_sim_config,
964-
# contact_island=getattr(self.constraint_solver, "contact_island", None),
965-
966-
# xxx: enable this and get things compiling
967966
contact_island=self.optional_contact_island,
968967
)
969968
# timer.stamp("kernel_step_2")
@@ -4043,7 +4042,7 @@ def kernel_step_2(
40434042
)
40444043

40454044
if ti.static(static_rigid_sim_config.use_hibernation):
4046-
func_for_all_awake_islands_either_hiberanate_or_update_aabb_sort_buffer(
4045+
func_hibernate__for_all_awake_islands_either_hiberanate_or_update_aabb_sort_buffer(
40474046
dofs_state=dofs_state,
40484047
entities_state=entities_state,
40494048
entities_info=entities_info,
@@ -4924,7 +4923,7 @@ def kernel_update_vgeoms(
49244923

49254924

49264925
@ti.func
4927-
def func_for_all_awake_islands_either_hiberanate_or_update_aabb_sort_buffer(
4926+
def func_hibernate__for_all_awake_islands_either_hiberanate_or_update_aabb_sort_buffer(
49284927
dofs_state: array_class.DofsState,
49294928
entities_state: array_class.EntitiesState,
49304929
entities_info: array_class.EntitiesInfo,
@@ -4938,10 +4937,7 @@ def func_for_all_awake_islands_either_hiberanate_or_update_aabb_sort_buffer(
49384937

49394938
n_entities = entities_state.hibernated.shape[0]
49404939
_B = entities_state.hibernated.shape[1]
4941-
49424940
ci = contact_island
4943-
# entity_ref_range_from_island_idx = ci.island_entity
4944-
# entity_idx_from_entity_ref = ci.entity_id
49454941

49464942
ti.loop_config(serialize=static_rigid_sim_config.para_level < gs.PARA_LEVEL.PARTIAL)
49474943
for i_b in range(_B):
@@ -4962,7 +4958,7 @@ def func_for_all_awake_islands_either_hiberanate_or_update_aabb_sort_buffer(
49624958
is_entity_fixed = entities_info.n_dofs[entity_idx] == 0
49634959
Debug.assertf(0x7ad00005, not is_entity_fixed) # Fixed entity should not belong to an island
49644960

4965-
# we can ignore entitiy_hibernated flag -> cos it implies dofs_state.vel/acc are zero
4961+
# Hibernated entities already have zero dofs_state.acc/vel
49664962
is_entity_hibernated = entities_state.hibernated[entity_idx, i_b]
49674963
if is_entity_hibernated:
49684964
continue
@@ -5666,23 +5662,14 @@ def func_integrate(
56665662
i_l = rigid_global_info.awake_links[i_l_, i_b]
56675663
I_l = [i_l, i_b] if ti.static(static_rigid_sim_config.batch_links_info) else i_l
56685664

5669-
5670-
# why not links_info.dof_start, q_start, q_end ?
56715665
for i_j in range(links_info.joint_start[I_l], links_info.joint_end[I_l]):
56725666
I_j = [i_j, i_b] if ti.static(static_rigid_sim_config.batch_joints_info) else i_j
56735667
dof_start = joints_info.dof_start[I_j]
56745668
q_start = joints_info.q_start[I_j]
56755669
q_end = joints_info.q_end[I_j]
56765670

5677-
# can we just do that ?
5678-
# if True:
5679-
# dof_start = links_info.dof_start[I_l]
5680-
# q_start = links_info.q_start[I_l]
5681-
# q_end = links_info.q_end[I_l]
5682-
56835671
joint_type = joints_info.type[I_j]
56845672

5685-
# TODO: consider copying from no-hibernation version below
56865673
if joint_type == gs.JOINT_TYPE.FREE:
56875674
rot = ti.Vector(
56885675
[

genesis/engine/solvers/rigid/rigid_solver_decomp_util.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@ def func_wakeup_entity_and_its_temp_island(
7777
validate_entity_hibernation_state_for_all_entities_in_temp_island( \
7878
island_idx, i_b, entities_state, contact_island, expected_hibernation_state=False)
7979
validate_next_hibernated_entity_indices_in_entire_scene(i_b, entities_state, contact_island)
80-

genesis/engine/solvers/rigid/rigid_validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ def validate_next_hibernated_entity_indices_in_entire_scene(
6262
Debug.assertf(0x7ad00027, entities_state.hibernated[i_e, i_b] == True)
6363
else:
6464
Debug.assertf(0x7ad00024, next_entity_idx == INVALID_NEXT_HIBERNATED_ENTITY_IDX)
65-
Debug.assertf(0x7ad00026, entities_state.hibernated[i_e, i_b] == False)
65+
Debug.assertf(0x7ad00026, entities_state.hibernated[i_e, i_b] == False)

0 commit comments

Comments
 (0)