コード例 #1
0
        public TaskPlanner(ManipulatorManager armMan)
        {
            this.armMan = armMan;

            this.leftArm         = armMan.LeftArm;
            this.rightArm        = armMan.RightArm;
            this.mapObstacles    = armMan.MapObstacles;
            this.mapNodes        = armMan.MapNodes;
            this.leftPredefPos   = armMan.LeftPredefPos;
            this.leftPredefMovs  = armMan.LeftPredefMovs;
            this.rightPredefPos  = armMan.RightPredefPos;
            this.rightPredefMovs = armMan.RightPredefMovs;
            this.optLeftPath     = armMan.OptLeftPath;
            this.optRightPath    = armMan.OptRightPath;
            this.leftGoal        = armMan.LeftGoal;
            this.rightGoal       = armMan.RightGoal;

            this.UseRaHand = false;
            this.UseLaHand = false;
        }
コード例 #2
0
        public ManipulatorManager(string leftPortName, string rightPortName)
        {
            this.status = new ArmControlStatus();

            if (leftPortName == "disable")
            {
                this.status.LeftArmEnable = false;
            }

            if (rightPortName == "disable")
            {
                this.status.RightArmEnabled = false;
            }

            if (string.IsNullOrEmpty(leftPortName))
            {
                leftPortName = "COM5";
            }
            if (string.IsNullOrEmpty(rightPortName))
            {
                rightPortName = "COM9";
            }

            this.leftArmSerialPort  = new SerialPort(leftPortName, 57600, Parity.None, 8, StopBits.One);
            this.rightArmSerialPort = new SerialPort(rightPortName, 57600, Parity.None, 8, StopBits.One);

            this.status.LeftComPort  = leftPortName;
            this.status.RightComPort = rightPortName;

            this.leftArm  = new Manipulator(this.leftArmSerialPort, ArmType.LeftArm);
            this.rightArm = new Manipulator(this.rightArmSerialPort, ArmType.RightArm);
            this.leftArm.ArmPositionChanged  += new ArmPositionChangedEH(leftArm_ArmPositionChanged);
            this.rightArm.ArmPositionChanged += new ArmPositionChangedEH(rightArm_ArmPositionChanged);

            this.laEndEffectorType = TypeOfEndEffector.gripper;
            this.raEndEffectorType = TypeOfEndEffector.hand;

            this.mapObstacles    = new SortedList <string, MapObstacle>();
            this.mapNodes        = new SortedList <string, MapNode>();
            this.leftPredefPos   = new SortedList <string, PredefPosition>();
            this.leftPredefMovs  = new SortedList <string, PredefMovement>();
            this.rightPredefPos  = new SortedList <string, PredefPosition>();
            this.rightPredefMovs = new SortedList <string, PredefMovement>();
            this.optLeftPath     = new MapOptimalPath();
            this.optRightPath    = new MapOptimalPath();
            this.leftGoal        = new MapGoalPoint();
            this.rightGoal       = new MapGoalPoint();

            this.lowBat = new SharedVariable <bool>("bat_alert");
            this.sharedVarLeftArmPos      = new DoubleArraySharedVariable("leftArmPos");
            this.sharedVarRightArmPos     = new DoubleArraySharedVariable("rightArmPos");
            this.sharedVarEndEffectorType = new StringSharedVariable("endEffectorType");

            this.cmdMan = new CommandManager();
            this.cnnMan = new ConnectionManager("ARMS", 2080, this.cmdMan);
            this.cnnMan.ClientConnected    += new System.Net.Sockets.TcpClientConnectedEventHandler(cnnMan_ClientConnected);
            this.cnnMan.ClientDisconnected += new System.Net.Sockets.TcpClientDisconnectedEventHandler(cnnMan_ClientDisconnected);

            this.status.Running    = true;
            this.checkSystemThread = new Thread(new ThreadStart(this.CheckSystemThreadTask));
            this.checkSystemThread.IsBackground = true;
            this.checkSystemThread.Start();
        }