Commit 6234c25
committed
Fix ContactSensor flat-buffer indexing to match ovphysx pattern-major layout
ovphysx ContactBinding returns sensors in pattern-major order:
the flat index for (env, sensor) is sensor*num_envs + env, NOT the
PhysX env-major env*num_sensors + sensor that update_net_forces_kernel
inherited from the PhysX port.
Symptom on AnymalD locomotion: body indices were scrambled, so foot
contacts were attributed to the wrong body (often the base), tripping
Episode_Termination/base_contact and resetting episodes after ~4 steps.
Verified by inspecting cb.sensor_paths for a 3-env, 2-body scene:
['/World/envs/env_0/A', '/World/envs/env_1/A', '/World/envs/env_2/A',
'/World/envs/env_0/B', '/World/envs/env_1/B', '/World/envs/env_2/B']
i.e. each per-body sensor pattern is fully expanded across envs before
the next pattern starts.
Pass num_envs through update_net_forces_kernel and switch its src_idx
to the pattern-major formula.1 parent 25e8f3c commit 6234c25
2 files changed
Lines changed: 12 additions & 3 deletions
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| |||
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
215 | 222 | | |
216 | | - | |
217 | | - | |
| 223 | + | |
| 224 | + | |
218 | 225 | | |
| 226 | + | |
219 | 227 | | |
220 | 228 | | |
221 | 229 | | |
| |||
238 | 246 | | |
239 | 247 | | |
240 | 248 | | |
241 | | - | |
| 249 | + | |
242 | 250 | | |
243 | 251 | | |
244 | 252 | | |
| |||
0 commit comments