Esempio n. 1
0
        /**
         * Configures all peristant settings.
         *
         * @param allConfigs        Object with all of the persistant settings
         * @param timeoutMs
         *              Timeout value in ms. If nonzero, function will wait for
         *              config success and report an error if it times out.
         *              If zero, no blocking or checking is performed.
         *
         * @return Error Code generated by function. 0 indicates no error.
         */
        public ErrorCode ConfigAllSettings(VictorSPXConfiguration allConfigs, int timeoutMs = 50)
        {
            ErrorCollection errorCollection = new ErrorCollection();

            errorCollection.NewError(BaseConfigAllSettings(allConfigs, timeoutMs));

            //------ remote limit switch ----------//
            errorCollection.NewError(ConfigSetParameter(ParamEnum.eLimitSwitchSource, (float)allConfigs.forwardLimitSwitchSource, 0, 0, timeoutMs));

            errorCollection.NewError(ConfigSetParameter(ParamEnum.eLimitSwitchSource, (float)allConfigs.reverseLimitSwitchSource, 0, 1, timeoutMs));



            //--------PIDs---------------//

            errorCollection.NewError(ConfigurePID(allConfigs.primaryPID, 0, timeoutMs));

            errorCollection.NewError(ConfigurePID(allConfigs.auxilaryPID, 1, timeoutMs));

            errorCollection.NewError(ConfigSensorTerm(SensorTerm.SensorTerm_Sum0, allConfigs.sum_0, timeoutMs));

            errorCollection.NewError(ConfigSensorTerm(SensorTerm.SensorTerm_Sum1, allConfigs.sum_1, timeoutMs));

            errorCollection.NewError(ConfigSensorTerm(SensorTerm.SensorTerm_Diff0, allConfigs.diff_0, timeoutMs));

            errorCollection.NewError(ConfigSensorTerm(SensorTerm.SensorTerm_Diff1, allConfigs.diff_1, timeoutMs));


            return(errorCollection._worstError);
        }
Esempio n. 2
0
        /**
         * Gets all persistant settings.
         *
         * @param allConfigs        Object with all of the persistant settings
         * @param timeoutMs
         *              Timeout value in ms. If nonzero, function will wait for
         *              config success and report an error if it times out.
         *              If zero, no blocking or checking is performed.
         */
        public void GetAllConfigs(out VictorSPXConfiguration allConfigs, int timeoutMs = 50)
        {
            allConfigs = new VictorSPXConfiguration();

            BaseGetAllConfigs(allConfigs, timeoutMs);

            GetPIDConfigs(out allConfigs.primaryPID, 0, timeoutMs);
            GetPIDConfigs(out allConfigs.auxilaryPID, 1, timeoutMs);
            allConfigs.sum_0  = (RemoteFeedbackDevice)ConfigGetParameter(ParamEnum.eSensorTerm, 0, timeoutMs);
            allConfigs.sum_1  = (RemoteFeedbackDevice)ConfigGetParameter(ParamEnum.eSensorTerm, 1, timeoutMs);
            allConfigs.diff_0 = (RemoteFeedbackDevice)ConfigGetParameter(ParamEnum.eSensorTerm, 2, timeoutMs);
            allConfigs.diff_1 = (RemoteFeedbackDevice)ConfigGetParameter(ParamEnum.eSensorTerm, 3, timeoutMs);

            allConfigs.forwardLimitSwitchSource = (RemoteLimitSwitchSource)ConfigGetParameter(ParamEnum.eLimitSwitchSource, 0, timeoutMs);
            allConfigs.reverseLimitSwitchSource = (RemoteLimitSwitchSource)ConfigGetParameter(ParamEnum.eLimitSwitchSource, 1, timeoutMs);
        }