Beispiel #1
0
        public void CopyTaskToNewRobot(Form FM, DataType.Dsystem DSystem, RobotTask robotTask, RobotTask TargetrobotTask, Product SrcRobot, Product TargetRobot)
        {
            //string TarName = SrcRobot.get_PartNumber();
            //ProductDocument SrcRobotDoc = (ProductDocument)DSystem.DSDocument.Item(TarName + ".CATProduct");
            //TarName = TargetRobot.get_PartNumber();
            //ProductDocument TargetRobotDoc = (ProductDocument)DSystem.DSDocument.Item(TargetRobot.get_PartNumber() + ".CATProduct");
            Selection selection = DSystem.CDSActiveDocument.Selection;

            selection.Clear();
            //foreach (Operation soperation in robotTask.ChildrenActivities)
            //{
            //    selection.Add(soperation);
            //}
            selection.Add(robotTask);
            try
            {
                selection.Copy();
                selection.Clear();
                //selection = TargetRobotDoc.Selection;
                selection.Add(TargetrobotTask);
                selection.Paste();
            }
            catch (Exception e)
            {
                MessageBox.Show("应发了未知错误,请核实是否完全克隆后再删除原机器人! " + e.Message);
            }
        }
Beispiel #2
0
		public void ApplyTool(RobotTask task)
		{
			if (task != _nextTask)
				_isDamaged = true;
			else
				_nextTask = _nextTask + 1;
		}
Beispiel #3
0
 public void undoAction()
 {
     if (robotTaskStack.Count > 0)
     {
         RobotTask command = this.robotTaskStack.Pop();
         command.undo();
     }
 }
Beispiel #4
0
 void CarryOutTask(RobotTask _task)
 {
     if (_task.inProgress())
     {
         targetNode         = _task.waypoints.Peek();
         transform.position = new Vector3(targetNode.gridPos.x * Constants.GRID_DIMS.x, targetNode.gridPos.y * Constants.GRID_DIMS.y, targetNode.gridPos.z * Constants.GRID_DIMS.z);
         // currentNode = _task.waypoints.Dequeue();
     }
 }
Beispiel #5
0
 public void GiveTask(RobotTask rt)
 {
     pickupTask     = rt.pickUpTask;
     dropoffTask    = rt.dropOffTask;
     _pickupCrate   = rt.pickUpCrate;
     _pickUpTarget  = rt.pickUpTarget;
     _dropOffTarget = rt.dropOffTarget;
     HandleTask();
 }
 public void setTask(RobotTask Task, int index)
 {
     if (index < this.taskCount)
     {
         this.tasks[index] = Task;
     }
     else
     {
         Console.WriteLine("Set Task Error: Index out of range.");
     }
 }
Beispiel #7
0
    public void AssignTask(int _type, Node _destination)
    {
        Node _startingNode;

        if (taskQueue.Count > 0)
        {
            _startingNode = taskQueue.Peek().destination;
        }
        else
        {
            _startingNode = currentNode;
        }

        currentTask = new RobotTask(pathfinder, structure.nodesArray, new RobotState(transform.position, transform.rotation, platformPosition), _type, _startingNode, _destination);

        Debug.Log("Task assigned to " + robotID);
    }
Beispiel #8
0
        public void doTasks(Queue <String> taskQueue)
        {
            int     robotIndex = 0, invokerIndex = 0;
            Invoker invoker = new Invoker(taskQueue.Count);

            try {
                List <String> tasks = File.ReadAllLines("tasks.txt").ToList();
                if (tasks.Count > 0)
                {
                    taskQueue = new Queue <String>();
                    foreach (String t in tasks)
                    {
                        taskQueue.Enqueue(t);
                    }
                }
            }
            catch (Exception e) { }
            while (taskQueue.Count > 0)
            {
                Robot currentRobot = this.robots[robotIndex];
                if (currentRobot.isFull())
                {
                    robotIndex++;
                    if (robotIndex >= robots.Count)
                    {
                        robotIndex = 0;
                    }
                    continue;
                }
                else
                {
                    String    nextTask  = taskQueue.Dequeue();
                    RobotTask robotTask = this.taskFactory.assignTask(nextTask, currentRobot);
                    invoker.setTask(robotTask, invokerIndex);
                    invoker.threadedInvoke(invokerIndex);
                    this.robotTaskStack.Push(robotTask);
                    invokerIndex++;
                    saveQueue(taskQueue);
                }
            }
            Console.WriteLine("All tasks have been assigned.");
        }
