internal MotorServiceImpl(MotorControllerPrx proxy) { this.proxy = proxy; numMotors = 4; // todo: this should be retrieved from the qwerk // create and initialize the all-on mask array maskAllOn = new bool[numMotors]; for (int i = 0; i < maskAllOn.Length; i++) { maskAllOn[i] = true; } // create the array used for zero velocity/position and default acceleration nullIntArray = new int[numMotors]; defaultAccelerationArray = new int[numMotors]; for (int i = 0; i < numMotors; i++) { defaultAccelerationArray[i] = DEFAULT_ACCELERATION; } // build the mask arrays for each motor and store them in a map indexed on motor id motorIdToMaskArrayMap = new Dictionary<int, bool[]>(numMotors); for (int i = 0; i < numMotors; i++) { bool[] mask = new bool[numMotors]; mask[i] = true; motorIdToMaskArrayMap.Add(i, mask); } // build the motor mode arrays and store them in a map indexed on motor mode motorModeToModeArrayMap = new Dictionary<MotorMode, MotorMode[]>(numMotors); MotorMode[] motorModeOffArray = new MotorMode[numMotors]; MotorMode[] motorModePositionControlArray = new MotorMode[numMotors]; MotorMode[] motorModeSpeedControlArray = new MotorMode[numMotors]; for (int i = 0; i < numMotors; i++) { motorModeOffArray[i] = MotorMode.MotorOff; motorModePositionControlArray[i] = MotorMode.MotorPositionControl; motorModeSpeedControlArray[i] = MotorMode.MotorSpeedControl; } motorModeToModeArrayMap.Add(MotorMode.MotorOff, motorModeOffArray); motorModeToModeArrayMap.Add(MotorMode.MotorPositionControl, motorModePositionControlArray); motorModeToModeArrayMap.Add(MotorMode.MotorSpeedControl, motorModeSpeedControlArray); }
internal MotorServiceImpl(MotorControllerPrx proxy) { this.proxy = proxy; numMotors = 4; // todo: this should be retrieved from the qwerk // create and initialize the all-on mask array maskAllOn = new bool[numMotors]; for (int i = 0; i < maskAllOn.Length; i++) { maskAllOn[i] = true; } // create the array used for zero velocity/position and default acceleration nullIntArray = new int[numMotors]; defaultAccelerationArray = new int[numMotors]; for (int i = 0; i < numMotors; i++) { defaultAccelerationArray[i] = DEFAULT_ACCELERATION; } // build the mask arrays for each motor and store them in a map indexed on motor id motorIdToMaskArrayMap = new Dictionary <int, bool[]>(numMotors); for (int i = 0; i < numMotors; i++) { bool[] mask = new bool[numMotors]; mask[i] = true; motorIdToMaskArrayMap.Add(i, mask); } // build the motor mode arrays and store them in a map indexed on motor mode motorModeToModeArrayMap = new Dictionary <MotorMode, MotorMode[]>(numMotors); MotorMode[] motorModeOffArray = new MotorMode[numMotors]; MotorMode[] motorModePositionControlArray = new MotorMode[numMotors]; MotorMode[] motorModeSpeedControlArray = new MotorMode[numMotors]; for (int i = 0; i < numMotors; i++) { motorModeOffArray[i] = MotorMode.MotorOff; motorModePositionControlArray[i] = MotorMode.MotorPositionControl; motorModeSpeedControlArray[i] = MotorMode.MotorSpeedControl; } motorModeToModeArrayMap.Add(MotorMode.MotorOff, motorModeOffArray); motorModeToModeArrayMap.Add(MotorMode.MotorPositionControl, motorModePositionControlArray); motorModeToModeArrayMap.Add(MotorMode.MotorSpeedControl, motorModeSpeedControlArray); }