public void Read(out string name, out float position, out float velocity, out float effort)
 {
     name     = urdfJoint.JointName;
     position = urdfJoint.GetPosition();
     velocity = urdfJoint.GetVelocity();
     effort   = urdfJoint.GetEffort();
 }
Esempio n. 2
0
        public void Read(out string name, out float position, out float velocity, out float effort)
        {
            name = urdfJoint.JointName;
            if (_robotJoint.GetJointType() == "prismatic")
            {
                position = urdfJoint.GetPosition() + _robotJoint.offset;
            }
            else
            {
                position = urdfJoint.GetPosition();
                float robotJointPosition = -(_robotJoint.GetPosition()) * Mathf.Deg2Rad;
                if (position - robotJointPosition > Mathf.PI)
                {
                    while (position - robotJointPosition > Mathf.PI)
                    {
                        position -= 2 * Mathf.PI;
                    }
                }
                else if (position - robotJointPosition < -Mathf.PI)
                {
                    while (position - robotJointPosition < -Mathf.PI)
                    {
                        position += 2 * Mathf.PI;
                    }
                }
                position += _robotJoint.offset * Mathf.Deg2Rad;
            }

            velocity = urdfJoint.GetVelocity();
            effort   = urdfJoint.GetEffort();
        }
        public void Read(out string name, out float position, out float velocity, out float effort)
        {
            name = urdfJoint.JointName;
            if (_robot_joint.getJointType() == "prismatic")
            {
                position = urdfJoint.GetPosition() + _robot_joint.offset;
            }
            else
            {
                position = urdfJoint.GetPosition() + _robot_joint.offset * Mathf.Deg2Rad;
            }

            velocity = urdfJoint.GetVelocity();
            effort   = urdfJoint.GetEffort();
        }
Esempio n. 4
0
 public void Read(out string name, out float position, out float velocity, out float effort)
 {
     name     = urdfJoint.JointName;
     position = urdfJoint.GetPosition();
     velocity = urdfJoint.GetVelocity();
     // Only ask for command effort from ROS if JointCommandWriter is an attached component and if it is currently writer commands
     if (haveCommandWriter && jointCommandWriter.isWritingCommands)
     {
         effort = urdfJoint.GetCmdEffort();
     }
     else
     {
         effort = urdfJoint.GetEffort();
     }
 }
        public void GetPositionVelocityEffort_Succeeds()
        {
            GameObject baseObject = new GameObject("base");
            GameObject linkObject = new GameObject("link");

            linkObject.transform.parent = baseObject.transform;

            UrdfJoint.Create(baseObject, UrdfJoint.JointTypes.Fixed);
            UrdfJoint        joint            = UrdfJointPrismatic.Create(linkObject);
            ArticulationBody articulationBody = linkObject.GetComponent <ArticulationBody>();

            articulationBody.jointPosition = new ArticulationReducedSpace(1, 2, 3);
            articulationBody.jointVelocity = new ArticulationReducedSpace(4, 5, 6);
            articulationBody.jointForce    = new ArticulationReducedSpace(7, 8, 9);

            Assert.AreEqual(1, joint.GetPosition());
            Assert.AreEqual(4, joint.GetVelocity());
            Assert.AreEqual(7, joint.GetEffort());

            Object.DestroyImmediate(baseObject);
        }