public static void Create() { CreateTag(); GameObject robotGameObject = new GameObject("Robot"); SetTag(robotGameObject); robotGameObject.AddComponent <UrdfRobot>(); robotGameObject.AddComponent <Unity.Robotics.UrdfImporter.Control.Controller>(); UrdfPlugins.Create(robotGameObject.transform); UrdfLink urdfLink = UrdfLinkExtensions.Create(robotGameObject.transform).GetComponent <UrdfLink>(); urdfLink.name = "base_link"; urdfLink.IsBaseLink = true; }
// Creates the stack of robot joints. Should be called iteratively until false is returned. private static bool ProcessJointStack(ImportPipelineData im) { if (im.importStack == null) { im.importStack = new Stack <Tuple <Link, Transform, Joint> >(); im.importStack.Push(new Tuple <Link, Transform, Joint>(im.robot.root, im.robotGameObject.transform, null)); } if (im.importStack.Count != 0) { Tuple <Link, Transform, Joint> currentLink = im.importStack.Pop(); GameObject importedLink = UrdfLinkExtensions.Create(currentLink.Item2, currentLink.Item1, currentLink.Item3); im.settings.linksLoaded++; foreach (Joint childJoint in currentLink.Item1.joints) { Link child = childJoint.ChildLink; im.importStack.Push(new Tuple <Link, Transform, Joint>(child, importedLink.transform, childJoint)); } return(true); } return(false); }