diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index 39dd42c4..78edf72e 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -191,11 +191,11 @@ any effect. The settings here are global and apply to the entire model. .. _compiler-coordinate: -:at:`coordinate`: :at-val:`[local, global], "local" for MJCF, always "local" for URDF` - This attribute specifies whether the frame positions and orientations in the MJCF model are expressed in local or - global coordinates; recall :ref:`Coordinate frames `. The compiler converts global into local - coordinates, and mjModel always uses local coordinates. For URDF models the parser sets this attribute to "local" - internally, regardless of the XML setting. +:at:`coordinate`: :at-val:`[local, global], "local"` + In previous versions, this attribute could be used to specify whether frame positions and orientations are expressed + in local or global coordinates, but the "global" option has since been removed, and will cause an error to be + generated. In order to convert older models which used the "global" option, load and save them in MuJoCo 2.3.3 or + older. .. _compiler-angle: @@ -2839,23 +2839,7 @@ defined. Its body name is automatically defined as "world". .. _body-pos: :at:`pos`: :at-val:`real(3), optional` - The 3D position of the body frame, in local or global coordinates as determined by the coordinate attribute of - :ref:`compiler `. Recall the earlier discussion of local and global coordinates in :ref:`Coordinate frames - `. In local coordinates, if the body position is left undefined it defaults to (0,0,0). In global - coordinates, an undefined body position is inferred by the compiler through the following steps: - - #. If the inertial frame is not defined via the :ref:`inertial ` element, it is inferred from the - geoms attached to the body. If there are no geoms, the inertial frame remains undefined. This step is applied in - both local and global coordinates. - #. If both the body frame and the inertial frame are undefined, a compile error is generated. - #. If one of these two frames is defined and the other is not, the defined one is copied into the undefined one. At - this point both frames are defined, in global coordinates. - #. The inertial frame as well as all elements defined in the body are converted to local coordinates, relative to the - body frame. - - Note that whether a frame is defined or not depends on its pos attribute, which is in the special undefined state by - default. Orientation cannot be used to make this determination because it has an internal default (the unit - quaternion). + The 3D position of the body frame, in the parent coordinate frame. If undefined it defaults to (0,0,0). .. _body-quat: @@ -2868,12 +2852,7 @@ defined. Its body name is automatically defined as "world". .. _body-euler: :at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler` - See :ref:`COrientation`. Similar to position, the orientation specified here is - interpreted in either local or global coordinates as determined by the coordinate attribute of - :ref:`compiler `. Unlike position which is required in local coordinates, the orientation defaults to the - unit quaternion, thus specifying it is optional even in local coordinates. If the body frame was copied from the body - inertial frame per the above rules, the copy operation applies to both position and orientation, and the setting of - the orientation-related attributes is ignored. + See :ref:`COrientation`. .. _body-gravcomp: @@ -3021,8 +3000,7 @@ unit quaternions. .. _body-joint-pos: :at:`pos`: :at-val:`real(3), "0 0 0"` - Position of the joint, specified in local or global coordinates as determined by the coordinate attribute of - :ref:`compiler `. For free joints this attribute is ignored. + Position of the joint, specified in the frame of the parent body. For free joints this attribute is ignored. .. _body-joint-axis: @@ -3434,8 +3412,7 @@ helps clarify the role of bodies and geoms in MuJoCo. .. _body-geom-pos: :at:`pos`: :at-val:`real(3), "0 0 0"` - Position of the geom frame, in local or global coordinates as determined by the coordinate attribute of - :ref:`compiler `. + Position of the geom, specified in the frame of the parent body. .. _body-geom-quat: @@ -4416,9 +4393,8 @@ geoms volumes of either body. This constraint can be used to define ball joints kinematics; the constraint solver pushes these points towards each other. In the MJCF model however only one point is given. We assume that the equality constraint is exactly satisfied in the configuration in which the model is defined (this applies to all other constraint types as well). The compiler uses the single anchor specified in the MJCF model - to compute the two body-relative anchor points in mjModel. If the MJCF model is in global coordinates, as determined - by the coordinate attribute of :ref:`compiler `, the anchor is specified in global coordinates. Otherwise - the anchor is specified relative to the local coordinate frame of the *first* body. + to compute the two body-relative anchor points in mjModel. Specified relative to the local coordinate frame of + the *first* body. .. _equality-weld: diff --git a/doc/_static/example.xml b/doc/_static/example.xml index 8a6b16c7..1f3364ae 100644 --- a/doc/_static/example.xml +++ b/doc/_static/example.xml @@ -1,6 +1,4 @@ - - @@ -11,25 +9,26 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + + diff --git a/doc/_static/example_saved.txt b/doc/_static/example_saved.txt index 1287d55c..2ed03228 100644 --- a/doc/_static/example_saved.txt +++ b/doc/_static/example_saved.txt @@ -1,678 +1,662 @@ -MuJoCo version 2.10 +MuJoCo version 2.3.3 model name example -nq 15 -nv 13 -nu 0 -na 0 -nbody 5 -njnt 6 -ngeom 4 -nsite 2 -ncam 0 -nlight 1 -nmesh 0 -nmeshvert 0 -nmeshface 0 -nmeshtexcoord 0 -nmeshgraph 0 -nskin 0 -nskinvert 0 -nskintexvert 0 -nskinface 0 -nskinbone 0 -nskinbonevert 0 -nhfield 0 -nhfielddata 0 -ntex 1 -ntexdata 1179648 -nmat 0 -npair 0 -nexclude 0 -neq 0 -ntendon 1 -nwrap 2 -nsensor 0 -nnumeric 0 -nnumericdata 0 -ntext 0 -ntextdata 0 -ntuple 0 -ntupledata 0 -nkey 0 -nuser_body 0 -nuser_jnt 0 -nuser_geom 0 -nuser_site 0 -nuser_cam 0 -nuser_tendon 0 -nuser_actuator 0 -nuser_sensor 0 -nnames 41 +nq 15 +nv 13 +nbody 5 +nbvh 4 +njnt 6 +ngeom 4 +nsite 2 +nlight 1 +ntex 1 +ntexdata 1179648 +ntendon 1 +nwrap 2 +nnames 41 +nnames_map 40 +nM 49 +nD 85 +nB 40 +njmax -1 +nconmax -1 +nstack 1835008 +nbuffer 1191840 -nM 49 -nemax 0 -njmax 500 -nconmax 100 -nstack 1316805 -nuserdata 0 -nmocap 0 -nsensordata 0 -nbuffer 1185209 +timestep 0.002 +apirate 1e+02 +impratio 1 +tolerance 1e-08 +noslip_tolerance 1e-06 +mpr_tolerance 1e-06 +density 0 +viscosity 0 +o_margin 0 +integrator 0 +collision 0 +cone 0 +jacobian 2 +solver 2 +iterations 100 +noslip_iterations 0 +mpr_iterations 50 +disableflags 0 +enableflags 0 +gravity 0 0 -9.8 +wind 0 0 0 +magnetic 0 -0.5 0 +o_solref 0.02 1 +o_solimp 0.9 0.95 0.001 0.5 2 -timestep 0.002 -apirate 1e+02 -impratio 1 -tolerance 1e-08 -noslip_tolerance 1e-06 -mpr_tolerance 1e-06 -gravity 0 0 -9.8 -wind 0 0 0 -magnetic 0 -0.5 0 -density 0 -viscosity 0 -o_margin 0 -o_solref 0.02 1 -o_solimp 0.9 0.95 0.001 0.5 2 -integrator 0 -collision 0 -collision 0 -cone 0 -jacobian 2 -solver 2 -iterations 100 -noslip_iterations 0 -mpr_iterations 50 -disableflags 0 -enableflags 0 +totalmass 11 -totalmass 11 +meaninertia 0.86 +meanmass 2.7 +meansize 0.17 +extent 1.1 +center 0.12 0 0.52 -meaninertia 0.86 -meanmass 2.7 -meansize 0.17 -extent 1.1 -center 0.18 0 0.52 +qpos0 1 0 0 0 0 0 0 0 0.3 0 0.1 1 0 0 0 -qpos0 1 0 0 0 0 0 0 0 0.5 0 0.1 1 0 0 0 - -qpos_spring 1 0 0 0 0 0 0 0 0.5 0 0.1 1 0 0 0 +qpos_spring 1 0 0 0 0 0 0 0 0.3 0 0.1 1 0 0 0 BODY 0: - name world - parentid 0 - rootid 0 - weldid 0 - mocapid -1 - jntnum 0 - jntadr -1 - dofnum 0 - dofadr -1 - geomnum 0 - geomadr -1 - simple 1 - sameframe 1 - pos 0 0 0 - quat 1 0 0 0 - ipos 0 0 0 - iquat 1 0 0 0 - mass 0 - subtreemass 11 - inertia 0 0 0 - invweight0 0 0 + name world + body_parentid 0 + body_rootid 0 + body_weldid 0 + body_mocapid -1 + body_jntnum 0 + body_jntadr -1 + body_dofnum 0 + body_dofadr -1 + body_geomnum 0 + body_geomadr -1 + body_simple 1 + body_sameframe 1 + body_pos 0 0 0 + body_quat 1 0 0 0 + body_ipos 0 0 0 + body_iquat 1 0 0 0 + body_mass 0 + body_subtreemass 11 + body_inertia 0 0 0 + body_invweight0 0 0 + body_gravcomp 0 + body_plugin -1 + body_bvhadr -1 + body_bvhnum 0 BODY 1: name - parentid 0 - rootid 1 - weldid 1 - mocapid -1 - jntnum 1 - jntadr 0 - dofnum 3 - dofadr 0 - geomnum 1 - geomadr 0 - simple 0 - sameframe 1 - pos 0 0 0.8 - quat 1 0 0 0 - ipos 0 0 0 - iquat 1 0 0 0 - mass 5.2 - subtreemass 7.6 - inertia 0.096 0.096 0.0094 - invweight0 0.051 7.3 + body_parentid 0 + body_rootid 1 + body_weldid 1 + body_mocapid -1 + body_jntnum 1 + body_jntadr 0 + body_dofnum 3 + body_dofadr 0 + body_geomnum 1 + body_geomadr 0 + body_simple 0 + body_sameframe 0 + body_pos 0 0 1 + body_quat 1 0 0 0 + body_ipos 0 0 -0.2 + body_iquat 1 0 0 0 + body_mass 5.4 + body_subtreemass 7.9 + body_inertia 0.11 0.11 0.0094 + body_invweight0 0.048 6.9 + body_gravcomp 0 + body_plugin -1 + body_bvhadr 0 + body_bvhnum 1 BODY 2: name - parentid 1 - rootid 1 - weldid 2 - mocapid -1 - jntnum 2 - jntadr 1 - dofnum 2 - dofadr 3 - geomnum 1 - geomadr 1 - simple 0 - sameframe 1 - pos 0.15 0 -0.2 - quat 0.71 0 -0.71 0 - ipos 0 0 0 - iquat 1 0 0 0 - mass 1.7 - subtreemass 2.4 - inertia 0.017 0.017 0.0014 - invweight0 0.31 1.6e+02 + body_parentid 1 + body_rootid 1 + body_weldid 2 + body_mocapid -1 + body_jntnum 2 + body_jntadr 1 + body_dofnum 2 + body_dofadr 3 + body_geomnum 1 + body_geomadr 1 + body_simple 0 + body_sameframe 0 + body_pos 0 0 -0.4 + body_quat 1 0 0 0 + body_ipos 0.15 0 0 + body_iquat 0.71 0 -0.71 0 + body_mass 1.8 + body_subtreemass 2.4 + body_inertia 0.019 0.019 0.0014 + body_invweight0 0.29 1.6e+02 + body_gravcomp 0 + body_plugin -1 + body_bvhadr 1 + body_bvhnum 1 BODY 3: name - parentid 2 - rootid 1 - weldid 3 - mocapid -1 - jntnum 2 - jntadr 3 - dofnum 2 - dofadr 5 - geomnum 1 - geomadr 2 - simple 0 - sameframe 1 - pos 5.6e-17 0 -0.25 - quat 0.71 0 0.71 0 - ipos 0 0 0 - iquat 1 0 0 0 - mass 0.67 - subtreemass 0.67 - inertia 0.00091 0.0014 0.0022 - invweight0 0.9 2.8e+02 + body_parentid 2 + body_rootid 1 + body_weldid 3 + body_mocapid -1 + body_jntnum 2 + body_jntadr 3 + body_dofnum 2 + body_dofadr 5 + body_geomnum 1 + body_geomadr 2 + body_simple 0 + body_sameframe 0 + body_pos 0.3 0 0 + body_quat 1 0 0 0 + body_ipos 0.1 0 0 + body_iquat 1 0 0 0 + body_mass 0.67 + body_subtreemass 0.67 + body_inertia 0.00091 0.0014 0.0022 + body_invweight0 0.9 2.7e+02 + body_gravcomp 0 + body_plugin -1 + body_bvhadr 2 + body_bvhnum 1 BODY 4: name - parentid 0 - rootid 4 - weldid 4 - mocapid -1 - jntnum 1 - jntadr 5 - dofnum 6 - dofadr 7 - geomnum 1 - geomadr 3 - simple 1 - sameframe 1 - pos 0.5 0 0.1 - quat 1 0 0 0 - ipos 0 0 0 - iquat 1 0 0 0 - mass 3.1 - subtreemass 3.1 - inertia 0.014 0.014 0.0075 - invweight0 0.32 92 + body_parentid 0 + body_rootid 4 + body_weldid 4 + body_mocapid -1 + body_jntnum 1 + body_jntadr 5 + body_dofnum 6 + body_dofadr 7 + body_geomnum 1 + body_geomadr 3 + body_simple 1 + body_sameframe 1 + body_pos 0.3 0 0.1 + body_quat 1 0 0 0 + body_ipos 0 0 0 + body_iquat 1 0 0 0 + body_mass 3.1 + body_subtreemass 3.1 + body_inertia 0.014 0.014 0.0075 + body_invweight0 0.32 92 + body_gravcomp 0 + body_plugin -1 + body_bvhadr 3 + body_bvhnum 1 JOINT 0: name - type 1 - qposadr 0 - dofadr 0 - bodyid 1 - group 0 - limited 0 - pos 0 0 0.2 - axis 0 0 1 - stiffness 0 - range 0 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - margin 0 + jnt_type 1 + jnt_qposadr 0 + jnt_dofadr 0 + jnt_bodyid 1 + jnt_group 0 + jnt_limited 0 + jnt_solref 0.02 1 + jnt_solimp 0.9 0.95 0.001 0.5 2 + jnt_pos 0 0 0 + jnt_axis 0 0 1 + jnt_stiffness 0 + jnt_range 0 0 + jnt_margin 0 JOINT 1: name - type 3 - qposadr 4 - dofadr 3 - bodyid 2 - group 0 - limited 0 - pos -3.3e-17 0 0.15 - axis 0 1 0 - stiffness 0 - range 0 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - margin 0 + jnt_type 3 + jnt_qposadr 4 + jnt_dofadr 3 + jnt_bodyid 2 + jnt_group 0 + jnt_limited 0 + jnt_solref 0.02 1 + jnt_solimp 0.9 0.95 0.001 0.5 2 + jnt_pos 0 0 0 + jnt_axis 0 1 0 + jnt_stiffness 0 + jnt_range 0 0 + jnt_margin 0 JOINT 2: name - type 3 - qposadr 5 - dofadr 4 - bodyid 2 - group 0 - limited 0 - pos -3.3e-17 0 0.15 - axis 2.2e-16 0 -1 - stiffness 0 - range 0 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - margin 0 + jnt_type 3 + jnt_qposadr 5 + jnt_dofadr 4 + jnt_bodyid 2 + jnt_group 0 + jnt_limited 0 + jnt_solref 0.02 1 + jnt_solimp 0.9 0.95 0.001 0.5 2 + jnt_pos 0 0 0 + jnt_axis 1 0 0 + jnt_stiffness 0 + jnt_range 0 0 + jnt_margin 0 JOINT 3: name - type 3 - qposadr 6 - dofadr 5 - bodyid 3 - group 0 - limited 0 - pos -0.1 0 0 - axis 0 1 0 - stiffness 0 - range 0 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - margin 0 + jnt_type 3 + jnt_qposadr 6 + jnt_dofadr 5 + jnt_bodyid 3 + jnt_group 0 + jnt_limited 0 + jnt_solref 0.02 1 + jnt_solimp 0.9 0.95 0.001 0.5 2 + jnt_pos 0 0 0 + jnt_axis 0 1 0 + jnt_stiffness 0 + jnt_range 0 0 + jnt_margin 0 JOINT 4: name - type 3 - qposadr 7 - dofadr 6 - bodyid 3 - group 0 - limited 0 - pos -0.1 0 0 - axis 0 0 1 - stiffness 0 - range 0 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - margin 0 + jnt_type 3 + jnt_qposadr 7 + jnt_dofadr 6 + jnt_bodyid 3 + jnt_group 0 + jnt_limited 0 + jnt_solref 0.02 1 + jnt_solimp 0.9 0.95 0.001 0.5 2 + jnt_pos 0 0 0 + jnt_axis 0 0 1 + jnt_stiffness 0 + jnt_range 0 0 + jnt_margin 0 JOINT 5: name - type 0 - qposadr 8 - dofadr 7 - bodyid 4 - group 0 - limited 0 - pos 0 0 0 - axis 0 0 1 - stiffness 0 - range 0 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - margin 0 + jnt_type 0 + jnt_qposadr 8 + jnt_dofadr 7 + jnt_bodyid 4 + jnt_group 0 + jnt_limited 0 + jnt_solref 0.02 1 + jnt_solimp 0.9 0.95 0.001 0.5 2 + jnt_pos 0 0 0 + jnt_axis 0 0 1 + jnt_stiffness 0 + jnt_range 0 0 + jnt_margin 0 DOF 0: - bodyid 1 - jntid 0 - parentid -1 - Madr 0 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 7.3 - M0 0.69 + dof_bodyid 1 + dof_jntid 0 + dof_parentid -1 + dof_Madr 0 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 6.9 + dof_M0 0.72 DOF 1: - bodyid 1 - jntid 0 - parentid 0 - Madr 1 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 7.3 - M0 0.85 + dof_bodyid 1 + dof_jntid 0 + dof_parentid 0 + dof_Madr 1 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 6.9 + dof_M0 0.89 DOF 2: - bodyid 1 - jntid 0 - parentid 1 - Madr 3 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 7.3 - M0 0.17 + dof_bodyid 1 + dof_jntid 0 + dof_parentid 1 + dof_Madr 3 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 6.9 + dof_M0 0.18 DOF 3: - bodyid 2 - jntid 1 - parentid 2 - Madr 6 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 17 - M0 0.16 + dof_bodyid 2 + dof_jntid 1 + dof_parentid 2 + dof_Madr 6 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 16 + dof_M0 0.17 DOF 4: - bodyid 2 - jntid 2 - parentid 3 - Madr 10 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 4.4e+02 - M0 0.0023 + dof_bodyid 2 + dof_jntid 2 + dof_parentid 3 + dof_Madr 10 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 4.4e+02 + dof_M0 0.0023 DOF 5: - bodyid 3 - jntid 3 - parentid 4 - Madr 15 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 3.1e+02 - M0 0.0081 + dof_bodyid 3 + dof_jntid 3 + dof_parentid 4 + dof_Madr 15 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 3e+02 + dof_M0 0.0081 DOF 6: - bodyid 3 - jntid 4 - parentid 5 - Madr 21 - simplenum 0 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 2.5e+02 - M0 0.0089 + dof_bodyid 3 + dof_jntid 4 + dof_parentid 5 + dof_Madr 21 + dof_simplenum 0 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 2.5e+02 + dof_M0 0.0089 DOF 7: - bodyid 4 - jntid 5 - parentid -1 - Madr 28 - simplenum 6 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 0.32 - M0 3.1 + dof_bodyid 4 + dof_jntid 5 + dof_parentid -1 + dof_Madr 28 + dof_simplenum 6 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 0.32 + dof_M0 3.1 DOF 8: - bodyid 4 - jntid 5 - parentid 7 - Madr 29 - simplenum 5 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 0.32 - M0 3.1 + dof_bodyid 4 + dof_jntid 5 + dof_parentid 7 + dof_Madr 29 + dof_simplenum 5 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 0.32 + dof_M0 3.1 DOF 9: - bodyid 4 - jntid 5 - parentid 8 - Madr 31 - simplenum 4 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 0.32 - M0 3.1 + dof_bodyid 4 + dof_jntid 5 + dof_parentid 8 + dof_Madr 31 + dof_simplenum 4 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 0.32 + dof_M0 3.1 DOF 10: - bodyid 4 - jntid 5 - parentid 9 - Madr 34 - simplenum 3 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 92 - M0 0.014 + dof_bodyid 4 + dof_jntid 5 + dof_parentid 9 + dof_Madr 34 + dof_simplenum 3 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 92 + dof_M0 0.014 DOF 11: - bodyid 4 - jntid 5 - parentid 10 - Madr 38 - simplenum 2 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 92 - M0 0.014 + dof_bodyid 4 + dof_jntid 5 + dof_parentid 10 + dof_Madr 38 + dof_simplenum 2 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 92 + dof_M0 0.014 DOF 12: - bodyid 4 - jntid 5 - parentid 11 - Madr 43 - simplenum 1 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - frictionloss 0 - armature 0 - damping 0 - invweight0 92 - M0 0.0075 + dof_bodyid 4 + dof_jntid 5 + dof_parentid 11 + dof_Madr 43 + dof_simplenum 1 + dof_solref 0.02 1 + dof_solimp 0.9 0.95 0.001 0.5 2 + dof_frictionloss 0 + dof_armature 0 + dof_damping 0 + dof_invweight0 92 + dof_M0 0.0075 GEOM 0: name - type 3 - contype 1 - conaffinity 1 - condim 3 - bodyid 1 - dataid -1 - matid -1 - group 0 - priority 0 - sameframe 1 - solmix 1 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - size 0.06 0.2 0 - rbound 0.26 - pos 0 0 0 - quat 1 0 0 0 - friction 1 0.005 0.0001 - margin 0 - gap 0 - rgba 0.8 0.6 0.4 1 - + geom_type 3 + geom_contype 1 + geom_conaffinity 1 + geom_condim 3 + geom_bodyid 1 + geom_dataid -1 + geom_matid -1 + geom_group 0 + geom_priority 0 + geom_sameframe 2 + geom_solmix 1 + geom_solref 0.02 1 + geom_solimp 0.9 0.95 0.001 0.5 2 + geom_size 0.06 0.2 0 + geom_aabb 0 0 0 0.06 0.06 0.26 + geom_rbound 0.26 + geom_pos 0 0 -0.2 + geom_quat 1 0 0 0 + geom_friction 1 0.005 0.0001 + geom_margin 0 + geom_gap 0 + geom_fluid 0 0 0 0 0 0 0 0 0 0 0 0 + geom_rgba 0.8 0.6 0.4 1 GEOM 1: name - type 3 - contype 1 - conaffinity 1 - condim 3 - bodyid 2 - dataid -1 - matid -1 - group 0 - priority 0 - sameframe 1 - solmix 1 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - size 0.04 0.15 0 - rbound 0.19 - pos 0 0 0 - quat 1 0 0 0 - friction 1 0.005 0.0001 - margin 0 - gap 0 - rgba 0.8 0.6 0.4 1 - + geom_type 3 + geom_contype 1 + geom_conaffinity 1 + geom_condim 3 + geom_bodyid 2 + geom_dataid -1 + geom_matid -1 + geom_group 0 + geom_priority 0 + geom_sameframe 2 + geom_solmix 1 + geom_solref 0.02 1 + geom_solimp 0.9 0.95 0.001 0.5 2 + geom_size 0.04 0.15 0 + geom_aabb 0 0 0 0.04 0.04 0.19 + geom_rbound 0.19 + geom_pos 0.15 0 0 + geom_quat 0.71 0 -0.71 0 + geom_friction 1 0.005 0.0001 + geom_margin 0 + geom_gap 0 + geom_fluid 0 0 0 0 0 0 0 0 0 0 0 0 + geom_rgba 0.8 0.6 0.4 1 GEOM 2: name - type 4 - contype 1 - conaffinity 1 - condim 3 - bodyid 3 - dataid -1 - matid -1 - group 0 - priority 0 - sameframe 1 - solmix 1 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - size 0.1 0.08 0.02 - rbound 0.1 - pos 0 0 0 - quat 1 0 0 0 - friction 1 0.005 0.0001 - margin 0 - gap 0 - rgba 0.8 0.6 0.4 1 - + geom_type 4 + geom_contype 1 + geom_conaffinity 1 + geom_condim 3 + geom_bodyid 3 + geom_dataid -1 + geom_matid -1 + geom_group 0 + geom_priority 0 + geom_sameframe 2 + geom_solmix 1 + geom_solref 0.02 1 + geom_solimp 0.9 0.95 0.001 0.5 2 + geom_size 0.1 0.08 0.02 + geom_aabb 0 0 0 0.1 0.08 0.02 + geom_rbound 0.1 + geom_pos 0.1 0 0 + geom_quat 1 0 0 0 + geom_friction 1 0.005 0.0001 + geom_margin 0 + geom_gap 0 + geom_fluid 0 0 0 0 0 0 0 0 0 0 0 0 + geom_rgba 0.8 0.6 0.4 1 GEOM 3: name - type 5 - contype 1 - conaffinity 1 - condim 3 - bodyid 4 - dataid -1 - matid -1 - group 0 - priority 0 - sameframe 1 - solmix 1 - solref 0.02 1 - solimp 0.9 0.95 0.001 0.5 2 - size 0.07 0.1 0 - rbound 0.12 - pos 0 0 0 - quat 1 0 0 0 - friction 1 0.005 0.0001 - margin 0 - gap 0 - rgba 0.8 0.6 0.4 1 - + geom_type 5 + geom_contype 1 + geom_conaffinity 1 + geom_condim 3 + geom_bodyid 4 + geom_dataid -1 + geom_matid -1 + geom_group 0 + geom_priority 0 + geom_sameframe 1 + geom_solmix 1 + geom_solref 0.02 1 + geom_solimp 0.9 0.95 0.001 0.5 2 + geom_size 0.07 0.1 0 + geom_aabb 0 0 0 0.07 0.07 0.1 + geom_rbound 0.12 + geom_pos 0 0 0 + geom_quat 1 0 0 0 + geom_friction 1 0.005 0.0001 + geom_margin 0 + geom_gap 0 + geom_fluid 0 0 0 0 0 0 0 0 0 0 0 0 + geom_rgba 0.8 0.6 0.4 1 SITE 0: - name end1 - type 2 - bodyid 3 - matid -1 - group 0 - sameframe 0 - size 0.01 0.005 0.005 - pos 0.1 0 0 - quat 1 0 0 0 - rgba 0.5 0.5 0.5 1 - + name end1 + site_type 2 + site_bodyid 3 + site_matid -1 + site_group 0 + site_sameframe 0 + site_size 0.01 0.005 0.005 + site_pos 0.2 0 0 + site_quat 1 0 0 0 + site_rgba 0.5 0.5 0.5 1 SITE 1: - name end2 - type 2 - bodyid 4 - matid -1 - group 0 - sameframe 0 - size 0.01 0.005 0.005 - pos 0 0 0.1 - quat 1 0 0 0 - rgba 0.5 0.5 0.5 1 - + name end2 + site_type 2 + site_bodyid 4 + site_matid -1 + site_group 0 + site_sameframe 0 + site_size 0.01 0.005 0.005 + site_pos 0 0 0.1 + site_quat 1 0 0 0 + site_rgba 0.5 0.5 0.5 1 LIGHT 0: name - mode 0 - bodyid 0 - targetbodyid -1 - directional 0 - castshadow 1 - active 1 - pos 0 1 1 - dir 0 -0.71 -0.71 - poscom0 -0.19 1 0.45 - pos0 0 1 1 - dir0 0 -0.71 -0.71 - attenuation 1 0 0 - cutoff 45 - exponent 10 - ambient 0 0 0 - diffuse 1 1 1 - specular 0.3 0.3 0.3 + light_mode 0 + light_bodyid 0 + light_targetbodyid -1 + light_directional 0 + light_castshadow 1 + light_active 1 + light_pos 0 1 1 + light_dir 0 -0.71 -0.71 + light_poscom0 -0.13 1 0.44 + light_pos0 0 1 1 + light_dir0 0 -0.71 -0.71 + light_attenuation 1 0 0 + light_cutoff 45 + light_exponent 10 + light_ambient 0 0 0 + light_diffuse 1 1 1 + light_specular 0.3 0.3 0.3 TEXTURE 0: name - type 2 - height 1536 - width 256 - adr 0 + tex_type 2 + tex_height 1536 + tex_width 256 + tex_adr 0 TENDON 0: name - num 2 - limited 1 - matid -1 - group 0 - width 0.005 - solreflimit 0.02 1 - solimplimit 0.9 0.95 0.001 0.5 2 - solreffrctn 0.02 1 - solimpfrctn 0.9 0.95 0.001 0.5 2 - range 0 0.6 - margin 0 - stiffness 0 - damping 0 - frictionloss 0 - lengthspring 0.4 - length0 0.4 - invweight0 5.9 - rgba 0.5 0.5 0.5 1 - + tendon_adr 0 + tendon_num 2 + tendon_matid -1 + tendon_group 0 + tendon_limited 1 + tendon_width 0.005 + tendon_solref_lim 0.02 1 + tendon_solimp_lim 0.9 0.95 0.001 0.5 2 + tendon_solref_fri 0.02 1 + tendon_solimp_fri 0.9 0.95 0.001 0.5 2 + tendon_range 0 0.6 + tendon_margin 0 + tendon_stiffness 0 + tendon_damping 0 + tendon_frictionloss 0 + tendon_lengthspring 0.45 0.45 + tendon_length0 0.45 + tendon_invweight0 4.9 + tendon_rgba 0.5 0.5 0.5 1 path 3 0 0 3 1 0 diff --git a/doc/_static/example_saved.xml b/doc/_static/example_saved.xml index fab7d45b..bcfdc2bd 100644 --- a/doc/_static/example_saved.xml +++ b/doc/_static/example_saved.xml @@ -8,22 +8,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + diff --git a/doc/_static/tendon.xml b/doc/_static/tendon.xml index e96ad475..e333c6f1 100644 --- a/doc/_static/tendon.xml +++ b/doc/_static/tendon.xml @@ -1,72 +1,68 @@ - - + + - - - - - + + + - - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + diff --git a/doc/changelog.rst b/doc/changelog.rst index 04ce25e1..4aef61cc 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -8,12 +8,16 @@ Upcoming version (not yet released) General ^^^^^^^ +- Removed the "global" setting of the :ref:`compiler/coordinate` attribute. This rarely-used + setting complicates the compiler logic and is blocking future improvements. In order to convert older models which + used this option, load and save them in MuJoCo 2.3.3 or older. + .. image:: images/changelog/ellipsoidinertia.gif :align: right :width: 240px -- Added :ref:`ellipsoidinertia` to visualize equivalent inertias with ellipsoids instead - of the default boxes. +- Added :ref:`visual-global` flag :ref:`ellipsoidinertia` to visualize + equivalent body inertias with ellipsoids instead of the default boxes. - Added documentation for :ref:`engine plugins`. Bug fixes diff --git a/doc/modeling.rst b/doc/modeling.rst index a283cd53..4bf139c9 100644 --- a/doc/modeling.rst +++ b/doc/modeling.rst @@ -182,11 +182,11 @@ no class is specified in the present element but one or more of its ancestor bod childclass from the nearest ancestor body is used. If the present element specifies a class, that class is used regardless of any childclass attributes in its ancestor bodies. -Some attributes, such as body position in models defined in global coordinates, can be in a special undefined state. -This instructs the compiler to infer the corresponding value from other information, in this case the positions of the -geoms attached to the body. The undefined state cannot be entered in the XML file. Therefore once an attribute is -defined in a given class, it cannot be undefined in that class or in any of its child classes. So if the goal is to -leave a certain attribute undefined in a given model element, it must be undefined in the active defaults class. +Some attributes, such as body inertia, can be in a special undefined state. This instructs the compiler to infer the +corresponding value from other information, in this case the inertias of the geoms attached to the body. The undefined +state cannot be entered in the XML file. Therefore once an attribute is defined in a given class, it cannot be undefined +in that class or in any of its child classes. So if the goal is to leave a certain attribute undefined in a given model +element, it must be undefined in the active defaults class. A final twist here is actuators. They are different because some of the actuator-related elements are actually shortcuts, and shortcuts interact with the defaults setting mechanism in a non-obvious way. This is explained in the @@ -197,47 +197,12 @@ shortcuts, and shortcuts interact with the defaults setting mechanism in a non-o Coordinate frames ~~~~~~~~~~~~~~~~~ -After compilation the positions and orientations of all elements defined in the kinematic tree are expressed in local -coordinates, relative to the parent body for bodies, and relative to the body that owns the element for geoms, joints, -sites, cameras and lights. Consequently, when a compiled model is saved as MJCF, the coordinates are always local. -However when the user writes an MJCF file, the coordinates can be either local or global, as specified by the -:at:`coordinate` attribute of :ref:`compiler `. This setting applies to all position and -orientation data in the MJCF file. A related attribute is :at:`angle`. It specifies whether all angles in the MJCF -file are expressed in degrees or radians (after compilation angles are always expressed in radians). Awareness of -these global settings is essential when constructing new models. +The positions and orientations of all elements defined in the kinematic tree are expressed in local coordinates, +relative to the parent body for bodies, and relative to the body that owns the element for geoms, joints, sites, cameras +and lights. -Global coordinates can sometimes be more intuitive and have the added benefit that body positions and orientations can -be omitted. In that case the body frame is set to the body inertial frame, which can itself be omitted and inferred -from the geom masses and inertias. When an MJCF model is defined in local coordinates on the other hand, the user must -specify the positions and orientations of the body frames explicitly. This is because if they were omitted, and the -elements inside the body were specified in local coordinates relative to the body frame, there would be no way to -infer the body frame. - -Here is an example of an MJCF fragment in global coordinates: - -.. code-block:: xml - - - - - -When this model is compiled and saved as MJCF (in local coordinates) the same fragment becomes: - -.. code-block:: xml - - - - - - -The body position was set to the geom position (1 0 0), while the geom and inertial positions were set to (0 0 0) -relative to the body. - -In principle the user always has a choice between local and global coordinates, but in practice this choice is viable -only when using geometric primitives rather than meshes. For meshes, the 3D vertex positions are expressed in either -local or global coordinates depending on how the mesh was designed - effectively forcing the user to adopt the same -convention for the entire model. The alternative would be to pre-process the mesh data outside MuJoCo so as to change -coordinates, but that effort is rarely justified. +A related attribute is :ref:`compiler/angle`. It specifies whether angles in the MJCF file are expressed +in degrees or radians (after compilation, angles are always expressed in radians). .. _COrientation: diff --git a/doc/overview.rst b/doc/overview.rst index edc44d7d..de6f5369 100644 --- a/doc/overview.rst +++ b/doc/overview.rst @@ -244,8 +244,6 @@ Next we provide a more elaborate example illustrating several features of MJCF. .. code:: xml - - @@ -256,25 +254,26 @@ Next we provide a more elaborate example illustrating several features of MJCF. - - - - - - - - - - - - + + + + + + + + + + + + - - - + + + + diff --git a/src/user/user_composite.cc b/src/user/user_composite.cc index f1d44915..8b6aea97 100644 --- a/src/user/user_composite.cc +++ b/src/user/user_composite.cc @@ -213,11 +213,6 @@ void mjCComposite::SetDefault(void) { // make composite object bool mjCComposite::Make(mjCModel* model, mjCBody* body, char* error, int error_sz) { - // require local coordinates - if (model->global) { - return comperr(error, "Composite requires local coordinates", error_sz); - } - // check geom type if ((def[0].geom.type!=mjGEOM_SPHERE && def[0].geom.type!=mjGEOM_CAPSULE && diff --git a/src/user/user_model.cc b/src/user/user_model.cc index e129775a..45ac66ad 100644 --- a/src/user/user_model.cc +++ b/src/user/user_model.cc @@ -89,7 +89,6 @@ mjCModel::mjCModel() { balanceinertia = false; strippath = false; fitaabb = false; - global = false; degree = true; euler[0] = 'x'; euler[1] = 'y'; diff --git a/src/user/user_model.h b/src/user/user_model.h index afe3a08e..bad9292c 100644 --- a/src/user/user_model.h +++ b/src/user/user_model.h @@ -123,7 +123,6 @@ class mjCModel { bool balanceinertia; // automatically impose A + B >= C rule bool strippath; // automatically strip paths from mesh files bool fitaabb; // meshfit to aabb instead of inertia box - bool global; // local or global coordinates bool degree; // angles in radians or degrees char euler[3]; // sequence for euler rotations std::string meshdir; // mesh and hfield directory diff --git a/src/user/user_objects.cc b/src/user/user_objects.cc index 1bd47445..46290d36 100644 --- a/src/user/user_objects.cc +++ b/src/user/user_objects.cc @@ -649,17 +649,8 @@ void mjCBody::GeomFrame(void) { // setup child local frame: pos void mjCBody::MakeLocal(double* _locpos, double* _locquat, const double* _pos, const double* _quat) { - // global: transform to local - if (model->global) { - mjuu_localpos(_locpos, _pos, pos, quat); - mjuu_localquat(_locquat, _quat, quat); - } - - // local: copy - else { - mjuu_copyvec(_locpos, _pos, 3); - mjuu_copyvec(_locquat, _quat, 4); - } + mjuu_copyvec(_locpos, _pos, 3); + mjuu_copyvec(_locquat, _quat, 4); } // set explicitinertial to true @@ -825,9 +816,9 @@ void mjCBody::Compile(void) { } userdata.resize(model->nuser_body); - // pos defaults to (0,0,0) in local coordinates - if (!mjuu_defined(pos[0]) && !model->global) { - mjuu_setvec(pos, 0, 0, 0); + // pos defaults to (0,0,0) + if (!mjuu_defined(pos[0])) { + mjuu_setvec(pos, 0, 0, 0); } // normalize user-defined quaternions @@ -1112,12 +1103,8 @@ int mjCJoint::Compile(void) { mjuu_zerovec(locpos, 3); } - // compute local axis relative to specified body - if (model->global) { - mjuu_localaxis(locaxis, axis, body->quat); - } else { - mjuu_copyvec(locaxis, axis, 3); - } + // copy axis to local + mjuu_copyvec(locaxis, axis, 3); // convert reference angles to radians for hinge joints if (type==mjJNT_HINGE && model->degree) { @@ -1930,14 +1917,8 @@ void mjCLight::Compile(void) { // ask parent body to compute our local pos and quat relative to itself body->MakeLocal(locpos, locquat, pos, quat); - // copy/convert dir to local frame - if (model->global) { - double mat[9], q[4] = {locquat[0], -locquat[1], -locquat[2], -locquat[3]}; - mjuu_quat2mat(mat, q); - mjuu_mulvecmat(locdir, dir, mat); - } else { - mjuu_copyvec(locdir, dir, 3); - } + // copy dir to local frame + mjuu_copyvec(locdir, dir, 3); // get targetbodyid if (!targetbody.empty()) { diff --git a/src/xml/xml_native_reader.cc b/src/xml/xml_native_reader.cc index f2ea6c06..701b7423 100644 --- a/src/xml/xml_native_reader.cc +++ b/src/xml/xml_native_reader.cc @@ -863,7 +863,10 @@ void mjXReader::Compiler(XMLElement* section, mjCModel* mod) { mod->fitaabb = (n==1); } if (MapValue(section, "coordinate", &n, coordinate_map, 2)) { - mod->global = (n==1); + if (n==1) { + throw mjXError(section, "global coordinates no longer supported. To convert existing models, " + "load and save them in MuJoCo 2.3.3 or older"); + } } if (MapValue(section, "angle", &n, angle_map, 2)) { mod->degree = (n==1); diff --git a/src/xml/xml_urdf.cc b/src/xml/xml_urdf.cc index b9969097..2cbe18a2 100644 --- a/src/xml/xml_urdf.cc +++ b/src/xml/xml_urdf.cc @@ -99,7 +99,6 @@ void mjXURDF::Parse(XMLElement* root) { } // enforce required compiler defaults for URDF - model->global = false; model->degree = false; // get model name