public void SetStatus(string rcvMsg)
 {
     JCVT_VEC.Get(rcvMsg, out status);
 }
Esempio n. 2
0
        public void Send(eVEC_CMD cmd, JCVT_VEC data = null)
        {
            bool   bSend  = true;
            string cmdmsg = string.Empty;

            switch (data.typeName)
            {
            case "SENDARG":
            {
                if (null != data)
                {
                    SENDARG arg;
                    JCVT_VEC.Get(data.json, out arg);
                    switch (cmd)
                    {
                    case eVEC_CMD.Say: cmdmsg = $"say {arg.msg}"; break;

                    case eVEC_CMD.LocalizeAtGoal: cmdmsg = $"dotask localizeatgoal {arg.goal_1st}"; break;

                    case eVEC_CMD.Go2Goal:
                    case eVEC_CMD.Go2Point:
                    case eVEC_CMD.Go2Straight:
                    {
                        ChangeToIdleMode();
                        switch (cmd)
                        {
                        case eVEC_CMD.Go2Goal: cmdmsg = $"goto {arg.goal_1st}"; break;

                        case eVEC_CMD.Go2Point: cmdmsg = $"gotopoint {arg.pos.x} {arg.pos.y}"; break;

                        case eVEC_CMD.Go2Straight: cmdmsg = $"doTask gotostraight {arg.goal_1st}"; break;
                        }
                        break;
                    }

                    case eVEC_CMD.MoveDeltaHeading:
                    case eVEC_CMD.MoveFront:
                    {
                        if (0 >= arg.acc)
                        {
                            arg.acc = 10;
                        }
                        if (0 >= arg.dec)
                        {
                            arg.acc = 10;
                        }
                        switch (cmd)
                        {
                        case eVEC_CMD.MoveDeltaHeading:
                            if (30 >= arg.dec)
                            {
                                arg.acc = 30;
                            }
                            cmdmsg = $"dotask deltaheading {arg.move} {arg.spd} {arg.acc} {arg.dec}";
                            break;

                        case eVEC_CMD.MoveFront:
                            if (50 >= arg.dec)
                            {
                                arg.acc = 50;
                            }
                            cmdmsg = $"dotask move {arg.move} {arg.spd} {arg.acc} {arg.dec} 10";
                            break;
                        }
                        break;
                    }

                    case eVEC_CMD.GetDistBetween: cmdmsg = $"distancebetween {arg.goal_1st} {arg.goal_2nd}"; break;

                    case eVEC_CMD.GetDistFromHere: cmdmsg = $"distanceFromHere {arg.goal_1st}"; break;

                    default: bSend = false; break;
                    }
                }
                else
                {
                    switch (cmd)
                    {
                    case eVEC_CMD.Stop: cmdmsg = $"stop"; break;

                    case eVEC_CMD.PauseCancel: cmdmsg = $"pausetaskcancel"; break;

                    case eVEC_CMD.Dock: cmdmsg = $"dock"; break;

                    case eVEC_CMD.Undock: cmdmsg = $"undock"; break;

                    default: bSend = false; break;
                    }
                }

                if (true == bSend)
                {
                    SendQuery(cmdmsg);
                }
                break;
            }

            default: break;
            }
        }