Exemplo n.º 1
0
        /// <summary>
        /// Adds the specified switch to the specified actuator.
        /// Notifies the actuator about the switch.  Also adds the
        /// switch to the settings file and saves the settings file
        /// </summary>
        /// <param name="actuator">atuator to add to</param>
        /// <param name="switchSetting">switch to add</param>
        /// <returns>true on success</returns>
        public bool AddSwitch(IActuator actuator, SwitchSetting switchSetting)
        {
            var actuatorSetting = Config.Find(actuator.Descriptor.Id);

            if (actuatorSetting == null)
            {
                return(false);
            }

            var sw = actuatorSetting.Find(switchSetting.Name);

            if (sw != null)
            {
                return(true);
            }

            bool retVal = actuator.Load(new List <SwitchSetting>()
            {
                switchSetting
            });

            if (retVal)
            {
                actuatorSetting.SwitchSettings.Add(switchSetting);
                Config.Save();
            }

            return(retVal);
        }
        public StateMachineState WithActuator(IActuator actuator, ComponentState state)
        {
            if (actuator == null) throw new ArgumentNullException(nameof(actuator));

            _pendingActuatorStates.Add(new PendingActuatorState().WithActuator(actuator).WithState(state));
            return this;
        }
 public void Dispose()
 {
     lock (_lock)
     {
         if (_thread != null)
         {
             foreach (Thread q in QueueThread)
             {
                 q.Join();
                 q.Abort();
             }
             _thread.Clear();
             _thread = null;
         }
         if (_queue != null)
         {
             _queue = null;
         }
         if (_error != null)
         {
             _error = null;
         }
         _actuator = null;
     }
     GC.Collect();
 }
