Skip to content

Commit 751d987

Browse files
yuvaltassacopybara-github
authored andcommitted
Breaking change: Add surface normal output to MuJoCo raycast functions.
PiperOrigin-RevId: 855781592 Change-Id: Ia6967bcada58b285442c87470e61124625a8a115
1 parent 2f8befa commit 751d987

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

mjpc/tasks/manipulation/common.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ GraspState GetGraspState(const mjModel* m, const mjData* d,
4444
geomgroup[kGroupCollisionScene] = 1;
4545
int ray_geom_id;
4646
double ray_distance =
47-
mj_ray(m, d, right_finger, direction, geomgroup, 0, -1, &ray_geom_id);
47+
mj_ray(m, d, right_finger, direction, geomgroup, 0, -1, &ray_geom_id,
48+
nullptr);
4849

4950
if (ray_distance == -1 || ray_distance > finger_distance) {
5051
// nothing in the gripper
@@ -60,7 +61,8 @@ GraspState GetGraspState(const mjModel* m, const mjData* d,
6061
// to see if it's the only object
6162
mju_scl3(direction, direction, -1);
6263
double ray_distance2 =
63-
mj_ray(m, d, left_finger, direction, geomgroup, 0, -1, &ray_geom_id);
64+
mj_ray(m, d, left_finger, direction, geomgroup, 0, -1, &ray_geom_id,
65+
nullptr);
6466
ray_body_id = m->body_weldid[m->geom_bodyid[ray_geom_id]];
6567
if (ray_body_id != body_id) {
6668
// there's another object in the gripper
@@ -186,7 +188,7 @@ double BlockedCost(const mjModel* model, const mjData* data,
186188

187189
int ray_geom_id;
188190
double ray_distance = mj_ray(model, data, pos, direction, geomgroup, 0,
189-
exclude_body_id, &ray_geom_id);
191+
exclude_body_id, &ray_geom_id, nullptr);
190192
// if there is something between the hand and the object, return 1.
191193
return ray_distance > -1 && ray_distance < distance;
192194
}

mjpc/utilities.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ mjtNum Ground(const mjModel* model, const mjData* data, const mjtNum pos[3],
564564
const mjtByte default_geomgroup[6] = {1, 0, 0, 0, 0, 0};
565565
const mjtByte* query_geomgroup = geomgroup ? geomgroup : default_geomgroup;
566566
mjtNum dist = mj_ray(model, data, query, down, query_geomgroup, flg_static,
567-
bodyexclude, &geomid);
567+
bodyexclude, &geomid, nullptr);
568568

569569
if (dist < 0) { // SHOULD NOT OCCUR
570570
mju_error("no group 0 geom detected by raycast");

0 commit comments

Comments
 (0)