Exemple #1
0
 /// <summary>
 /// Apply a Push or Pop Action.
 /// </summary>
 /// <param name="action"></param>
 /// <returns></returns>
 public bool ApplyAction(ActionPushPop action)
 {
     if (action.push)
     {
         return(this.settingsBuffer.Push(this));
     }
     else
     {
         Settings s = settingsBuffer.Pop(this);
         if (s != null)
         {
             this.acceleration      = s.Acceleration;
             this.speed             = s.Speed;
             this.rotationSpeed     = s.RotationSpeed;
             this.jointSpeed        = s.JointSpeed;
             this.jointAcceleration = s.JointAcceleration;
             this.precision         = s.Precision;
             this.motionType        = s.MotionType;
             this.referenceCS       = s.RefCS;
             this.extrusionRate     = s.ExtrusionRate;
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
        /// <summary>
        /// Minimum information necessary to initialize a robot object.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        /// <param name="joints"></param>
        /// <returns></returns>
        public bool Initialize(Vector position, Rotation rotation, Joints joints,
                               double speed, double acceleration, double rotationSpeed, double jointSpeed, double jointAcceleration,
                               double precision, MotionType mType, ReferenceCS refCS)
        {
            if (position != null)
            {
                this.position     = new Vector(position);
                this.prevPosition = new Vector(position);
            }
            if (rotation != null)
            {
                this.rotation     = new Rotation(rotation);
                this.prevRotation = new Rotation(rotation);
            }
            if (joints != null)
            {
                this.joints     = new Joints(joints);
                this.prevJoints = new Joints(joints);
            }
            this.acceleration      = acceleration;
            this.speed             = speed;
            this.rotationSpeed     = rotationSpeed;
            this.jointSpeed        = jointSpeed;
            this.jointAcceleration = jointAcceleration;
            this.precision         = precision;
            this.motionType        = mType;
            this.referenceCS       = refCS;

            this.initialized = true;
            return(this.initialized);
        }
Exemple #3
0
        /// <summary>
        /// Minimum information necessary to initialize a robot object.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        /// <param name="joints"></param>
        /// <returns></returns>
        public bool Initialize(Vector position, Rotation rotation, Joints joints,
                               double speed, double acceleration, double rotationSpeed, double jointSpeed, double jointAcceleration,
                               double precision, MotionType mType, ReferenceCS refCS)
        {
            if (position != null)
            {
                this.position     = new Vector(position);
                this.prevPosition = new Vector(position);
            }
            if (rotation != null)
            {
                this.rotation     = new Rotation(rotation);
                this.prevRotation = new Rotation(rotation);
            }
            if (joints != null)
            {
                this.joints     = new Joints(joints);
                this.prevJoints = new Joints(joints);
            }
            this.acceleration      = acceleration;
            this.speed             = speed;
            this.rotationSpeed     = rotationSpeed;
            this.jointSpeed        = jointSpeed;
            this.jointAcceleration = jointAcceleration;
            this.precision         = precision;
            this.motionType        = mType;
            this.referenceCS       = refCS;

            this.externalAxes = new double?[] { null, null, null, null, null, null };  // @TODO: should this be passed as an argument?

            this.initialized = true;
            return(this.initialized);
        }
Exemple #4
0
 public Settings(double speed, double acc, double precision, MotionType mType, ReferenceCS refcs, double extrusionRate)
 {
     this.Speed         = speed;
     this.Acceleration  = acc;
     this.Precision     = precision;
     this.MotionType    = mType;
     this.RefCS         = refcs;
     this.ExtrusionRate = extrusionRate;
 }
Exemple #5
0
        /// <summary>
        /// Minimum information necessary to initialize a robot object.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        /// <param name="joints"></param>
        /// <returns></returns>
        public bool Initialize(Vector position, Rotation rotation, Joints joints, ExternalAxes extAx,
                               double speed, double acceleration, double precision, MotionType mType, ReferenceCS refCS)
        {
            if (position != null)
            {
                this.position     = new Vector(position);
                this.prevPosition = new Vector(position);
            }
            if (rotation != null)
            {
                this.rotation     = new Rotation(rotation);
                this.prevRotation = new Rotation(rotation);
            }
            if (joints != null)
            {
                this.axes     = new Joints(joints);
                this.prevAxes = new Joints(joints);
            }
            if (extAx != null)
            {
                // @TODO split this definition
                this.externalAxesCartesian = new ExternalAxes(extAx);
                this.externalAxesJoints    = new ExternalAxes(extAx);
            }

            this.acceleration = acceleration;
            this.speed        = speed;
            this.precision    = precision;
            this.motionType   = mType;
            this.referenceCS  = refCS;

            this.availableTools = new Dictionary <string, Tool>();

            // Add a "noTool" default object and make it the default.
            //this.availableTools["noTool"] = Tool.Create("noTool", 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.001, 0, 0, 0);
            //this.tool = this.availableTools["noTool"];

            this.tool = null;  // reverted back to default `null` tool...

            this.digitalOutputs = new Dictionary <string, bool>();
            this.analogOutputs  = new Dictionary <string, double>();


            // Initialize temps to zero
            this.partTemperature = new Dictionary <RobotPartType, double>();
            foreach (RobotPartType part in Enum.GetValues(typeof(RobotPartType)))
            {
                partTemperature[part] = 0;
            }
            isExtruding    = false;
            extrusionRate  = 0;
            extrudedLength = 0;

            this.initialized = true;
            return(this.initialized);
        }
Exemple #6
0
        ///// <summary>
        ///// If there was a running Communication protocol, drop it and restart it again.
        ///// </summary>
        ///// <returns></returns>
        //private bool ResetCommunication()
        //{
        //    if (_driver == null)
        //    {
        //        Console.WriteLine("Communication protocol not established, please initialize first.");
        //    }
        //    DropCommunication();
        //    return InitializeCommunication();
        //}

        /// <summary>
        /// Initializes all instances of robotCursors with base information
        /// </summary>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        /// <param name="joints"></param>
        /// <returns></returns>
        internal bool InitializeRobotCursors(Point position    = null, Rotation rotation           = null, Joints joints = null,
                                             double speed      = Control.DEFAULT_SPEED, double acc = Control.DEFAULT_ACCELERATION, double rotationSpeed = Control.DEFAULT_ROTATION_SPEED,
                                             double jointSpeed = Control.DEFAULT_JOINT_SPEED, double jointAcceleration = Control.DEFAULT_JOINT_ACCELERATION,
                                             double precision  = Control.DEFAULT_PRECISION,
                                             MotionType mType  = Control.DEFAULT_MOTION_TYPE, ReferenceCS refCS = Control.DEFAULT_REFCS)

        {
            bool success = true;

            success &= virtualCursor.Initialize(position, rotation, joints, speed, acc, jointSpeed, jointAcceleration, rotationSpeed, precision, mType, refCS);
            success &= writeCursor.Initialize(position, rotation, joints, speed, acc, jointSpeed, jointAcceleration, rotationSpeed, precision, mType, refCS);
            success &= motionCursor.Initialize(position, rotation, joints, speed, acc, jointSpeed, jointAcceleration, rotationSpeed, precision, mType, refCS);

            _areCursorsInitialized = success;

            return(success);
        }
Exemple #7
0
 public bool IssueCoordinatesRequest(ReferenceCS referenceCS) =>
 IssueApplyActionRequest(new ActionCoordinates(referenceCS));
Exemple #8
0
        /// <summary>
        /// Apply ReferenceCS Action.
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public bool ApplyAction(ActionCoordinates action)
        {
            this.referenceCS = action.referenceCS;

            return(true);
        }
Exemple #9
0
        ///// <summary>
        ///// If there was a running Communication protocol, drop it and restart it again.
        ///// </summary>
        ///// <returns></returns>
        //private bool ResetCommunication()
        //{
        //    if (_driver == null)
        //    {
        //        Console.WriteLine("Communication protocol not established, please initialize first.");
        //    }
        //    DropCommunication();
        //    return InitializeCommunication();
        //}

        /// <summary>
        /// Initializes all instances of robotCursors with base information
        /// </summary>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        /// <param name="joints"></param>
        /// <returns></returns>
        internal bool InitializeRobotCursors(Point position   = null, Rotation rotation           = null, Joints joints = null, ExternalAxes extAx = null,
                                             double speed     = Control.DEFAULT_SPEED, double acc = Control.DEFAULT_ACCELERATION, double precision = Control.DEFAULT_PRECISION,
                                             MotionType mType = Control.DEFAULT_MOTION_TYPE, ReferenceCS refCS = Control.DEFAULT_REFCS)

        {
            bool success = true;

            success &= IssueCursor.Initialize(position, rotation, joints, extAx, speed, acc, precision, mType, refCS);
            success &= ReleaseCursor.Initialize(position, rotation, joints, extAx, speed, acc, precision, mType, refCS);
            success &= ExecutionCursor.Initialize(position, rotation, joints, extAx, speed, acc, precision, mType, refCS);

            _areCursorsInitialized = success;

            return(success);
        }
Exemple #10
0
        public ActionCoordinates(ReferenceCS referenceCS) : base()
        {
            this.type = ActionType.Coordinates;

            this.referenceCS = referenceCS;
        }
Exemple #11
0
 public static ActionCoordinates Coordinates(ReferenceCS referenceCS)
 {
     return(new ActionCoordinates(referenceCS));
 }
Exemple #12
0
 public ActionCoordinates(ReferenceCS referenceCS) : base()
 {
     this.referenceCS = referenceCS;
 }