public SequenceCommandLogic(IControllerSequencer controllerSequencer,
                                    MotorPositionController backwardForwardPositionController,
                                    MotorPositionController upDownPositionController,
                                    MotorPositionController turnLeftRightPositionController,
                                    MotorPositionController openCloseClampPositionController)
        {
            this.controllerSequencer = controllerSequencer;
            this.backwardForwardPositionController = backwardForwardPositionController;
            this.upDownPositionController          = upDownPositionController;
            this.turnLeftRightPositionController   = turnLeftRightPositionController;
            this.openCloseClampPositionController  = openCloseClampPositionController;

            this.logger = LogManager.GetLogger(typeof(SequenceCommandLogic));
        }
Beispiel #2
0
        public MainWindowViewModel()
        {
            controllerSequencer = new ControllerSequencer(Properties.Settings.Default.RoboAddress, new ControllerConfiguration(), new ApplicationConfiguration()
            {
                ApplicationName = "RoboterApp"
            });
            this.PositionNames = new ObservableCollection <string>(this.controllerSequencer.GetPositionNames());

            BackwardForwardPositionController = controllerSequencer.ConfigureMotorPositionController(new MotorConfiguration
            {
                Motor = Motor.Two,
                ReferencingDirection            = Direction.Left,
                ReferencingSpeed                = Speed.Maximal,
                ReferencingFinePositioningSpeed = Speed.Slow,
                ReferencingInput                = DigitalInput.Two,
                ReferencingInputState           = false,
                Limit = 700
            });
            MoveBackwardCommand = new ContinuousMoveAxisCommand(this.BackwardForwardPositionController, Direction.Left);
            MoveForwardCommand  = new ContinuousMoveAxisCommand(this.BackwardForwardPositionController, Direction.Right);

            UpDownPositionController = controllerSequencer.ConfigureMotorPositionController(new MotorConfiguration
            {
                Motor = Motor.Three,
                ReferencingDirection            = Direction.Left,
                ReferencingSpeed                = Speed.Fast,
                ReferencingFinePositioningSpeed = Speed.Slow,
                ReferencingInput                = DigitalInput.Three,
                ReferencingInputState           = false,
                Limit = 2000
            });
            MoveUpCommand   = new ContinuousMoveAxisCommand(this.UpDownPositionController, Direction.Left);
            MoveDownCommand = new ContinuousMoveAxisCommand(this.UpDownPositionController, Direction.Right);

            TurnLeftRightPositionController = controllerSequencer.ConfigureMotorPositionController(new MotorConfiguration
            {
                Motor = Motor.One,
                ReferencingDirection            = Direction.Right,
                ReferencingSpeed                = Speed.Average,
                ReferencingFinePositioningSpeed = Speed.Slow,
                ReferencingInput                = DigitalInput.One,
                ReferencingInputState           = false,
                Limit = 2200
            });
            TurnLeftCommand  = new ContinuousMoveAxisCommand(this.TurnLeftRightPositionController, Direction.Left);
            TurnRightCommand = new ContinuousMoveAxisCommand(this.TurnLeftRightPositionController, Direction.Right);

            OpenCloseClampPositionController = controllerSequencer.ConfigureMotorPositionController(new MotorConfiguration
            {
                Motor = Motor.Four,
                ReferencingDirection            = Direction.Left,
                ReferencingSpeed                = Speed.Quick,
                ReferencingFinePositioningSpeed = Speed.Slow,
                ReferencingInput                = DigitalInput.Four,
                ReferencingInputState           = false,
                Limit      = 15,
                IsSaveable = false
            });
            OpenClampCommand  = new ContinuousMoveAxisCommand(this.OpenCloseClampPositionController, Direction.Left);
            CloseClampCommand = new ContinuousMoveAxisCommand(this.OpenCloseClampPositionController, Direction.Right);

            ReferenceAxisCommand  = new ReferenceAxisCommand(TurnLeftRightPositionController, UpDownPositionController, BackwardForwardPositionController, OpenCloseClampPositionController);
            SavePositionCommand   = new SavePositionCommand(this.controllerSequencer, this.PositionNames);
            MoveToPositionCommand = new MoveToPositionCommand(this.controllerSequencer, this);

            this.sequenceCommandLogic = new SequenceCommandLogic(this.controllerSequencer, this.BackwardForwardPositionController, this.UpDownPositionController, this.TurnLeftRightPositionController, this.OpenCloseClampPositionController);
            StartSequenceCommand      = new StartSequenceCommand(this.sequenceCommandLogic);

            AlarmSoundCommand = new AlarmSoundCommand(controllerSequencer);

            controllerSequencer.CommunicationLoopCyleTimeChanges.Subscribe(OnCommunicationLoopCycleTimeUpdate);
            controllerSequencer.CommunicationExceptions.Subscribe(OnCommunicationLoopExcpetion);
            controllerSequencer.ControllerConnectionStateChanges.Subscribe(OnControllerConnectionStateChanged);
            controllerSequencer.CommunicationLoopBlockingEvents.Subscribe(OnCommunicationLoopBlocked);
            CurrentControllerConnectionState = controllerSequencer.CurrentlyConnectedToController;
        }
 public SavePositionCommand(IControllerSequencer sequencer, ObservableCollection <string> positionNames)
 {
     this.sequencer     = sequencer;
     this.positionNames = positionNames;
 }
 public MoveToPositionCommand(IControllerSequencer controllerSequencer, MainWindowViewModel mainWindowViewModel)
 {
     this.controllerSequencer = controllerSequencer;
     this.mainWindowViewModel = mainWindowViewModel;
 }
Beispiel #5
0
 public AlarmSoundCommand(IControllerSequencer sequencer)
 {
     this.sequencer = sequencer;
 }