Пример #1
0
        public void CalculateG1ToG2Offset(TeachPos selectedTeachPos)
        {
            double XPos = Convert.ToDouble(
                XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.XPos));
            double YPos = Convert.ToDouble(
                XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.YPos));
            double APos = Convert.ToDouble(
                XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.APos));

            double xOffset = Motion.GetPositionX() - XPos;
            double yOffset = Motion.GetPosition(Motion.MotorY) - YPos;
            double aOffset = Steppers.GetPosition(RackGripper.Two) - APos;

            if (Math.Abs(xOffset) > 5 | Math.Abs(yOffset) > 5 | Math.Abs(aOffset) > 5)
            {
                throw new Exception("CalculateG1ToG2Offset offset over 5.");
            }

            XmlReaderWriter.SetTeachAttribute(Files.RackData, TeachPos.G1ToG2Offset, PosItem.XPos,
                                              xOffset.ToString(CultureInfo.CurrentCulture));
            XmlReaderWriter.SetTeachAttribute(Files.RackData, TeachPos.G1ToG2Offset, PosItem.YPos,
                                              yOffset.ToString(CultureInfo.CurrentCulture));
            XmlReaderWriter.SetTeachAttribute(Files.RackData, TeachPos.G1ToG2Offset, PosItem.APos,
                                              aOffset.ToString(CultureInfo.CurrentCulture));
        }
Пример #2
0
        public void SaveTeachPosition(TeachPos selectedTeachPos)
        {
            TargetPosition target = new TargetPosition()
            {
                XPos = Motion.GetPositionX(),
                YPos = Motion.GetPosition(Motion.MotorY),
                ZPos = Motion.GetPosition(Motion.MotorZ),
                RPos = Motion.GetPosition(Motion.MotorR),
                APos = Steppers.GetPosition(RackGripper.One)
            };

            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.XPos,
                                              target.XPos.ToString());
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.YPos,
                                              target.YPos.ToString());
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.ZPos,
                                              target.ZPos.ToString());
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.RPos,
                                              target.RPos.ToString());

            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.APos,
                                              target.APos.ToString());

            if (XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.XPos) !=
                target.XPos.ToString())
            {
                throw new Exception("SaveTeachPosition fail.");
            }

            if (XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.YPos) !=
                target.YPos.ToString())
            {
                throw new Exception("SaveTeachPosition fail.");
            }

            if (XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.ZPos) !=
                target.ZPos.ToString())
            {
                throw new Exception("SaveTeachPosition fail.");
            }

            if (XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.RPos) !=
                target.RPos.ToString())
            {
                throw new Exception("SaveTeachPosition fail.");
            }

            if (XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.APos) !=
                target.APos.ToString())
            {
                throw new Exception("SaveTeachPosition fail.");
            }
        }
Пример #3
0
        public void SaveApproachHeight(TeachPos selectedTeachPos)
        {
            double zPos = Convert.ToDouble(XmlReaderWriter.GetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.ZPos));

            if (Motion.GetPosition(Motion.MotorZ) < zPos + 30)
            {
                throw new Exception("Approach is less than ZPos + 30.");
            }

            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.ApproachHeight,
                                              Motion.GetPosition(Motion.MotorZ).ToString(CultureInfo.CurrentCulture));
        }
Пример #4
0
        public void SaveTeachPosition(TeachPos selectedTeachPos)
        {
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.XPos,
                                              _motion.GetPositionX().ToString());
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.YPos,
                                              _motion.GetPosition(_motion.MotorY).ToString());
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.ZPos,
                                              _motion.GetPosition(_motion.MotorZ).ToString());
            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.RPos,
                                              _motion.GetPosition(_motion.MotorR).ToString());

            XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.APos,
                                              _motion.GetPosition(_motion.MotorR) > 0
                    ? _gripper.GetPosition(Gripper.One).ToString()
                    : _gripper.GetPosition(Gripper.Two).ToString());
        }
Пример #5
0
 public void SaveApproachHeight(TeachPos selectedTeachPos)
 {
     XmlReaderWriter.SetTeachAttribute(Files.RackData, selectedTeachPos, PosItem.ApproachHeight,
                                       _motion.GetPosition(_motion.MotorZ).ToString());
 }