Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion obelisk/cpp/obelisk_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ if(USE_MUJOCO)
find_package(Eigen3 REQUIRED)

include(FetchContent)
set(MUJOCO_VERSION "3.1.6" CACHE STRING "mujoco version")
# >= 3.5.0 required: mj_multiRay's angular culling in <= 3.4 wrongly drops
# large slabs near the ray origin (below-ground lidar returns at slab seams)
set(MUJOCO_VERSION "3.8.1" CACHE STRING "mujoco version")
set(COMP_ARCH "x86_64" CACHE STRING "computer architecture")

FetchContent_Declare(
Expand Down
6 changes: 4 additions & 2 deletions obelisk/cpp/obelisk_cpp/include/obelisk_mujoco_sim_robot.h
Original file line number Diff line number Diff line change
Expand Up @@ -1539,16 +1539,18 @@ namespace obelisk {
Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::RowMajor> dirs_rm = dirs_w;
std::vector<int> geomids(num_rays, -1);
const mjtNum cutoff = iface.get_max_distance() > 0.0 ? iface.get_max_distance() : mjMAXVAL;
// mujoco >= 3.5: ray functions take an optional surface-normal
// output (nullptr = not needed)
mj_multiRay(this->model_, this->data_, origin.data(), dirs_rm.data(),
iface.get_geom_group_mask(), 1, -1, geomids.data(), dists.data(),
num_rays, cutoff);
nullptr, num_rays, cutoff);
} else {
int geom_id[1] = { -1 };
for (int ii = 0; ii < num_rays; ++ii) {
Eigen::Vector3d ray_origin = starts_w.row(ii).transpose();
Eigen::Vector3d direction = dirs_w.row(ii).transpose();
dists[ii] = mj_ray(this->model_, this->data_, ray_origin.data(), direction.data(),
iface.get_geom_group_mask(), 1, -1, geom_id);
iface.get_geom_group_mask(), 1, -1, geom_id, nullptr);
}
}
}
Expand Down