Beispiel #9
0
        private void reSelectRobotTask_Click(object sender, EventArgs e)
        {
            tagList.Clear();
            viatagList.Clear();
            processtagList.Clear();
            ProcessTaskAddress.Items.Clear();
            Pbar.Value = 0;
            Pbar.Step  = 10;
            GloalForDelmia GFD = new GloalForDelmia();

            DStype = GFD.InitCatEnv(this);
            if (DStype.Revalue == -1)
            {
                return;
            }
            this.TopMost     = false;
            this.WindowState = FormWindowState.Minimized;
            Selection Uselect   = GFD.GetIRobotMotion(this, DStype, 12, "请选择即将操作的Taglist对象");
            RobotTask robotTask = null;

            if (Uselect != null && Uselect.Count > 0)
            {
                try
                {
                    String GetName = string.Empty;
                    robotTask = (RobotTask)Uselect.Item2(1).Value;
                    GetName   = robotTask.get_Name();
                    selectedrobotTaskName.Text = GetName;
                    //GFD.ClearRobotHomeList(this, DStype, Usp, "Test", Pbar);
                    GFD.ReadTaskTagList(this, robotTask, TaskListA, TaskListB, Pbar, ref tagList, ref viatagList, ref processtagList);
                }
                catch
                {
                    MessageBox.Show("操作目标过程中发生未知错误,编号:0029874,在入口的帮助选项卡中反馈该问题!");
                }
            }
            //this.TopMost = true;
            //this.WindowState = FormWindowState.Maximized;
            this.WindowState   = FormWindowState.Normal;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.TopMost       = false;
        }
Beispiel #10
0
        private void ProcessTaskAddress_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (robotTasks.Count < 1)
            {
                return;
            }
            String    GetName     = string.Empty;
            int       SelectIndex = ProcessTaskAddress.SelectedIndex;
            RobotTask srobotTask  = robotTasks[SelectIndex];

            GetName = srobotTask.get_Name();
            //selectedrobotTaskName.Text = GetName;
            //GFD.ClearRobotHomeList(this, DStype, Usp, "Test", Pbar);
            GloalForDelmia GFD = new GloalForDelmia();

            DStype = GFD.InitCatEnv(this);
            GFD.ReadTaskTagList(this, srobotTask, TaskListA, TaskListB, Pbar, ref tagList, ref viatagList, ref processtagList);
            this.WindowState   = FormWindowState.Normal;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.TopMost       = true;
        }
Beispiel #11
0
        public static IList <RobotTask> ToTaskList(SQLiteDataReader reader)
        {
            IList <RobotTask> list = new List <RobotTask>();

            while (reader.Read())
            {
                try
                {
                    int         id         = int.Parse(reader["TaskID"].ToString());
                    DateTime    time       = DateTime.Parse(reader["TaskTime"].ToString());
                    DateTime    nextTime   = DateTime.Parse(reader["NextTaskTime"].ToString());
                    string      num        = reader["TargetNum"].ToString();
                    string      info       = reader["TaskInfo"].ToString();
                    string      remark     = reader["Remark"].ToString();
                    string      targetName = reader["TargetName"].ToString();
                    TaskTrigger trigger    = (TaskTrigger)Enum.Parse(typeof(TaskTrigger), reader["Trigger"].ToString());
                    int         interval   = int.Parse(reader["Interval"].ToString());
                    RobotTask   task       = new RobotTask(id, time, info, num, targetName, remark, trigger, interval, nextTime);
                    list.Add(task);
                }
                catch { }
            }
            return(list);
        }
 protected override bool ProcessCommands(RobotTask task, string command) => ProcessCommand(task, command, "download", "", Download) || ProcessCommand(task, command, "Update", "", Update);
Beispiel #13
0
        protected override bool ProcessCommands(RobotTask task, string command)
        {
            var commandProcessed = ProcessCommand(task, command, "piano", "", args => DownloadPianoVideos());

            return(commandProcessed);
        }
        private void addItem(string[] item)
        {
            int indexFromTaskList = -1;
            string sID = item[1];
            double dX = double.Parse(item[2].Replace(".",","));
            double dY = double.Parse(item[3].Replace(".", ","));
            double dAngle = double.Parse(item[4].Replace(".", ","));
            int id = int.Parse(item[5]);

            for (int i = 6; i < item.Length; i += 5)
            {
                RobotTask tempRobot = new RobotTask();
                tempRobot.ID = sID;
                tempRobot.X = dX * 100;
                tempRobot.Y = dY * 100;
                tempRobot.Angle = dAngle;
                tempRobot.RobotID = id;

                tempRobot.TaskID = item[i];
                tempRobot.Task_X = double.Parse(item[i+ 1].Replace(".", ",")) * 100;
                tempRobot.Task_Y = double.Parse(item[i +2].Replace(".", ",")) * 100;
                tempRobot.Task_Name = item[i + 3];
                tempRobot.IsEnd = bool.Parse(item[i +4].Replace(".", ","));

                indexFromTaskList = getRobotTaskId(tempRobot);

                if (indexFromTaskList > -1) //aktualizacja zadania
                {
                    robotsTaskList[indexFromTaskList].IsEnd = tempRobot.IsEnd;
                    robotsTaskList[indexFromTaskList].X = tempRobot.X;
                    robotsTaskList[indexFromTaskList].Y = tempRobot.Y;
                    robotsTaskList[indexFromTaskList].Angle = tempRobot.Angle;
                }
                else
                    robotsTaskList.Add(tempRobot);
            }
        }