Exemplo n.º 4
0
        internal static IActuator[] CreateActuatorsFromMap(InputActionMap inputActionMap,
                                                           BehaviorParameters behaviorParameters,
                                                           InputDevice inputDevice,
                                                           InputActuatorEventContext context)
        {
            var actuators = new IActuator[inputActionMap.actions.Count];

            for (var i = 0; i < inputActionMap.actions.Count; i++)
            {
                var action       = inputActionMap.actions[i];
                var actionLayout = InputSystem.LoadLayout(action.expectedControlType);
                var adaptor      = (IRLActionInputAdaptor)Activator.CreateInstance(controlTypeToAdaptorType[actionLayout.type]);
                actuators[i] = new InputActionActuator(inputDevice, behaviorParameters, action, adaptor, context);

                // Reasonably, the input system starts adding numbers after the first none numbered name
                // is added.  So for device ID of 0, we use the empty string in the path.
                var path = $"{inputDevice?.path}{InputControlPath.Separator}{action.name}";
                action.AddBinding(path,
                                  action.interactions,
                                  action.processors,
                                  mlAgentsControlSchemeName);
                action.bindingMask = InputBinding.MaskByGroup(mlAgentsControlSchemeName);
            }
            return(actuators);
        }
        public void TestRemotePolicyEvent()
        {
            var behaviorName = "testBehavior";
            var sensor1      = new Test3DSensor("SensorA", 21, 20, 3);
            var sensor2      = new Test3DSensor("SensorB", 20, 22, 3);
            var sensors      = new List <ISensor> {
                sensor1, sensor2
            };

            var actionSpec = ActionSpec.MakeContinuous(2);

            var vectorActuator = new VectorActuator(null, actionSpec, "test'");
            var actuators      = new IActuator[] { vectorActuator };

            var remotePolicyEvent = TrainingAnalytics.GetEventForRemotePolicy(behaviorName, sensors, actionSpec, actuators);

            // The behavior name should be hashed, not pass-through.
            Assert.AreNotEqual(behaviorName, remotePolicyEvent.BehaviorName);

            Assert.AreEqual(2, remotePolicyEvent.ObservationSpecs.Count);
            Assert.AreEqual(3, remotePolicyEvent.ObservationSpecs[0].DimensionInfos.Length);
            Assert.AreEqual(20, remotePolicyEvent.ObservationSpecs[0].DimensionInfos[0].Size);
            Assert.AreEqual(0, remotePolicyEvent.ObservationSpecs[0].ObservationType);
            Assert.AreEqual("None", remotePolicyEvent.ObservationSpecs[0].CompressionType);
            Assert.AreEqual(Test3DSensor.k_BuiltInSensorType, remotePolicyEvent.ObservationSpecs[0].BuiltInSensorType);

            Assert.AreEqual(2, remotePolicyEvent.ActionSpec.NumContinuousActions);
            Assert.AreEqual(0, remotePolicyEvent.ActionSpec.NumDiscreteActions);

            Assert.AreEqual(2, remotePolicyEvent.ActuatorInfos[0].NumContinuousActions);
            Assert.AreEqual(0, remotePolicyEvent.ActuatorInfos[0].NumDiscreteActions);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Updates the calibration status in the calibration form.
 /// </summary>
 /// <param name="source">Source actuator</param>
 /// <param name="caption">caption for the form</param>
 /// <param name="prompt">message to display on the form</param>
 /// <param name="timeout">calibration timeout</param>
 /// <param name="enableConfigure">should "Configure" button be enabled?</param>
 public void UpdateCalibrationStatus(IActuator source, String caption, String prompt, int timeout = 0, bool enableConfigure = true)
 {
     if (isCalibratingActuator(source))
     {
         calibratingActuatorEx.UpdateCalibrationStatus(getCalibrationFormPosition(), caption, prompt, timeout, enableConfigure);
     }
 }
        public PendingActuatorState WithActuator(IActuator actuator)
        {
            if (actuator == null) throw new ArgumentNullException(nameof(actuator));

            Actuator = actuator;
            return this;
        }
Exemplo n.º 8
0
        public SLMMDevice(ISettings settings, IBuffer buffer, IActuator actuator)
        {
            _settings = settings;
            _buffer   = buffer;

            _buffer.Add(_settings.DevicePosition);
            _actuator = actuator;
        }
Exemplo n.º 9
0
        public ActuatorHistory(IActuator actuator, IHttpRequestController apiRequestController, ILogger logger)
        {
            _actuator = actuator;
            _logger   = logger;
            _filename = Path.Combine(ApplicationData.Current.LocalFolder.Path, "Actuators", actuator.Id.Value, "History.csv");

            apiRequestController.HandleGet($"statistics/{actuator.Id}").Using(HandleApiGet);
        }
Exemplo n.º 10
0
        private string ProcessMessage()
        {
            if (_messageContext.GetPatternMatch("Hi").Success)
            {
                return($"{Emoji.VictoryHand} Hi, was kann ich für Dich tun?");
            }

            if (_messageContext.GetPatternMatch("Danke").Success)
            {
                return($"{Emoji.Wink} Habe ich doch gerne gemacht.");
            }

            if (_messageContext.GetPatternMatch("Wetter").Success)
            {
                return(GetWeatherStatus());
            }

            if (_messageContext.GetPatternMatch("Fenster").Success)
            {
                return(GetWindowStatus());
            }

            FilterComponentIds();

            if (!_filteredComponentIds.Any())
            {
                if (_messageContext.IdentifiedComponentIds.Count > 0)
                {
                    return($"{Emoji.Confused} Mit so vielen Anfragen kann ich nicht umgehen. Bitte nenne mir nur eine eindeutige Komponente.");
                }

                return($"{Emoji.Confused} Du musst mir schon einen Sensor oder Aktor nennen.");
            }

            if (_filteredComponentIds.Count > 1)
            {
                return($"{Emoji.Flushed} Bitte nicht mehrere Komponenten auf einmal.");
            }

            if (_filteredComponentIds.Count == 1)
            {
                var component = _controller.GetComponent <IComponent>(_messageContext.IdentifiedComponentIds.First());

                IActuator actuator = component as IActuator;
                if (actuator != null)
                {
                    return(UpdateActuatorState(actuator));
                }

                ISensor sensor = component as ISensor;
                if (sensor != null)
                {
                    return(GetSensorStatus(sensor));
                }
            }

            return($"{Emoji.Confused} Das habe ich leider nicht verstanden. Bitte stelle Deine Anfrage präziser.");
        }
Exemplo n.º 11
0
        /// <summary>
        /// Actuator should invoke this to indicate asyc initialization has
        /// ended
        /// </summary>
        /// <param name="source">The source actuator</param>
        /// <param name="success">was init successful?</param>
        public void OnInitDone(IActuator source, bool success = true)
        {
            var aex = _actuators.find(source);

            if (aex != null)
            {
                aex.OnInitDone(success);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Adds the specified switch to the list of switches supported
        /// by the actuator. switchSetting contains all the attributes of the
        /// switch.  The swtich is added to the actuators settings file and the
        /// file saved.
        /// </summary>
        /// <param name="actuator">Actuator to add to</param>
        /// <param name="switchSetting">Settings for the switch</param>
        /// <returns>true on success, false if actuator not found</returns>
        public bool RegisterSwitch(IActuator actuator, SwitchSetting switchSetting)
        {
            if (_actuators.Find(actuator.GetType()) == null)
            {
                return(false);
            }

            return(_actuators.AddSwitch(actuator, switchSetting));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Invoke this to indicate that the settings dialog should be displayed
        /// </summary>
        /// <param name="source"></param>
        internal void OnDialogRequest(IActuator source)
        {
            var aex = _actuators.find(source);

            if (aex != null)
            {
                aex.OnDialogRequest();
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Actuator can invoke this function to indicate any error.  The error
        /// dialog is displayed
        /// </summary>
        /// <param name="source">source acutator that had the error</param>
        /// <param name="message">error message</param>
        /// <param name="enableConfigure">should "configure" button be enabled?</param>
        public void OnError(IActuator source, String message, bool enableConfigure = true)
        {
            var aex = _actuators.find(source);

            if (aex != null)
            {
                aex.OnError(message, enableConfigure);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Removes the switch from the actuator. The swtich is removed from the
        /// actuators settings file and the file saved.
        /// </summary>
        /// <param name="actuator"></param>
        /// <param name="switchName"></param>
        /// <returns></returns>
        public bool UnregisterSwitch(IActuator actuator, String switchName)
        {
            if (_actuators.Find(actuator.GetType()) == null)
            {
                return(false);
            }

            return(_actuators.RemoveSwitch(actuator, switchName));
        }
        public static bool GetIsOff(this IActuator actuator)
        {
            if (actuator == null)
            {
                throw new ArgumentNullException(nameof(actuator));
            }

            return(actuator.GetState().Equals(BinaryStateId.On));
        }
Exemplo n.º 17
0
 /// <summary>
 /// The actuator should invoke this function to indicate end
 /// of calibration.
 /// </summary>
 /// <param name="source">actuator being calibrated</param>
 /// <param name="errorMessage">any error during calibration?</param>
 /// <param name="enableConfigure">should the "configure" be enabled</param>
 public void OnEndCalibration(IActuator source, String errorMessage = "", bool enableConfigure = true)
 {
     Log.Debug("Entered ActuatorManger.EndCalibration");
     if (isCalibratingActuator(source))
     {
         calibratingActuatorEx.OnEndCalibration(errorMessage, enableConfigure);
         Log.Debug("SETTING CALIBRATINGACUTAOTRX to NULL");
         calibratingActuatorEx = null;
     }
 }
Exemplo n.º 18
0
        public Frame WithTargetState(IActuator actuator, ComponentState state)
        {
            if (actuator == null)
            {
                throw new ArgumentNullException(nameof(actuator));
            }

            _states.Add(new PendingActuatorState().WithActuator(actuator).WithState(state));
            return(this);
        }
Exemplo n.º 19
0
        public PendingActuatorState WithActuator(IActuator actuator)
        {
            if (actuator == null)
            {
                throw new ArgumentNullException(nameof(actuator));
            }

            Actuator = actuator;
            return(this);
        }
Exemplo n.º 20
0
        public StateMachineState WithActuator(IActuator actuator, NamedComponentState state)
        {
            if (actuator == null)
            {
                throw new ArgumentNullException(nameof(actuator));
            }

            _pendingActuatorStates.Add(new PendingActuatorState().WithActuator(actuator).WithState(state));
            return(this);
        }
Exemplo n.º 21
0
        private void QueueEntry(IActuator actuator, string newState)
        {
            var entry = new ActuatorHistoryEntry(DateTime.Now, actuator.Id, newState);

            _actuatorHistory[actuator].AddEntry(entry);

            lock (_queuedEntries)
            {
                _queuedEntries.Add(entry);
            }
        }
Exemplo n.º 22
0
        public TurnOnAndOffAutomation WithTarget(IActuator actuator)
        {
            if (actuator == null)
            {
                throw new ArgumentNullException(nameof(actuator));
            }

            _turnOnActions.Add(() => actuator.SetState(BinaryStateId.On));
            _turnOffActions.Add(() => actuator.SetState(BinaryStateId.Off));

            return(this);
        }
Exemplo n.º 23
0
 /// <summary>
 /// Updates the calibration status in the calibration form.
 /// </summary>
 /// <param name="source">Source actuator</param>
 /// <param name="caption">caption for the form</param>
 /// <param name="prompt">message to display on the form</param>
 /// <param name="timeout">calibration timeout</param>
 /// <param name="enableConfigure">should "Configure" button be enabled?</param>
 /// <param name="buttonText">text of the calibration button</param>
 public void UpdateCalibrationStatus(IActuator source, String caption, String prompt, int timeout = 0, bool enableConfigure = true, String buttonText = "")
 {
     Log.Debug("Checking if isCalibrationg for " + source.Name);
     if (isCalibratingActuator(source))
     {
         Log.Debug("UpdateCalibStatus:  Yes it is!!. Calling calibratingActuatorEx.UpdateCalibrationStatus for " + source.Name);
         _calibratingActuatorEx.UpdateCalibrationStatus(getCalibrationFormPosition(), caption, prompt, timeout, enableConfigure, buttonText);
     }
     else
     {
         Log.Debug("isCalibrating returned False.  Actuator is NOT calibrating for " + source.Name);
     }
 }
Exemplo n.º 24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="t"></param>
 /// <param name="obj"></param>
 public void UnRegister(IActuator t, String obj)
 {
     if (this.Actuators.ContainsKey(obj))
     {
 #if NEODROID_DEBUG
         if (this.Debugging)
         {
             Debug.Log($"Environment {this.name} unregistered actuator {obj}");
         }
 #endif
         this.Actuators.Remove(obj);
     }
 }
Exemplo n.º 25
0
        public void Setup()
        {
            _initialSettingsMock = SetInitialSettingsMock(
                GARDENSIZE_LENGHT,
                GARDENSIZE_WIDTH,
                DEVICE_POSITION_Y,
                DEVICE_POSITION_X,
                DEVICE_ORIENTATION);

            _buffer   = new DeviceBuffer();
            _actuator = new TestsActuator(false);
            _device   = new SLMMDevice(_initialSettingsMock.Object, _buffer, _actuator);
        }
Exemplo n.º 26
0
        /// <summary>
        /// The actuator should invoke this function to indicate end
        /// of calibration.
        /// </summary>
        /// <param name="source">actuator being calibrated</param>
        /// <param name="errorMessage">any error during calibration?</param>
        /// <param name="enableConfigure">should the "configure" be enabled</param>
        public void OnEndCalibration(IActuator source, String errorMessage = "", bool enableConfigure = true)
        {
            Log.Debug();
            Log.Debug("Calling isCalibratingActuator");

            if (isCalibratingActuator(source))
            {
                _calibratingActuatorEx.OnEndCalibration(errorMessage, enableConfigure);

                Log.Debug("Setting calibratingActuatorEx to null");
                _calibratingActuatorEx = null;
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Invoked when calibration is canceled for the
        /// specified actuator
        /// </summary>
        /// <param name="source">source actuator</param>
        public void OnCalibrationCanceled(IActuator source)
        {
            source.OnCalibrationCanceled();

            Log.Debug("Entered ActuatorManger.OnCalibrationCanceled");
            if (isCalibratingActuator(source))
            {
                source.OnCalibrationCanceled();

                _calibratingActuatorEx.OnEndCalibration();
                _calibratingActuatorEx = null;
            }
        }
Exemplo n.º 28
0
        static Offset <FActuator> Serialise(FlatBufferBuilder b, IActuator actuator, string identifier)
        {
            var n = b.CreateString(identifier);

            FActuator.StartFActuator(b);
            FActuator.AddActuatorName(b, n);
            FActuator.AddActuatorRange(b,
                                       FRange.CreateFRange(b,
                                                           actuator.MotionSpace.DecimalGranularity,
                                                           actuator.MotionSpace.Max,
                                                           actuator.MotionSpace.Min,
                                                           actuator.MotionSpace.NormalisedBool));
            return(FActuator.EndFActuator(b));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Returns true if the indicated actuator is the one
        /// being calibrated currently
        /// </summary>
        /// <param name="actuator"></param>
        /// <returns></returns>
        private bool isCalibratingActuator(IActuator actuator)
        {
            Log.Debug("isCalibrating: " + actuator.Name + " calibratingActuatorEx is null:" + (_calibratingActuatorEx == null));
            if (_calibratingActuatorEx != null)
            {
                Log.Debug("calibratingActuatorEx.SourceActuator: " + _calibratingActuatorEx.SourceActuator.Name);
            }

            bool retVal = _calibratingActuatorEx != null && _calibratingActuatorEx.SourceActuator == actuator;

            Log.Debug("isCalibrating: returning " + retVal);

            return(retVal);
        }
Exemplo n.º 30
0
        public void OnCalibrationCanceled(IActuator source)
        {
            source.OnCalibrationCanceled();

            Log.Debug("Entered ActuatorManger.OnCalibrationCanceled");
            if (isCalibratingActuator(source))
            {
                source.OnCalibrationCanceled();

                calibratingActuatorEx.OnEndCalibration();
                calibratingActuatorEx = null;

                //Debug.WriteLine("CANCELED!! SETTING CALIBRATINGACUTAOTRX to NULL");
                //calibratingActuatorEx = null;
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// All calibration requests are queued and handled in the order
        /// they were requested.  Actuators should call this function to
        /// indicate that they want to calibrate
        /// </summary>
        /// <param name="source">the requesting actuator</param>
        public void RequestCalibration(IActuator source)
        {
            if (calibrationQueue.Contains(source) || isCalibratingActuator(source))
            {
                Log.Debug("Already queued up or currently processing");
                return;
            }

            var aex = _actuators.find(source);

            if (aex != null)
            {
                aex.RequestCalibration();
                calibrationQueue.Enqueue(aex);
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// </summary>
        /// <param name="actuator"></param>
        /// <param name="identifier"></param>
        public void UnRegister(IActuator actuator, string identifier)
        {
            if (this._Actuators != null)
            {
                if (this._Actuators.ContainsKey(identifier))
                {
          #if NEODROID_DEBUG
                    if (this.Debugging)
                    {
                        Debug.Log($"Actor {this.name} unregistered Actuator {identifier}");
                    }
          #endif

                    this._Actuators.Remove(identifier);
                }
            }
        }
Exemplo n.º 33
0
 /// <summary>
 /// Invoked if the calibration has a timeout period and the
 /// period expires.
 /// </summary>
 /// <param name="source">Actuator being calibrated</param>
 public void OnCalibrationPeriodExpired(IActuator source)
 {
     source.OnCalibrationPeriodExpired();
 }
Exemplo n.º 34
0
 /// <summary>
 /// The actuator should invoke this function to indicate end
 /// of calibration. 
 /// </summary>
 /// <param name="source">actuator being calibrated</param>
 /// <param name="errorMessage">any error during calibration?</param>
 /// <param name="enableConfigure">should the "configure" be enabled</param>
 public void OnEndCalibration(IActuator source, String errorMessage = "", bool enableConfigure = true)
 {
     Log.Debug("Entered ActuatorManger.EndCalibration");
     if (isCalibratingActuator(source))
     {
         calibratingActuatorEx.OnEndCalibration(errorMessage, enableConfigure);
         Log.Debug("SETTING CALIBRATINGACUTAOTRX to NULL");
         calibratingActuatorEx = null;
     }
 }
Exemplo n.º 35
0
 internal ActuatorEx find(IActuator actuator)
 {
     return _actuatorsEx.FirstOrDefault(ac => ac.SourceActuator == actuator);
 }
        private string UpdateActuatorState(IActuator actuator, MessageContext messageContext)
        {
            if (messageContext.IdentifiedComponentStates.Count == 0)
            {
                return $"{Emoji.Confused} Was soll ich damit machen?";
            }

            if (messageContext.IdentifiedComponentStates.Count > 1)
            {
                return $"{Emoji.Confused} Das was du möchtest ist nicht eindeutig.";
            }

            if (!actuator.SupportsState(messageContext.IdentifiedComponentStates.First()))
            {
                return $"{Emoji.Hushed} Das wird nicht funktionieren.";
            }

            actuator.SetState(messageContext.IdentifiedComponentStates.First());
            return $"{Emoji.ThumbsUp} Habe ich erledigt. Kann ich noch etwas für dich tun?";
        }
Exemplo n.º 37
0
 /// <summary>
 /// Invoke this to indicate that the settings dialog should be displayed
 /// </summary>
 /// <param name="source"></param>
 internal void OnDialogRequest(IActuator source)
 {
     var aex = _actuators.find(source);
     if (aex != null)
     {
         aex.OnDialogRequest();
     }
 }
Exemplo n.º 38
0
 /// <summary>
 /// Actuator can invoke this function to indicate any error.  The error
 /// dialog is displayed
 /// </summary>
 /// <param name="source">source acutator that had the error</param>
 /// <param name="message">error message</param>
 /// <param name="enableConfigure">should "configure" button be enabled?</param>
 public void OnError(IActuator source, String message, bool enableConfigure = true)
 {
     var aex = _actuators.find(source);
     if (aex != null)
     {
         aex.OnError(message, enableConfigure);
     }
 }
Exemplo n.º 39
0
        public void OnCalibrationCanceled(IActuator source)
        {
            source.OnCalibrationCanceled();

            Log.Debug("Entered ActuatorManger.OnCalibrationCanceled");
            if (isCalibratingActuator(source))
            {
                source.OnCalibrationCanceled();

                calibratingActuatorEx.OnEndCalibration();
                calibratingActuatorEx = null;

                //Debug.WriteLine("CANCELED!! SETTING CALIBRATINGACUTAOTRX to NULL");
                //calibratingActuatorEx = null;
            }
        }
Exemplo n.º 40
0
 /// <summary>
 /// Returns true if the indicated actuator is the one
 /// being calibrated currently
 /// </summary>
 /// <param name="actuator"></param>
 /// <returns></returns>
 private bool isCalibratingActuator(IActuator actuator)
 {
     return calibratingActuatorEx != null && calibratingActuatorEx.SourceActuator == actuator;
 }
Exemplo n.º 41
0
 /// <summary>
 /// Actuator should invoke this to indicate asyc initialization has
 /// ended
 /// </summary>
 /// <param name="source">The source actuator</param>
 /// <param name="success">was init successful?</param>
 public void OnInitDone(IActuator source, bool success = true)
 {
     var aex = _actuators.find(source);
     if (aex != null)
     {
         aex.OnInitDone(success);
     }
 }
Exemplo n.º 42
0
        /// <summary>
        /// All calibration requests are queued and handled in the order
        /// they were requested.  Actuators should call this function to
        /// indicate that they want to calibrate
        /// </summary>
        /// <param name="source">the requesting actuator</param>
        public void RequestCalibration(IActuator source)
        {
            if (calibrationQueue.Contains(source) || isCalibratingActuator(source))
            {
                Log.Debug("Already queued up or currently processing");
                return;
            }

            var aex = _actuators.find(source);

            if (aex != null)
            {
                aex.RequestCalibration();
                calibrationQueue.Enqueue(aex);
            }
        }
Exemplo n.º 43
0
 /// <summary>
 /// Updates the calibration status in the calibration form.
 /// </summary>
 /// <param name="source">Source actuator</param>
 /// <param name="caption">caption for the form</param>
 /// <param name="prompt">message to display on the form</param>
 /// <param name="timeout">calibration timeout</param>
 /// <param name="enableConfigure">should "Configure" button be enabled?</param>
 public void UpdateCalibrationStatus(IActuator source, String caption, String prompt, int timeout = 0, bool enableConfigure = true)
 {
     if (isCalibratingActuator(source))
     {
         calibratingActuatorEx.UpdateCalibrationStatus(getCalibrationFormPosition(), caption, prompt, timeout, enableConfigure);
     }
 }
    // Use this for initialization
    private void Awake()
    {
        this.draw = true;
        NavMeshPathGraph navMesh = NavigationManager.Instance.NavMeshGraphs[0];

        this.character = new DynamicCharacter(this.characterAvatar);
        this.Pedestrians = new List<GameObject>(GameObject.FindGameObjectsWithTag("Pedestrian")).ConvertAll(p => new Pedestrian(p));

        // Targeter
        TargeterComponent = new Targeter(this);

        // Decomposer
        DecomposerComponent = new Decomposer(this, navMesh, this.character);

        // TargetCollisionConstraint
        PathConstraints = new List<IConstraint>();
        PathConstraints.Add(new PedestrianAvoidanceConstraint(this, character, this.Pedestrians));
        PathConstraints.Add(new PathValidityCheckConstraint(this.character));

        // Movement Constraints
        MovementConstraints = new List<IConstraint>();
        StaticObstacleConstraint obsConstraint = new StaticObstacleConstraint(character)
        {
            AvoidMargin = 10f
        };

        MovementConstraints.Add(obsConstraint);

        if (CharacterInUse.Equals(CharacterType.Car))
        {
            Actuator = new CarActuator(this.character);
        }
        else if (CharacterInUse.Equals(CharacterType.Human))
        {
            Actuator = new HumanActuator(this.character);
        }
    }
        public TurnOnAndOffAutomation WithTarget(IActuator actuator)
        {
            if (actuator == null) throw new ArgumentNullException(nameof(actuator));

            _turnOnActions.Add(() => actuator.SetState(BinaryStateId.On));
            _turnOffActions.Add(() => actuator.SetState(BinaryStateId.Off));

            return this;
        }
Exemplo n.º 46
0
 /// <summary>
 /// Initializes an instance of the class
 /// </summary>
 /// <param name="src">The inner actuator object</param>
 public ActuatorEx(IActuator src)
 {
     SourceActuator = src;
 }