Exemplo n.º 1
0
        private void InitState()
        {
            LogInfo("TrackRoamerDriveService:: InitState() _state=" + _state);

            if (_state == null)
            {
                LogInfo("TrackRoamerDriveService:: InitState()  (null)");

                _state = new TrackRoamerDriveState();

                _state.DistanceBetweenWheels = 0.5715;

                _state.LeftWheel = new motor.WheeledMotorState();
                _state.LeftWheel.Radius = 0.1805;
                _state.LeftWheel.GearRatio = 0.136;
                _state.LeftWheel.MotorState = new motor.MotorState();
                _state.LeftWheel.MotorState.HardwareIdentifier = 1;
                _state.LeftWheel.MotorState.Name = "Left Motor";
                _state.LeftWheel.MotorState.PowerScalingFactor = 30;
                _state.LeftWheel.MotorState.ReversePolarity = false;

                _state.RightWheel = new motor.WheeledMotorState();
                _state.RightWheel.Radius = 0.1805;
                _state.RightWheel.GearRatio = 0.136;
                _state.RightWheel.MotorState = new motor.MotorState();
                _state.RightWheel.MotorState.HardwareIdentifier = 2;
                _state.RightWheel.MotorState.Name = "Right Motor";
                _state.RightWheel.MotorState.PowerScalingFactor = 30;
                _state.RightWheel.MotorState.ReversePolarity = false;

                _state.LeftWheel.EncoderState = new encoder.EncoderState();
                _state.LeftWheel.EncoderState.HardwareIdentifier = 1;
                _state.LeftWheel.EncoderState.TicksPerRevolution = 2993;

                _state.RightWheel.EncoderState = new encoder.EncoderState();
                _state.RightWheel.EncoderState.HardwareIdentifier = 2;
                _state.RightWheel.EncoderState.TicksPerRevolution = 2993;

                _state.IsEnabled = true;
                _state.TimeStamp = DateTime.Now;

                LogInfo("TrackRoamerDriveService:: InitState(): saving state");

                SaveState(_state);
            }
            else
            {
                LogInfo("TrackRoamerDriveService:: InitState() (not null) _state.DistanceBetweenWheels=" + _state.DistanceBetweenWheels);
            }

            _state.InternalPendingDriveOperation = drive.DriveRequestOperation.NotSpecified;
            _state.TimeStamp = DateTime.Now;
        }
Exemplo n.º 2
0
 public IEnumerator<ITask> UpdateHandler(Update update)
 {
     _state = update.Body;
     _state.TimeStamp = DateTime.Now;
     update.ResponsePort.Post(new DefaultUpdateResponseType());
     yield break;
 }