Пример #1
0
        /// <inheritdoc />
        public Task SendCommandAsync(IOwiCommand command)
        {
            if (this.owiUsbConnection.IsOpen == false)
            {
                throw new InvalidOperationException("Unable to send command because the connection is not open.");
            }

            return(this.owiUsbConnection.SendAsync(command.ArmByte, command.BaseByte, command.LedByte));
        }
Пример #2
0
 public void ApplyMovement(int movement, IOwiCommand command)
 {
     if (movement == -1)
     {
         this.leftMovement.Invoke(command);
     }
     else if (movement == 1)
     {
         this.rightMovement.Invoke(command);
     }
     else
     {
         this.neutralMovement.Invoke(command);
     }
 }
Пример #3
0
        public async Task IntegrationTestThatRequiresArm()
        {
            IOwiFactory factory = new OwiFactory();
            IOwiArm     arm     = factory.CreateArm(new LibUsbOwiConnection());

            await arm.ConnectAsync();

            IOwiCommand command = factory.CreateCommand().BaseRotateClockwise().ShoulderUp().LedOn();

            await arm.SendCommandAsync(command);

            Thread.Sleep(2000);

            await arm.SendCommandAsync(command.StopAllMovements().LedOff());

            await arm.DisconnectAsync();
        }