Support float32 precision for mjtNum in Python bindings.

PiperOrigin-RevId: 922959317
Change-Id: I384b3bdeabdc4d3f66c71cae41dabfaf51387be7
This commit is contained in:
Yuval Tassa
2026-05-28 13:56:09 -07:00
committed by Copybara-Service
parent b612d352d4
commit df6942eb39
6 changed files with 119 additions and 104 deletions
@@ -156,8 +156,10 @@ def _array_binding_code(
if classname == 'mjSpec': # raw mjSpec has a wrapper
rawclassname = classname.replace('mjS', 'MjS')
fullvarname = 'ptr->' + varname
if innertype == 'double' or innertype == 'mjtNum':
innertype = 'MjDouble' # custom Eigen type
if innertype == 'mjtNum':
innertype = 'MjNum' # custom Eigen type for mjtNum fields
elif innertype == 'double':
innertype = 'MjDouble' # custom Eigen type for double fields
elif innertype == 'float':
innertype = 'MjFloat' # custom Eigen type
elif innertype == 'int':