Example #1
0
 def getDesiredMoments(self, rocketState, environment, targetOrientation,
                       time, dt):
     '''
         Inputs: 
             gainKeyList:        iterable of length nKeyColumns, containing the data required to interpolate the PIDxy and PIDz coefficients in the gain table
             rocketState:        must have .orientation attribute (Quaternion)
             targetOrientation:  (Quaternion)
             _:                  currently unused (time argument)
             dt:                 (numeric) time since last execution of the control system
     '''
     orientationError = self._getOrientationError(rocketState,
                                                  targetOrientation)
     gainKeyList = AeroParameters.getAeroPropertiesList(
         self.keyFunctionList, rocketState, environment)
     self.updateCoefficientsFromGainTable(gainKeyList)
     return self.getNewSetPoint(orientationError, dt)
Example #2
0
    def _getAeroCoefficients(self, state, environment):
        keys = AeroParameters.getAeroPropertiesList(self.parameterFunctions,
                                                    state, environment)

        if len(keys) > 1:
            # Multi-dimensional linear interpolation
            interpolatedCoefficients = self._interpAeroCoefficients(keys)[0]
        else:
            # 1D linear interpolation
            interpolatedCoefficients = linInterp(self.keys, self.values,
                                                 keys[0])

        aeroCoefficients = [0.0] * 5
        for i in range(len(interpolatedCoefficients)):
            indexInCoeffArray = self.aeroCoeffIndices[i]
            aeroCoefficients[indexInCoeffArray] = interpolatedCoefficients[i]

        return aeroCoefficients
Example #3
0
    def setTargetActuatorDeflections(self, desiredMoments, state, environment,
                                     time):
        '''
            Inputs:
                desiredMoments: (3-length iterable) contains desired moments about the x,y,and z axes
                time:           time at which the moments are requested (time of current control loop execution)
        '''
        # Construct key vector, starting with non-moment components:
        keyVector = AeroParameters.getAeroPropertiesList(
            self.keyFunctionList, state, environment)
        for desiredMoment in desiredMoments:
            keyVector.append(desiredMoment)

        newActuatorPositionTargets = self._getPositionTargets(*keyVector)

        for i in range(len(self.actuatorList)):
            self.actuatorList[i].setTargetDeflection(
                newActuatorPositionTargets[i], time)

        return list(newActuatorPositionTargets)