Beispiel #15
0
		public Tool(Position position, RobotTask task)
		{
			_position = position;
			_task = task;
		}
Beispiel #16
0
		public void Reconfigure(RobotTask task)
		{
			_task = task;
		}
Beispiel #17
0
		public extern bool ModifyWorkpiece(Position position, RobotTask task);
Beispiel #18
0
			public bool ModifyWorkpiece(Position position, RobotTask task)
			{
				return false;
			}
Beispiel #19
0
        /// <summary>
        /// 对机器人程序进行操作
        /// </summary>
        /// <param name="FM"></param>
        /// <param name="robotTask"></param>
        /// <param name="listBoxMain"></param>
        /// <param name="listBoxTarget"></param>
        /// <param name="Pbar"></param>
        public void ReadTaskTagList(Form FM, RobotTask robotTask, ListBox listBoxMain, ListBox listBoxTarget, ProgressBar Pbar, ref List <Tag> tagList, ref List <Tag> viatagList, ref List <Tag> processtagList)
        {
            listBoxMain.Items.Clear();
            listBoxTarget.Items.Clear();
            tagList.Clear();
            viatagList.Clear();
            processtagList.Clear();
            if (robotTask.ChildrenActivities.Count < 1)
            {
                Pbar.Maximum = 100;
                Pbar.Value   = 100;
                Pbar.Step    = 1;
                return;
            }
            Pbar.Value = 0;
            //List<Tag> tagList = new List<Tag>(); // Init A container to Save Target Tag List
            //List<Tag> viatagList = new List<Tag>(); // Init A container to Save Target Tag List
            //List<Tag> processtagList = new List<Tag>(); // Init A container to Save Target Tag List
            Pbar.Maximum = robotTask.ChildrenActivities.Count;
            try
            {
                foreach (Operation soperation in robotTask.ChildrenActivities)
                {
                    foreach (Activity activity in soperation.ChildrenActivities)
                    {
                        string activityName = activity.Type;
                        if (activityName == "DNBRobotMotionActivity")
                        {
                            RobotMotion robotMotion = (RobotMotion)activity;
                            short       TagetType   = -1;
                            robotMotion.GetTargetType(ref TagetType); //Type of the Target (Cartesian = 0, Joint = 1, Tag = 2, Home = 3).
                            if (TagetType != 2)
                            {
                                continue;
                            }
                            try
                            {
                                Tag tag = null;
                                robotMotion.GetTagTarget(ref tag);
                                var Return = tagList.Find(
                                    delegate(Tag tag1)
                                {
                                    return(tag1.get_Name() == tag.get_Name()); //需要修改为检查ID 名称可重复
                                });                                            // Check Repeact
                                if (Return == null)                            //当列表中不存在时 把新对象加载进入
                                {
                                    //确定当前Opration类型 The Via Mode (1 if the target is a via point and 0 if the Target is Untyped (process)).
                                    short ViaMode = -1;
                                    soperation.GetViaMode(ref ViaMode);
                                    switch (ViaMode)
                                    {
                                    case 0:
                                        processtagList.Add(tag);
                                        break;

                                    case 1:
                                        viatagList.Add(tag);
                                        break;

                                    default:
                                        break;
                                    }
                                    tagList.Add(tag);
                                    string TagName = tag.get_Name();
                                    listBoxMain.Items.Add(TagName);
                                }
                            }
                            catch (Exception)
                            {
                                continue;
                                //throw;
                            }
                        }
                    }
                    Pbar.PerformStep();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("在处理Oprations时发生错误,请联系或在帮助选项中反馈该问题!" + e.Message);
            }
            Pbar.Value = Pbar.Maximum;
        }
Beispiel #20
0
 public void AddTask(RobotTask task)
 {
     tasks.Add(task);
 }
        private int getRobotTaskId(RobotTask tempRobot)
        {
            for (int i = 0; i < robotsTaskList.Count(); i++)
            {
                if (robotsTaskList[i].TaskID == tempRobot.TaskID)
                    return i;
            }

            return -1;
        }