public HolonomicDriveTrain(IMotor frontLeft, IMotor frontRight, IMotor rearLeft, IMotor rearRight) { this.frontLeft = frontLeft; this.frontRight = frontRight; this.rearLeft = rearLeft; this.rearRight = rearRight; }
public DifferentialDriveVelocityController(IMotor leftMotor, IMotor rightMotor, IMessageBroker messageBroker, ILogger <DifferentialDriveVelocityController> logger) { _leftMotor = leftMotor; _rightMotor = rightMotor; _messageBroker = messageBroker; _log = logger; }
public SkidSteerDriveTrain(IMotor frontLeft, IMotor frontRight, IMotor rearLeft, IMotor rearRight) { this.frontLeft = frontLeft; this.frontRight = frontRight; this.rearLeft = rearLeft; this.rearRight = rearRight; }
public Controllers() { IMotor _motor = default; _motor = new UnitMotor(ServiceLocatorMonoBehaviour.GetService <CharacterController>()); ServiceLocator.SetService(new TimeRemainingController()); ServiceLocator.SetService(new Inventory()); ServiceLocator.SetService(new PlayerController(_motor)); ServiceLocator.SetService(new FlashLightController()); ServiceLocator.SetService(new WeaponController()); ServiceLocator.SetService(new InputController()); ServiceLocator.SetService(new SelectorController()); ServiceLocator.SetService(new BulletController()); ServiceLocator.SetService(new SaveDataRepository()); ServiceLocator.SetService(new LevelMakerController()); ServiceLocator.SetService(new SmartEnemyesController()); _executeControllers = new IExecute[8]; _executeControllers[0] = ServiceLocator.Resolve <TimeRemainingController>(); _executeControllers[1] = ServiceLocator.Resolve <PlayerController>(); _executeControllers[2] = ServiceLocator.Resolve <FlashLightController>(); _executeControllers[3] = ServiceLocator.Resolve <InputController>(); _executeControllers[4] = ServiceLocator.Resolve <SelectorController>(); _executeControllers[5] = ServiceLocator.Resolve <BulletController>(); _executeControllers[6] = ServiceLocator.Resolve <WeaponController>(); _executeControllers[7] = ServiceLocator.Resolve <SmartEnemyesController>(); }
public static void SetSpeedForDuration(this IMotor device, byte speed, byte power, RotateDirection direction, short duration) { speed = speed.AsAngularVelocity(direction); duration = Math.Min(Math.Max(duration, (short)0), (short)10000); power = Math.Min(Math.Max(power, (byte)0), (byte)100); var body = new List <byte>(); body.Add(device.Port); body.Add(0b00010000); body.Add(0x09); body.AddRange(BitConverter.GetBytes(duration)); body.Add(speed); body.Add(power); body.Add(0x0000); // end state body.Add(0x0000); // profile var bytes = new List <byte>(); bytes.Add((byte)(body.Count() + 2)); // Length bytes.Add(0b00000000); // Hub ID bytes.Add(0x81); // Port Output Command bytes.AddRange(body); var message = new Message(bytes.ToArray()); device.SendMessage(message); }
public static void GotoAbsolutePosition(this IMotor device, int position, byte speed, byte power) { position = Math.Min(Math.Max(position, device.MinPosition), device.MaxPosition); speed = Math.Min(Math.Max(speed, (byte)0), (byte)100); power = Math.Min(Math.Max(power, (byte)0), (byte)100); var body = new List <byte>(); body.Add(device.Port); body.Add(0b00010000); body.Add(0x0D); body.AddRange(BitConverter.GetBytes(position)); body.Add(speed); body.Add(power); body.Add(0x0000); // end state body.Add(0x0000); // profile var bytes = new List <byte>(); bytes.Add((byte)(body.Count() + 2)); // Length bytes.Add(0b00000000); // Hub ID bytes.Add(0x81); // Port Output Command bytes.AddRange(body); var message = new Message(bytes.ToArray()); device.SendMessage(message); }
public void MoveElevator(IMotor motor, ICabin cabin, IFloor floor) { DoorState tempstate = cabin.GetDoorState(); if (tempstate == DoorState.open) { _timerSensor.Stop(); cabin.UpdateDoorState(DoorState.close); floor.UpdateDoorState(DoorState.close); } if (_requestManager.HasAnyRequest()) { _elevatorDirection = _directionManager.EnsureDirection(_currentLevel, _elevatorDirection, _requestManager); _motionSensor.MoveCabin(motor, cabin, _elevatorDirection); _currentLevel = floor.GetLevel(cabin, _elevatorDirection, _currentLevel); cabin.ShowLevel(_currentLevel); floor.ShowLevel(_currentLevel); if (_requestManager.FloorHaveRequest(_currentLevel, _elevatorDirection)) { cabin.changeColorCabinButton(_currentLevel.ToString()); cabin.UpdateDoorState(DoorState.open); _levelSensor.NotifyArrival(_txtElevator, _currentLevel); } } }
public MovedFollowingObj(Transform transform, IMotor motor, float distance, float maxDistance) { _thisUnit = transform; _thisMotor = motor; this.distance = distance; this.maxDistance = maxDistance; }
static void Main(string[] args) { Console.WriteLine("Forma 1 simple factory"); MotorFactory motorFactoryMethod = new MotorFactory(); var diselMethod = motorFactoryMethod.CreateInstance(TypeMotor.Disel); Console.WriteLine(diselMethod.InyectarCombustible(20)); var gasolinaMethod = motorFactoryMethod.CreateInstance(TypeMotor.Gasolina); Console.WriteLine(gasolinaMethod.InyectarCombustible(10)); Console.ReadKey(); Console.WriteLine("Forma 2 Factory Method"); IMotorFactory motorFactory = ObtenerMotor(TypeMotor.Gasolina); IMotor gasolina = motorFactory.CreateInstance(); Console.WriteLine(gasolina.InyectarCombustible(50)); IMotor disel = ObtenerMotor(TypeMotor.Disel).CreateInstance(); Console.WriteLine(disel.InyectarCombustible(540)); Console.ReadKey(); }
private void InitFields() { _transform = transform; try { _pirate = GetComponent <IPirate>(); } catch { throw new NullReferenceException("No component that implements the IFactoryLevel interface was found."); } try { _wheel = _spaceshipWheel.GetComponent <IWheel>(); } catch { throw new NullReferenceException("Wheel field must not be null."); } try { _motor = _spaceshipMotor.GetComponent <IMotor>(); } catch { throw new NullReferenceException("No component that implements the IMotor interface was found."); } }
public Controllers() { IMotor motor = default; if (Application.platform == RuntimePlatform.PS4) { // } else { motor = new UnitMotor( ServiceLocatorMonoBehaviour.GetService <CharacterController>()); } ServiceLocator.SetService(new PlayerController(motor)); ServiceLocator.SetService(new FlashLightController()); ServiceLocator.SetService(new InputController()); _executeControllers = new IExecute[3]; _executeControllers[0] = ServiceLocator.Resolve <PlayerController>(); _executeControllers[1] = ServiceLocator.Resolve <FlashLightController>(); _executeControllers[2] = ServiceLocator.Resolve <InputController>(); }
private void OnConnectedKeyboardPage() { assignCommandsButton.Sensitive = false; SpawnThread(delegate() { brick.Vehicle.LeftPort = (MotorPort)leftMotorCombobox.GetActiveValue(); brick.Vehicle.RightPort = (MotorPort)rightMotorCombobox.GetActiveValue(); brick.Vehicle.ReverseLeft = leftMotorReverseCheckbutton.Active; brick.Vehicle.ReverseRight = rightMotorReverseCheckbutton.Active; switch ((MotorPort)motor3Combobox.GetActiveValue()) { case MotorPort.OutA: motor3 = brick.MotorA; break; case MotorPort.OutB: motor3 = brick.MotorB; break; case MotorPort.OutC: motor3 = brick.MotorC; break; } motor3.Reverse = motor3ReverseCheckbutton.Active; }, false, -1); }
private SphereAttack sphereAttack; // later we should probably interface this up so we can swap 'weapons' out private void Awake() { inputActions = new PlayerInputActions(); moter = GetComponent <IMotor>(); sphereAttack = GetComponent <SphereAttack>(); }
public Controllers() { //if (Application.platform == RuntimePlatform.PS4) IMotor motor = default; motor = new UnitMotor(ServiceLocatorMonoBehavior.GetService <CharacterController>()); ServiceLocator.SetService(new PlayerController(motor)); ServiceLocator.SetService(new Inventory()); ServiceLocator.SetService(new TimeRemainingController()); ServiceLocator.SetService(new FlashLightController()); ServiceLocator.SetService(new InputController()); ServiceLocator.SetService(new SelectionController()); ServiceLocator.SetService(new WeaponController()); ServiceLocator.SetService(new PoolController()); //ServiceLocator.SetService(new EffectController()); _executeControllers = new IExecute[5]; _executeControllers[0] = ServiceLocator.Resolve <TimeRemainingController>(); _executeControllers[1] = ServiceLocator.Resolve <PlayerController>(); _executeControllers[2] = ServiceLocator.Resolve <FlashLightController>(); _executeControllers[3] = ServiceLocator.Resolve <InputController>(); _executeControllers[4] = ServiceLocator.Resolve <SelectionController>(); }
public Car(IMotor motor, IBrake brake, ITransmission transmission, ITire tire) { this.Motor = motor; this.Brake = brake; this.Transmission = transmission; this.Tire = tire; }
private void Awake() { // this controller will be influencing a motor _motor = GetComponent <IMotor>(); // setting the target position equates to staying in place SetTargetPosition(transform.position); }
public ResourceHarvester(Entity entity, int resourceId, DReal capacity, DReal fillRate) : base(entity) { this.motor = entity.GetComponent <IMotor>(); this.resourceId = resourceId; this.capacity = capacity; this.fillRate = fillRate; this.fill = 0; }
public ResourceHarvester(Entity entity, ComponentPrototype proto) : base(entity) { this.motor = entity.GetComponent <IMotor>(); resourceId = World.current.resourceNameToId[proto.data["resource"]]; capacity = DReal.Parse(proto.data["capacity"]); fillRate = DReal.Parse(proto.data["rate"]); this.fill = 0; }
public unsafe SdlGamepad(SdlInputContext ctx, int currentIndex, int instanceId) { _ctx = ctx; InstanceId = instanceId; ActualIndex = currentIndex; VibrationMotors = new IMotor[] { new SdlMotor(0, this), new SdlMotor(1, this) }; _controller = ctx.Sdl.GameControllerOpen(currentIndex); }
public RegulatedMotor(IMotor motor) { _innerMotor = motor; lock (motors) { motors.Add(this); } }
private void Start() { if (_vehicle != null) { _motor = _vehicle.GetComponentInChildren <IMotor>(); _steering = _vehicle.GetComponentInChildren <ISteering>(); } }
public Elevator(TextBox txtElevator) { _txtElevator = txtElevator; _cabin = new Cabin(txtElevator, 0); _floor = new Floor(txtElevator); _director = new Director(txtElevator); _motor = new Motor(txtElevator); }
private elektronikBeyin(bool kontakDurum, IMotor motor) { int hiz = 0; kontak anahtar = new kontak(); anahtar.kontakKontrol(kontakDurum); motor.motorHizi(hiz); }
public MineTruck(Entity entity, ComponentPrototype proto) : base(entity) { motor = entity.GetComponent <IMotor>(); mineTypes = proto.data .Select(kv => new KeyValuePair <int, String>(World.current.resourceNameToId.ContainsKey(kv.Key) ? World.current.resourceNameToId[kv.Key] : -1, kv.Value)) .Where(kv => kv.Key != -1) .OrderBy(kv => kv.Key) .ToArray(); }
private void Awake() { _homePosition = this.transform.position; _motorAIController = GetComponent <IMotorAIController>(); _motor = GetComponent <IMotor>(); _animatorHandler = GetComponent <BatAnimatorHandler>(); }
MovedPatrol(Transform transform, GameObject[] pointMoved, IMotor motor) { _thisUnit = transform; _thisMotor = motor; for (var t = 0; t < pointMoved.Length; t++) { this.pointMoved[t] = pointMoved[t].transform.position; } }
public void Start() { childPlayer = GameObject.FindWithTag("Player"); maskPlayer = LayerMask.NameToLayer("Player"); motor = childPlayer.GetComponent<IMotor>(); mCamera = Pathways.mainCamera.transform; gameObject.GetComponentInChildren<Camera>().backgroundColor = RenderSettings.fogColor; if (mapPlayer) mapPlayer = Instantiate((mapPlayer as Object), transform.position, transform.rotation) as Transform; util::CameraFade.StartAlphaFade(RenderSettings.fogColor, true, 0.5f, 0.5f); }
public DriveServiceFactory(IMotor motor1, IMotor motor2, IMotorPinMapping pinMappingService, ILogger <DriveService> logger) { this.motor1 = motor1; this.motor2 = motor2; this.motorPinMapping = pinMappingService; this.logger = logger; motor1.Initialize(motorPinMapping.MotorPinMappings[1].ToList()); motor2.Initialize(motorPinMapping.MotorPinMappings[2].ToList()); }
/* * private void Start() * { * _thisMotor = gameObject.GetComponent<IMotor>(); * _thisVisible = gameObject.GetComponent<IVisible>(); * _lastDistance = _thisVisible.GetDistanceVisible(); * _lastAngle = _thisVisible.GetAngleVisible(); * } */ public FindAngry(Transform transform, IMotor motor, IVisible visible, float distanceFind) { _thisTransform = transform; _thisMotor = motor; _thisVisible = visible; this.distanceFind = distanceFind; _lastDistance = _thisVisible.GetDistanceVisible(); _lastAngle = _thisVisible.GetAngleVisible(); }
public void Start() { childPlayer = GameObject.FindWithTag("Player"); maskPlayer = LayerMask.NameToLayer("Player"); motor = childPlayer.GetComponent<CharacterMotor>(); mCamera = GameObject.FindGameObjectsWithTag("MainCamera")[0].transform; gameObject.GetComponentInChildren<Camera>().backgroundColor = RenderSettings.fogColor; if (mapPlayer) mapPlayer = Instantiate((mapPlayer as Object), transform.position, transform.rotation) as Transform; util::CameraFade.StartAlphaFade(RenderSettings.fogColor, true, 0.5f, 0.5f); deadtemp = Instantiate(deadPlayer,childPlayer.transform.position,childPlayer.transform.rotation) as Transform; //deadtemp.GetComponent<Rigidbody>().velocity = gameObject.GetComponentInChildren<CharacterMotor>().velocity; deadtemp.parent = transform; deadtemp.gameObject.SetActive(false); }
public DirectorManouver(TextBox text, IFloorPanel floorPanel, ICabinPanel cabinpanel, IFloorDisplay floorDisplay, ICabinDisplay cabinDisplay, IMotor motor, IDoor floorDoor, IDoor cabinDoor) { _txtElevator = text; _floorPanel = floorPanel; _cabinPanel = cabinpanel; _floorDisplay = floorDisplay; _cabinDisplay = cabinDisplay; _motor = motor; _floorDoor = floorDoor; _cabinDoor = cabinDoor; _callControl = new CallControl(); _cabinSensor = new CabinSensor(); }
public ArmMotorController() { Scarlet.Utilities.StateStore.Start("ARM"); BBBPinManager.AddMappingPWM(ShoulderPin); BBBPinManager.AddMappingPWM(ElbowPin); BBBPinManager.AddMappingPWM(WristPin1); BBBPinManager.AddMappingPWM(WristPin2); BBBPinManager.AddMappingGPIO(WristDirectionPin1, true, ResistorState.PULL_UP); BBBPinManager.AddMappingGPIO(WristDirectionPin2, true, ResistorState.PULL_UP); BBBPinManager.AddMappingADC(ShoulderPotPin); BBBPinManager.AddMappingADC(ElbowPotPin); BBBPinManager.AddMappingADC(WristPotPin); BBBPinManager.ApplyPinSettings(BBBPinManager.ApplicationMode.APPLY_IF_NONE); BeagleBone.Initialize(SystemMode.DEFAULT, true); const double DegToRad = Math.PI / 180.0; a = new Arm((0, 0, Math.PI / 2, Math.PI / 2, 0, 0, 6.8), (0, 0, -76 * DegToRad, 100 * DegToRad, 0, 0, 28.0), (0, 0, -168.51 * DegToRad, -10 * DegToRad, 0, 0, 28.0), (-2 * Math.PI, 2 * Math.PI, -Math.PI / 2, Math.PI / 2, 0, 0, 12.75)); //(0, 12.75, -Math.PI / 2, Math.PI / 2)); LowPass <float> ShoulderFilter = new LowPass <float>(); LowPass <float> ElbowFilter = new LowPass <float>(); ShoulderPWM = PWMBBB.PWMDevice1.OutputB; ElbowPWM = PWMBBB.PWMDevice1.OutputA; IPWMOutput WristPWM1 = PWMBBB.PWMDevice2.OutputB; IPWMOutput WristPWM2 = PWMBBB.PWMDevice2.OutputA; IDigitalOut WristDirectionGPIO1 = new DigitalOutBBB(WristDirectionPin1); IDigitalOut WristDirectionGPIO2 = new DigitalOutBBB(WristDirectionPin2); IAnalogueIn ShoulderADC = new AnalogueInBBB(ShoulderPotPin); IAnalogueIn ElbowADC = new AnalogueInBBB(ElbowPotPin); IAnalogueIn WristADC = new AnalogueInBBB(WristPotPin); Shoulder = new TalonMC(ShoulderPWM, 0.2f, ShoulderFilter); Elbow = new TalonMC(ElbowPWM, 0.2f, ElbowFilter); Wrist1 = new CytronMD30C(WristPWM1, WristDirectionGPIO1, 0.3f); Wrist2 = new CytronMD30C(WristPWM2, WristDirectionGPIO2, 0.3f); ShoulderPot = new Potentiometer(ShoulderADC, 300); ElbowPot = new Potentiometer(ElbowADC, 300); WristPot = new Potentiometer(WristADC, 300); }
static Offset <FMotor> serialise_motor(FlatBufferBuilder b, IMotor motor, string identifier) { var n = b.CreateString(identifier); FMotor.StartFMotor(b); FMotor.AddMotorName(b, n); FMotor.AddValidInput( b, FRange.CreateFRange( b, motor.MotionValueSpace._Decimal_Granularity, motor.MotionValueSpace._Max_Value, motor.MotionValueSpace._Min_Value)); FMotor.AddEnergySpentSinceReset(b, motor.GetEnergySpend()); return(FMotor.EndFMotor(b)); }
public VerticalDriveTrain(IMotor frontLeft, IMotor frontRight, IMotor rear) { this.frontLeft = frontLeft; this.frontRight = frontRight; this.rear = rear; }
public Wheel(Vector position, Matrix transformMatrix, IMotor motor) { Position = position; Motor = motor; Motor.NeutralMode = NeutralMode.Brake; TransformMatrix = transformMatrix; }
/// <summary> /// Vypočítá délku nohy při pohledu ze zhora /// </summary> /// <param name="motorZ">motor zdvihu nohy</param> /// <returns>délku nohy při pohledu ze zhora</returns> private double getLegLeangthFromUpView(IMotor motorZ) { int angle = motorZ.angle; if (angle > 90) { angle %= 90; } return (leangthOfLeg * Math.Sin(angle)) + 10.5; }
/// <summary> /// Otočí kolo nohy ve směru pohybu /// </summary> /// <param name="direction">směr ve stupních 0 až 359</param> /// <param name="motorZK">motor pro otáčení nohy</param> /// <param name="motorR">motor pro otáčení kola nohy</param> /// <param name="angleCorection">korekce úhlu nohy...</param> /// <returns>true pokud obrátit směr pohybu kola</returns> private bool rotateWheelForMove(int direction, IMotor motorZK, IMotor motorR, IMotor motorP, int angleCorection) { bool reverseWheelSpeed = false; int kartezLegAngle = MathLibrary.changeScale(motorZK.angle, motorZK.minAngle, motorZK.maxAngle, 0, 90); if (angleCorection < 0) { if (direction - (angleCorection - kartezLegAngle) < 0) { reverseWheelSpeed = !reverseWheelSpeed; } } else { if (direction - (angleCorection - kartezLegAngle) > 0) { reverseWheelSpeed = !reverseWheelSpeed; } } int kartezWheelAngle = 180 - 90 - (180 - direction - kartezLegAngle); kartezWheelAngle = kartezWheelAngle % 180; if (kartezWheelAngle < 0) { kartezWheelAngle += 180; reverseWheelSpeed = !reverseWheelSpeed; } int wheelAngle = kartezWheelAngle; if (Math.Abs(wheelAngle - motorR.angle) > ZKTolerance) { motorP.disable(); } motorR.moveToAngle(wheelAngle); return reverseWheelSpeed; }
private void RegisterPropeller(IMotor propellor) { for(byte ndx = 0; ndx < _propellors.Length; ndx++) { if(_propellors[ndx] == null) { _propellors[ndx] = propellor; _propellors[ndx].SetScale(MotorScale); return; } } }
/// <summary> /// Start a simulation /// </summary> /// <param name="initial">The initial state</param> /// <param name="motor">The motor object</param> /// <param name="load">The load</param> /// <param name="path">The path</param> public bool Start(IRecord initial, IMotor motor, ILoad load, IPath path, SimulationEnv env) { _record = initial; _motor = motor; _load = load; _path = path; double mass = _load.Mass + _motor.CoilMass; int count = _record.Time.Length; if (_record.Time == null || (_record.Position == null && _record.Velocity == null && _record.Acceleration == null)) return false; if (_record.Acceleration == null) _record.Acceleration = new double[count]; if (_record.Velocity == null) _record.Velocity = new double[count]; if (_record.Position == null) _record.Position = new double[count]; _record.RMSforce = Math.Pow(mass * _record.Acceleration[0], 2); if (_record.Acceleration != null && !isZero(_record.Acceleration)) { if (isZero(_record.Velocity)) { for (int i = 1; i < count; i++) { _record.Velocity[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Acceleration[i] + _record.Velocity[i - 1]; _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1]; _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2); } } else if (!isZero(_record.Velocity) && isZero(_record.Position)) { for (int i = 1; i < count; i++) { _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1]; _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2); } } else { for (int i = 1; i < count; i++) { _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2); } } } else if (_record.Velocity != null && !isZero(_record.Velocity)) { if (isZero(_record.Position)) { for (int i = 1; i < count; i++) { _record.Position[i] = (_record.Time[i] - _record.Time[i - 1]) * _record.Velocity[i] + _record.Position[i - 1]; _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]); _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2); } } else { for (int i = 1; i < count; i++) { _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]); _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2); } } } else { for (int i = 1; i < count; i++) { _record.Velocity[i] = (_record.Position[i] - _record.Position[i - 1]) / (_record.Time[i] - _record.Time[i - 1]); _record.Acceleration[i] = (_record.Velocity[i] - _record.Velocity[i - 1]) / (_record.Time[i] - _record.Time[i - 1]); _record.RMSforce += Math.Pow(mass * _record.Acceleration[i] + env.StaticFriction + env.DynamicFriction * _record.Velocity[i] + env.ThrustForce, 2); } } double efficiency = env.MechEfficiency * 0.01; _record.RMSforce = Math.Sqrt(_record.RMSforce / count) / efficiency; _record.MAXforce = (mass * _record.Acceleration.Max() + env.StaticFriction + env.DynamicFriction * _record.Velocity.Max() + env.ThrustForce) / efficiency; _record.RMScurrent = _record.RMSforce / _motor.ForceConstant; _record.MAXcurrent = _record.MAXforce / _motor.ForceConstant; _record.TemperatureRise = (Math.Pow(_record.RMSforce / _motor.MotorConstant, 2) * _motor.ThermalResistance); Write(); return true; }
//constructor public Project(IMotor motor) { _Motor = (Motor)motor; }
/// <summary> /// Bude pohybovat kolem v daném směru a vrátí rychlost ve správném směru /// </summary> /// <param name="motorZK">motor pro otáčení nohy kola</param> /// <param name="motorR">motor pro otáčení kola</param> /// <param name="motorP">motor pro pohon kola</param> /// <param name="direction">směrm kterým se má pohybovat 0 až 359</param> /// <param name="speed">rychlost jakou se má pohybovat -100 až 100</param> /// <param name="angleCorection">korekce úhlu nohy...</param> /// <return>rychlost, jakou se má motor pohybovat</return> private int setWheelToDirection(IMotor motorZK, IMotor motorR, IMotor motorP, int direction, int speed, int angleCorection) { bool reverseWheelSpeed = rotateWheelForMove(direction, motorZK, motorR, motorP, angleCorection); int rev = 1; if (reverseWheelSpeed) { rev = -1; } return speed * rev; }
public Wheel(Vector position, Vector driveAxis, Vector rollAxis, IMotor motor) : this(position, Matrix.FromCoordinateAxes(driveAxis, rollAxis), motor) { }
private void OnConnectedKeyboardPage(){ assignCommandsButton.Sensitive = false; SpawnThread(delegate() { brick.Vehicle.LeftPort = (MotorPort)leftMotorCombobox.GetActiveValue(); brick.Vehicle.RightPort = (MotorPort) rightMotorCombobox.GetActiveValue(); brick.Vehicle.ReverseLeft = leftMotorReverseCheckbutton.Active; brick.Vehicle.ReverseRight = rightMotorReverseCheckbutton.Active; switch((MotorPort) motor3Combobox.GetActiveValue()){ case MotorPort.OutA: motor3 = brick.MotorA; break; case MotorPort.OutB: motor3 = brick.MotorB; break; case MotorPort.OutC: motor3 = brick.MotorC; break; } motor3.Reverse = motor3ReverseCheckbutton.Active; },false,-1); }
protected void OnMotor3ComboboxChanged (object sender, EventArgs e) { if(brick == null) return; switch((MotorPort) motor3Combobox.GetActiveValue()){ case MotorPort.OutA: motor3 = brick.MotorA; break; case MotorPort.OutB: motor3 = brick.MotorB; break; case MotorPort.OutC: motor3 = brick.MotorC; break; } settings.Motor3 = (string) motor3Combobox.GetActiveValue(1); settings.Save(); }
// Access controls to a motor public ThrottledMotor(IMotor motor) { _motor = motor; speed = 0; }
public void ConnectFour(IMotor left, IMotor right) { _left = new ThrottledMotor(left); _right = new ThrottledMotor(right); }
public Vehiculo(IMotor motor) { this.motor = motor; }
// La implementacion de los vehículos se desarrolla de forma independiente public Berlina(IMotor motor, int capacidadMaletero) : base(motor) { this.capacidadMaletero = capacidadMaletero; }
public Robot() { Sensors = new SensorPoller(); #if NoMotors MotorA = new FakeMotor{Name = "A"}; MotorB = new FakeMotor{Name = "B"}; MotorC = new FakeMotor{Name = "C"}; #else MotorA = new DCMotor(PWM.Pin.PWM1, FEZ_Pin.Digital.Di28, FEZ_Pin.Digital.Di29) { SpeedCharacteristic = DCMotor.Characteristic.Linear }; MotorB = new DCMotor(PWM.Pin.PWM2, FEZ_Pin.Digital.Di30, FEZ_Pin.Digital.Di31) { SpeedCharacteristic = DCMotor.Characteristic.Linear }; MotorC = new DCMotor(PWM.Pin.PWM3, FEZ_Pin.Digital.Di32, FEZ_Pin.Digital.Di33) { SpeedCharacteristic = DCMotor.Characteristic.Linear }; #endif Matrix wheelMatrix = new Matrix(-60 * Math.PI, 0, 0, 12 * Math.PI); Vector wheelPosition = Vector.J * 95; Compass = new FieldHeadingFinder(new HMC6352()); Drive = new ControlledHolonomicDrive(Compass, new HolonomicDrive.Wheel( Matrix.FromClockwiseRotation(Math.PI / 3) * wheelPosition, Matrix.FromClockwiseRotation(Math.PI / 3) * wheelMatrix, // MotorA new RegulatedMotor(MotorA) ), new HolonomicDrive.Wheel( Matrix.Rotate180 * wheelPosition, Matrix.Rotate180 * wheelMatrix, // MotorB new RegulatedMotor(MotorB) ), new HolonomicDrive.Wheel( Matrix.FromClockwiseRotation(-Math.PI / 3) * wheelPosition, Matrix.FromClockwiseRotation(-Math.PI / 3) * wheelMatrix, //MotorC new RegulatedMotor(MotorC) ) ); #if USEOLDDRIVE OldDrive = new HolonomicDrive( new HolonomicDrive.Wheel( Matrix.FromClockwiseRotation(Math.PI / 3) * wheelPosition, Matrix.FromClockwiseRotation(Math.PI / 3) * wheelMatrix, MotorA ), new HolonomicDrive.Wheel( Matrix.Rotate180 * wheelPosition, Matrix.Rotate180 * wheelMatrix, MotorB ), new HolonomicDrive.Wheel( Matrix.FromClockwiseRotation(-Math.PI / 3) * wheelPosition, Matrix.FromClockwiseRotation(-Math.PI / 3) * wheelMatrix, MotorC ) ); #endif //Kicker = new Solenoid(PWM.Pin.PWM5); BallDetector = IntensityDetectorArray.FromRadialSensors(Sensors.IR); Button = new Button(FEZ_Pin.Digital.An5); LightGate = new LightGate(FEZ_Pin.AnalogIn.An0, 350, 160); LEDs = new LEDGroup(FEZ_Pin.Digital.An1, FEZ_Pin.Digital.An2, FEZ_Pin.Digital.An3, FEZ_Pin.Digital.An4); RegulatedMotor.EnableRegulatedMotorAlgorithm(true); }
// La implementacion de los vehículos se desarrolla de forma independiente public Monovolumen(IMotor motor, bool puertaCorrediza) : base(motor) { this.puertaCorrediza = puertaCorrediza; }