Skip to content

ValueError: top-level default class 'main' cannot be renamed when using <include> with <default> block #2

@srinjoy-not-007

Description

@srinjoy-not-007

When loading an MJCF file that uses , MuJoCo throws the following error:

model = mujoco.MjModel.from_xml_path("rover4We-field.xml")
ValueError: XML Error: top-level default class 'main' cannot be renamed
Element 'default', line 0

This happens due to this section in rover4We-only.xml:

<default>
	<!--making every geom collidable. expect those that dont are default-->
	<geom contype="1" conaffinity="1"/>
</default>

<default class="acker_solver_param">
	<!--solver impedance and reference(?) for ackerman equality constraint-->
	<!--default solimp: "0.900 0.950 0.001"-->
	<!--default solref: "0.020 1.000"-->
	<!--solref: (timeconst, dampratio)
		b = 2 / (dmax * timeconst)
		k = d(r) / (dmax * dmax * timeconst * timeconst * dampratio * dampratio)
	-->
	<equality solimp="0.9950 0.9990 0.0001" solref="0.0100 0.7500"/>
</default>

There is an error in the placement of the top default tag. The default tag with the acker_solver_param class should be contained within the top default tag. The correction that worked for me is:

 <default>
	<!--making every geom collidable. expect those that dont are default-->
	<geom contype="1" conaffinity="1"/>


	<default class="acker_solver_param">
		<!--solver impedance and reference(?) for ackerman equality constraint-->
		<!--default solimp: "0.900 0.950 0.001"-->
		<!--default solref: "0.020 1.000"-->
		<!--solref: (timeconst, dampratio)
			b = 2 / (dmax * timeconst)
			k = d(r) / (dmax * dmax * timeconst * timeconst * dampratio * dampratio)
		-->
		<equality solimp="0.9950 0.9990 0.0001" solref="0.0100 0.7500"/>
	</default>
</default>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions