예제 #1
0
        public NavigationManager()
        {
            movement = Movement.stop;
            monitor = new object();
            actualPosition = new Position();

            //TODO
            //Waiting for the magnetometer...
            Thread.Sleep(1500);
            initialHeading = this.MAG_Heading;

            contingency = new Contingency(left, right, this);
            //integration = new Timer(new TimerCallback(this.Integrate), new object(), GlobalVal.integrationPeriod * 10, GlobalVal.integrationPeriod);
        }
예제 #2
0
 public void SetObject(Position position)
 {
     //map[position.x][position.y].isObject = true;
 }
예제 #3
0
 public void setActualPosition(Position p)
 {
     this.actualPosition.x = p.x;
     this.actualPosition.y = p.y;
     this.actualPosition.angle = p.angle;
 }
예제 #4
0
 public void SetMapped(Position position)
 {
     //map[position.x][position.y].mapped = true;
 }
예제 #5
0
 public bool isMapped(Position position)
 {
     //return map[position.x][position.y].mapped;
     return false;
 }
예제 #6
0
파일: Engine.cs 프로젝트: AlexAlbala/MaCRo
 /*public short calibrarZ(short cz)
  {
    return cz;
  }*/
 private Engine()
 {
     actualPosition = new Position();
 }
예제 #7
0
파일: Engine.cs 프로젝트: AlexAlbala/MaCRo
 public void UpdatePosition(Position p)
 {
     Position _p = navigation.getActualPosition();
     Debug("Position: " + _p.x + " : " + _p.y + " : " + _p.angle + " | " + p.x + "  :" + p.y + " : " + p.angle);
     navigation.setActualPosition(p);
 }
예제 #8
0
파일: Coder.cs 프로젝트: AlexAlbala/MaCRo
        public void DataReceived(byte[] buffer, int offset, int length, TransportAddress t)
        {
            byte[] tmpBuff = new byte[length];
            for (int i = 0; i < length; i++)
            {
                tmpBuff[i] = buffer[offset + i];
            }

            switch ((char)tmpBuff[0])
            {
                case 'f':
                    Engine.getInstance().ManualForward(ToShort(tmpBuff, 1));
                    break;
                case 'b':
                    Engine.getInstance().ManualBackward(ToShort(tmpBuff, 1));
                    break;
                case 'r':
                    Engine.getInstance().ManualRight();
                    break;
                case 'l':
                    Engine.getInstance().ManualLeft();
                    break;
                case 's':
                    Engine.getInstance().ManualStop();
                    break;
                case 'm':
                    Engine.getInstance().ManualMode();
                    break;
                case 'M':
                    Engine.getInstance().StopManualMode();
                    break;

                case 'V':
                    Engine.getInstance().ManualSpeed(ToShort(tmpBuff, 1));
                    break;
                case 'v':
                    Engine.getInstance().ManualTurningSpeed(ToShort(tmpBuff, 1));
                    break;

                case 'p':
                    int readen = 1;
                    int temp;
                    Position p = new Position();
                    double x = ToDouble(tmpBuff, readen, out temp);
                    readen += temp;
                    //Engine.getInstance().Debug("X: " + x.ToString());

                    double y = ToDouble(tmpBuff, readen, out temp);
                    readen += temp;

                    double angle = ToDouble(tmpBuff, readen, out temp);
                    readen += temp;

                    p.x = x;
                    p.y = y;
                    p.angle = angle;

                    Engine.getInstance().UpdatePosition(p);
                    break;
                case 'c':
                    short value = 0;
                    switch ((char)tmpBuff[1])
                    {
                        case 'x':
                            value = ToShort(tmpBuff, 2);
                            Engine.getInstance().calibrarX(value);
                            break;
                        case 'y':
                            value = ToShort(tmpBuff, 2);
                            Engine.getInstance().calibrarY(value);
                            break;
                    }
                    break;

            }
        }