public Wheel(WheelType type) { _type = type; switch (_type) { case WheelType.Wheel4: _nPositions = 4; _filterSize = FilterSize.ThreeInch; break; case WheelType.Wheel8: _nPositions = 8; _filterSize = FilterSize.TwoInch; break; case WheelType.WheelUnknown: _nPositions = 1; _filterSize = FilterSize.Unknown; break; } _positions = new FWPosition[_nPositions]; _targetPosition = -1; _name = _type.ToString(); for (int i = 0; i < _nPositions; i++) { _positions[i].filterName = _positions[i].tag = string.Empty; } _position = -1; }
private void ProcessMessage() { // Debug.Log(linearVelocity); // Debug.Log(angularVelocity); motor = hinge.motor; if (type.ToString() == "Left") { motor.targetVelocity = (float)180.0 / Mathf.PI * (2 * linearVelocity[2] + WheelSeparation * angularVelocity[1]) / (2 * WheelRadius); } else if (type.ToString() == "Right") { motor.targetVelocity = (float)180.0 / Mathf.PI * (2 * linearVelocity[2] - WheelSeparation * angularVelocity[1]) / (2 * WheelRadius); } else { motor.targetVelocity = 0; } // motor.force = 10000000000000; motor.freeSpin = false; hinge.motor = motor; hinge.useMotor = true; isMessageReceived = false; }