コード例 #1
0
        public void CreateCommand_CreatesOwiCommand()
        {
            var factory = new OwiFactory();

            var command = factory.CreateCommand();

            Assert.IsInstanceOfType(command, typeof(OwiCommand));
        }
コード例 #2
0
        public void CreateArm_CreatesOwiArm()
        {
            var factory = new OwiFactory();

            var arm = factory.CreateArm(new Mock <IOwiUsbConnection>().Object);

            Assert.IsInstanceOfType(arm, typeof(OwiArm));
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            var factory = new OwiFactory();

            this.owiArm     = factory.CreateArm(new LibUsbOwiConnection());
            this.owiCommand = factory.CreateCommand();

            this.ConnectCommand = new RelayCommand(() => this.OnConnectCommand());
            this.LedCommand     = new RelayCommand <bool>(state => this.OnLedCommand(state));
            this.StopCommand    = new RelayCommand(() => this.OnStopCommand());

            this.gripperCommander  = new MovementCommander(c => c.GripperClose(), c => c.GripperStop(), c => c.GripperOpen());
            this.wristCommander    = new MovementCommander(c => c.WristDown(), c => c.WristStop(), c => c.WristUp());
            this.elbowCommander    = new MovementCommander(c => c.ElbowDown(), c => c.ElbowStop(), c => c.ElbowUp());
            this.shoulderCommander = new MovementCommander(c => c.ShoulderDown(), c => c.ShoulderStop(), c => c.ShoulderUp());
            this.baseCommander     = new MovementCommander(c => c.BaseRotateCounterClockwise(), c => c.BaseRotateStop(), c => c.BaseRotateClockwise());
        }
コード例 #4
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();
        }