public void Connect(string ip)
        {
            com = CDLL.Com_construct();

            if (!CDLL.Com_setAddress(com, ip))
            {
                throw new Exception("SetAddress error");
            }
            if (!CDLL.Com_connect(com))
            {
                throw new Exception("Cann't connect with robotino");
            }

            omniDrive = CDLL.OmniDrive_construct();
            for (int i = 0; i < 9; i++)
            {
                distanceSensor[i] = CDLL.DistanceSensor_construct((int)i);
                if (!CDLL.DistanceSensor_setComId(distanceSensor[i], com))
                {
                    throw new Exception("Cann't set DistanceSensor");
                }
            }
            if (!CDLL.OmniDrive_setComId(omniDrive, com))
            {
                throw new Exception("Cann't set OmniDrive");
            }

            cameraID = CDLL.Camera_construct();
            var ok = CDLL.Camera_setComId(cameraID, com);

            ok = CDLL.Camera_setStreaming(cameraID, true);
        }
 public void DisConnect()
 {
     if (!CDLL.Com_disconnect(com))
     {
         throw new Exception("Disconnect fail!");
     }
 }
 public void ManualControlMove(float speedX, float speedY, float rot)
 {
     if (!CDLL.OmniDrive_setVelocity(omniDrive, speedY, speedX, rot))
     {
         throw new Exception("Control error");
     }
     ;
 }
 public void ManualControlMove(float speedX, float speedY, float rot)
 {
     if (mChangedEvent != null)
     {
         mChangedEvent.Invoke(speedX, speedY, rot);
     }
     if (!CDLL.OmniDrive_setVelocity(omniDrive, speedY, speedX, rot))
     {
         throw new Exception("Control error");
     }
     ;
 }
 public void DisConnect()
 {
     if (!CDLL.Com_disconnect(com))
     {
         throw new Exception("Disconnect fail!");
     }
     if (!CDLL.OmniDrive_destroy(omniDrive))
     {
         throw new Exception("Disconnect fail!");
     }
     for (int i = 0; i < 9; i++)
     {
         if (!CDLL.DistanceSensor_destroy(distanceSensor[i]))
         {
             throw new Exception("Disconnect fail!");
         }
     }
 }
        public void Grab()
        {
            int imageWidth  = 0;
            int imageHeight = 0;

            uint imageCounter = 0;
            var  dt           = DateTime.Now;

            if (CDLL.Com_isConnected(com))
            {
                if (CDLL.Camera_grab(cameraID))
                {
                    CDLL.Camera_imageSize(cameraID, ref imageWidth, ref imageHeight);
                    imageBufferSize = 3 * imageWidth * imageHeight;
                    CDLL.Camera_getImage(cameraID, imageBuffer, imageBufferSize, ref imageWidth, ref imageHeight);
                }
            }
        }
        public void Connect(string ip)
        {
            com = CDLL.Com_construct();

            if (!CDLL.Com_setAddress(com, ip))
            {
                throw new Exception("SetAddress error");
            }
            if (!CDLL.Com_connect(com))
            {
                throw new Exception("Cann't connect with robotino");
            }

            omniDrive = CDLL.OmniDrive_construct();
            if (!CDLL.OmniDrive_setComId(omniDrive, com))
            {
                throw new Exception("Cann't set OmniDrive");
            }
        }
 public float ReadDistanceSensor(int n)
 {
     return(CDLL.DistanceSensor_voltage(distanceSensor[n]));
 }