public void TestExecuteActionsDiscrete() { var manager = new ActuatorManager(); var actuator1 = new TestActuator(ActionSpec.MakeDiscrete(new[] { 1, 2, 3, 4 }), "actuator1"); var actuator2 = new TestActuator(ActionSpec.MakeDiscrete(new[] { 1, 1, 1 }), "actuator2"); manager.Add(actuator1); manager.Add(actuator2); var discreteActionBuffer = new[] { 0, 1, 2, 3, 4, 5, 6 }; manager.UpdateActions(new ActionBuffers(Array.Empty <float>(), discreteActionBuffer)); manager.ExecuteActions(); var actuator1Actions = actuator1.LastActionBuffer.DiscreteActions; var actuator2Actions = actuator2.LastActionBuffer.DiscreteActions; TestSegmentEquality(actuator1Actions, discreteActionBuffer); TestSegmentEquality(actuator2Actions, discreteActionBuffer); }
public void TestExecuteActionsContinuous() { var manager = new ActuatorManager(); var actuator1 = new TestActuator(ActionSpec.MakeContinuous(3), "actuator1"); var actuator2 = new TestActuator(ActionSpec.MakeContinuous(3), "actuator2"); manager.Add(actuator1); manager.Add(actuator2); var continuousActionBuffer = new[] { 0f, 1f, 2f, 3f, 4f, 5f }; manager.UpdateActions(new ActionBuffers(continuousActionBuffer, Array.Empty <int>())); manager.ExecuteActions(); var actuator1Actions = actuator1.LastActionBuffer.ContinuousActions; var actuator2Actions = actuator2.LastActionBuffer.ContinuousActions; TestSegmentEquality(actuator1Actions, continuousActionBuffer); TestSegmentEquality(actuator2Actions, continuousActionBuffer); }