Exemplo n.º 1
0
        public void Move(string command)
        {
            var commands = CommandParser.Parse(command);
            var code = 0;

            foreach (var c in commands)
            {

                Joint joint = null;
                this.JointCommands.TryGetValue(c.Item1, out joint);

                if (joint == null)
                    return; //error, the code should return a joint

                if (c.Item2 == 1)
                {
                    if (joint.MoveUp(Miliseconds)) code = code + CommandParser.GetCombinedCodeForCommands(c);
                }
                else if (c.Item2 == 2)
                {
                    if (joint.MoveDown(Miliseconds)) code = code + CommandParser.GetCombinedCodeForCommands(c); ;
                }
                else
                    return; //error, up is 1, down is 2

            }

            var arm = new MaplinRobotArm();
            arm.Connect();
            arm.Update(code);
            Thread.Sleep(Miliseconds);
            arm.ResetArm();
            arm.Update(0);
            arm.Cleanup();
        }
Exemplo n.º 2
0
        public void Move(string command)
        {
            var commands = CommandParser.Parse(command);
            var code     = 0;

            foreach (var c in commands)
            {
                Joint joint = null;
                this.JointCommands.TryGetValue(c.Item1, out joint);

                if (joint == null)
                {
                    return; //error, the code should return a joint
                }
                if (c.Item2 == 1)
                {
                    if (joint.MoveUp(Miliseconds))
                    {
                        code = code + CommandParser.GetCombinedCodeForCommands(c);
                    }
                }
                else if (c.Item2 == 2)
                {
                    if (joint.MoveDown(Miliseconds))
                    {
                        code = code + CommandParser.GetCombinedCodeForCommands(c);
                    }
                    ;
                }
                else
                {
                    return; //error, up is 1, down is 2
                }
            }

            var arm = new MaplinRobotArm();

            arm.Connect();
            arm.Update(code);
            Thread.Sleep(Miliseconds);
            arm.ResetArm();
            arm.Update(0);
            arm.Cleanup();
        }