Add user sensor bindings.

Stop force-setting nusersensor, instead allow MuJoCo to infer the size.

PiperOrigin-RevId: 494783883
Change-Id: Ia2a1b1803b2904f2dded7b790d01eb6f1920dbaf
This commit is contained in:
Tom Erez
2022-12-12 11:42:00 -08:00
committed by Copybara-Service
parent 7a248a8bde
commit 21f10ce1b6
6 changed files with 99 additions and 16 deletions
+10 -5
View File
@@ -401,12 +401,17 @@ public class MjScene : MonoBehaviour {
MjRoot.AppendChild(GenerateMjcfSection(
doc, components.Where(component => component is MjBaseConstraint), "equality"));
MjRoot.AppendChild(GenerateMjcfSection(
doc, components.Where(component => component is MjActuator), "actuator"));
MjRoot.AppendChild(GenerateMjcfSection(
doc, components.Where(component => component is MjBaseSensor), "sensor"));
MjRoot.AppendChild(
GenerateMjcfSection(doc,
components.Where(component => component is MjActuator)
.OrderBy(component => component.transform.GetSiblingIndex()),
"actuator"));
MjRoot.AppendChild(
GenerateMjcfSection(doc,
components.Where(component => component is MjBaseSensor)
.OrderBy(component => component.transform.GetSiblingIndex()),
"sensor"));
// Generate the Mjcf of the runtime dependencies added to the context.
_generationContext.GenerateMjcf(MjRoot);
return doc;