# Copyright 2026 DeepMind Technologies Limited## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.# =============================================================================="""BVH helpers for MJX."""fromtypingimportAny# pylint: disable=g-importing-memberfrommujoco.mjx._src.typesimportDatafrommujoco.mjx._src.typesimportImplfrommujoco.mjx._src.typesimportModel# pylint: enable=g-importing-memberimportmujoco.mjx.warpasmjxw
[docs]defrefit_bvh(m:Model,d:Data,ctx:Any):"""Refit the scene BVH for the current pose."""ifm.impl==Impl.WARPandd.impl==Impl.WARPandmjxw.WARP_INSTALLED:importmujoco.mjx.warp.render_contextasmjxw_rc# pylint: disable=g-import-not-at-top # pytype: disable=import-errorfrommujoco.mjx.warpimportbvhasmjxw_bvh# pylint: disable=g-import-not-at-top # pytype: disable=import-errorifnotisinstance(ctx,mjxw_rc.RenderContextPytree):raiseTypeError(f'Expected RenderContextPytree, got {type(ctx).__name__}.'' Use rc.pytree() to get the JAX-compatible handle.')returnmjxw_bvh.refit_bvh(m,d,ctx)raiseNotImplementedError('refit_bvh only implemented for MuJoCo Warp.')