Exemplo n.º 1
0
        private static UrdfJoint AddCorrectJointType(GameObject linkObject, JointTypes jointType)
        {
            UrdfJoint urdfJoint = null;

            switch (jointType)
            {
                case JointTypes.Fixed:
                    urdfJoint = UrdfJointFixed.Create(linkObject);
                    break;
                case JointTypes.Continuous:
                    urdfJoint = UrdfJointContinuous.Create(linkObject);
                    break;
                case JointTypes.Revolute:
                    urdfJoint = UrdfJointRevolute.Create(linkObject);
                    break;
                case JointTypes.Floating:
                    urdfJoint = UrdfJointFloating.Create(linkObject);
                    break;
                case JointTypes.Prismatic:
                    urdfJoint = UrdfJointPrismatic.Create(linkObject);
                    break;
                case JointTypes.Planar:
                    urdfJoint = UrdfJointPlanar.Create(linkObject);
                    break;
            }

            UnityEngine.Joint unityJoint = linkObject.GetComponent<UnityEngine.Joint>();
            unityJoint.connectedBody = linkObject.transform.parent.gameObject.GetComponent<Rigidbody>();
            unityJoint.autoConfigureConnectedAnchor = true;

            return urdfJoint;
        }
Exemplo n.º 2
0
        public static UrdfJoint Create(GameObject linkObject)
        {
            UrdfJointFloating urdfJoint = linkObject.AddComponent <UrdfJointFloating>();

            urdfJoint.UnityJoint = linkObject.AddComponent <ConfigurableJoint>();

            return(urdfJoint);
        }
        public static UrdfJoint Create(GameObject linkObject)
        {
            UrdfJointFloating urdfJoint = linkObject.AddComponent <UrdfJointFloating>();

            #if UNITY_2020_1_OR_NEWER
            urdfJoint.unityJoint = linkObject.AddComponent <ArticulationBody>();
            //Doesnt have any equivalent Articulatiob Joint
            #else
            urdfJoint.UnityJoint = linkObject.AddComponent <ConfigurableJoint>();
            #endif
            return(urdfJoint);
        }
Exemplo n.º 4
0
        private static UrdfJoint AddCorrectJointType(GameObject linkObject, JointTypes jointType)
        {
            UrdfJoint urdfJoint = null;

            switch (jointType)
            {
            case JointTypes.Fixed:
                urdfJoint = UrdfJointFixed.Synchronize(linkObject);
                break;

            case JointTypes.Continuous:
                urdfJoint = UrdfJointContinuous.Synchronize(linkObject);
                break;

            case JointTypes.Revolute:
                urdfJoint = UrdfJointRevolute.Synchronize(linkObject);
                break;

            case JointTypes.Floating:
                urdfJoint = UrdfJointFloating.Synchronize(linkObject);
                break;

            case JointTypes.Prismatic:
                urdfJoint = UrdfJointPrismatic.Synchronize(linkObject);
                break;

            case JointTypes.Planar:
                urdfJoint = UrdfJointPlanar.Synchronize(linkObject);
                break;
            }
            //SynchTodo: This assignment probably does not break stuff, but is not necessary.
            UnityEngine.Joint unityJoint = linkObject.GetComponent <UnityEngine.Joint>();
            unityJoint.connectedBody = linkObject.transform.parent.gameObject.GetComponent <Rigidbody>();
            unityJoint.autoConfigureConnectedAnchor = true;

            return(urdfJoint);
        }