コード例 #1
0
ファイル: UrdfJoint.cs プロジェクト: cmkuo12/MTC-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;
        }
コード例 #2
0
        public static UrdfJoint Create(GameObject linkObject)
        {
            UrdfJointContinuous urdfJoint = linkObject.AddComponent <UrdfJointContinuous>();

            urdfJoint.UnityJoint = linkObject.AddComponent <HingeJoint>();
            urdfJoint.UnityJoint.autoConfigureConnectedAnchor = true;

            return(urdfJoint);
        }
コード例 #3
0
        public static UrdfJoint Create(GameObject linkObject)
        {
            UrdfJointContinuous urdfJoint = linkObject.AddComponent <UrdfJointContinuous>();

            urdfJoint._jointType = JointTypes.Continuous;
            urdfJoint.UnityJoint = linkObject.AddComponent <HingeJoint>();
            urdfJoint.UnityJoint.autoConfigureConnectedAnchor = true;
            linkObject.AddComponent <HingeJointAngleCalculator>();

            return(urdfJoint);
        }
コード例 #4
0
        public static UrdfJoint Create(GameObject linkObject)
        {
            UrdfJointContinuous urdfJoint = linkObject.AddComponent <UrdfJointContinuous>();

            urdfJoint._jointType = JointTypes.Continuous;
            urdfJoint.UnityJoint = linkObject.AddComponent <HingeJoint>();
            urdfJoint.UnityJoint.autoConfigureConnectedAnchor = true;
            // add custom angle calculation
            linkObject.AddComponent <CorrectHingeAngle>();

            return(urdfJoint);
        }
コード例 #5
0
        public static UrdfJoint Create(GameObject linkObject)
        {
            UrdfJointContinuous urdfJoint = linkObject.AddComponent <UrdfJointContinuous>();

#if UNITY_2020_1_OR_NEWER
            urdfJoint.unityJoint           = linkObject.GetComponent <ArticulationBody>();
            urdfJoint.unityJoint.jointType = ArticulationJointType.RevoluteJoint;
#else
            urdfJoint.unityJoint = linkObject.AddComponent <HingeJoint>();
            urdfJoint.unityJoint.autoConfigureConnectedAnchor = true;
#endif
            return(urdfJoint);
        }
コード例 #6
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);
        }