Exemple #1
0
        public void RunCmd()
        {
            TeniboCommandIF cmdPropo = null;

            Rte_Receive_cmdFromPropo(out cmdPropo);

            if (cmdPropo != null && cmdPropo.cmd == (byte)TeniboCommnd.TC_MODE)
            {
                isAutoMode = cmdPropo.param1 == 1;
            }

            TeniboCommandIF cmdAuto = null;

            Rte_Receive_cmdFromAuto(out cmdAuto);

            if (isAutoMode)
            {
                if (cmdAuto != null)
                {
                    Rte_Send_cmdToRobo(cmdAuto);
                }
            }
            else
            {
                if (cmdPropo != null)
                {
                    Rte_Send_cmdToRobo(cmdPropo);
                }
            }
        }
Exemple #2
0
 private void CramText(TeniboCommandIF cmd)
 {
     if (_speechIF != null)
     {
         if (cmd.param1 != 0)
         {
             _speechIF.text += (char)cmd.param1;
         }
         if (cmd.param2 != 0)
         {
             _speechIF.text += (char)cmd.param2;
         }
         if (cmd.param3 != 0)
         {
             _speechIF.text += (char)cmd.param3;
         }
         if (cmd.param4 != 0)
         {
             _speechIF.text += (char)cmd.param4;
         }
         if (cmd.param5 != 0)
         {
             _speechIF.text += (char)cmd.param5;
         }
     }
 }
Exemple #3
0
 bool DispatchCommand(TeniboCommandIF cmd)
 {
     switch (cmd.cmd)
     {
     ///Arduinoで処理せず、ここで処理したらtrueを返すこと
     default:
         return(false);
     }
 }
Exemple #4
0
        /// <summary>
        /// コマンド解析
        /// </summary>
        /// <param name="rsvData"></param>
        /// <param name="ep"></param>
        void ParseRsvBuffer(byte[] rsvData, IPEndPoint ep)
        {
            if (rsvData.Length != TeniboCommandIF.bufSize)
            {
                return;
            }
            TeniboCommandIF cmdIF = new TeniboCommandIF();

            cmdIF.FromBuffer(rsvData, 0);
            receiveCommand = cmdIF;
        }
        public void Run()
        {
            DriveInfoIF driveIF;

            if (Rte_Receive_drive(out driveIF) == Std_ReturnType.RTE_E_OK)
            {
                TeniboCommandIF cmdIF = new TeniboCommandIF();
                cmdIF.cmd    = (byte)TeniboCommnd.TC_DRIVE;
                cmdIF.param1 = (short)driveIF.steer;
                cmdIF.param2 = (short)driveIF.accel;
                Rte_Send_cmd(cmdIF);
            }
        }
Exemple #6
0
        public void RunToCommand()
        {
            if (++_counter > 100)
            {
                _counter = 0;

                TeniboCommandIF cmd = new TeniboCommandIF();
                cmd.cmd    = (byte)TeniboCommnd.TC_LIGHT;
                cmd.param1 = ledPattern;
                Rte_Send_command(cmd);
                Console.WriteLine("  COM--NAVI<-WIFI cmd:{0}", cmd.cmd);

                if (++ledPattern > 16)
                {
                    ledPattern = 0;
                }
            }
        }
Exemple #7
0
 public void RunToCommand()
 {
     if (receiveCommand != null)
     {
         System.Console.WriteLine("  COM--CMD<-WIFI {0}", receiveCommand.ToString());//@@@
         DispatchCommand(receiveCommand);
         Rte_Send_command(receiveCommand);
         receiveCommand = null;
     }
     if (!isCmdRsving)
     {
         isCmdRsving = true;
         IPEndPoint ep = new IPEndPoint(IPAddress.Any, 0);
         UdpState   st = new UdpState();
         st.client = cmdClient;
         st.ep     = ep;
         cmdClient.BeginReceive(new AsyncCallback(ReceiveCallback), st);
     }
 }