Beispiel #1
0
    private IEnumerator doSomeThing(MotionRejectoryType type)
    {
        BleController bc = BleController.Instance;

        foreach (Dictionary <string, int> dict in bc.Trajectory(type))
        {
            bc.Transfer(BleModelType.BLE_MOVE, dict);
            int   time = dict [BLE.KEY_MOVE_TIME];
            float ft   = (float)time / 1000;
            yield return(new WaitForSeconds(ft));
        }
    }
Beispiel #2
0
            public IEnumerable <Dictionary <string, int> > Trajectory(MotionRejectoryType type)
            {
                int[,] table = null;
                switch (type)
                {
                case MotionRejectoryType.Rejectory1:
                    table = BLE.MOTION_REJECTORY1_TABLE;
                    break;

                case MotionRejectoryType.Rejectory2:
                    table = BLE.MOTION_REJECTORY2_TABLE;
                    break;

                case MotionRejectoryType.Rejectory3:
                    table = BLE.MOTION_REJECTORY3_TABLE;
                    break;

                case MotionRejectoryType.Rejectory4:
                    table = BLE.MOTION_REJECTORY4_TABLE;
                    break;

                default:
                    break;
                }
                if (null != table)
                {
                    for (int i = 0; i < table.GetLength(0); i++)
                    {
                        Dictionary <string, int> dict = new Dictionary <string, int> ();
                        dict [BLE.KEY_MOVE_SPEED_L] = table [i, 0];
                        dict [BLE.KEY_MOVE_SPEED_R] = table [i, 1];
                        dict [BLE.KEY_MOVE_TIME]    = table [i, 2];
                        yield return(dict);
                    }
                }
            }