예제 #1
0
    def getComVelocity(self, pointFrequency, method="spline"):
        """
            Get global linear velocity of the centre of mass

            :Parameters:
                - `pointFrequency` (double) - point frequency
                - `method` (str) - derivation method (spline, spline fitting)

            :Return:
                - `values` (numpy.array(n,3)) - values of the com velocity

            .. note :: if method doesnt recognize, numerical first order derivation is used

        """

        if method == "spline":
            values = derivation.splineDerivation(self.getComTrajectory(),
                                                 pointFrequency,
                                                 order=1)
        elif method == "spline fitting":
            values = derivation.splineFittingDerivation(
                self.getComTrajectory(), pointFrequency, order=1)
        else:
            values = derivation.firstOrderFiniteDifference(
                self.getComTrajectory(), pointFrequency)

        return values
예제 #2
0
    def getComAcceleration(self,pointFrequency,method = "spline", **options):
        """
            Get global linear acceleration of the centre of mass

            :Parameters:
                - `pointFrequency` (double) - point frequency
                - `method` (str) - derivation method (spline, spline fitting)
                - `**options` (kwargs) - options pass to method.

            :Return:
                - `values` (numpy.array(n,3)) - values of the com acceleration

            .. attention :: com trajectory can be smoothed  by calling fc and order, the cut-off frequency and the order of the low-pass filter respectively


            .. note ::

                if method doesnt recognize, numerical second order derivation is used


        """

        valueCom = self.getComTrajectory()
        if "fc" in options.keys() and  "order" in options.keys():
            valueCom = signal_processing.arrayLowPassFiltering(valueCom,pointFrequency,options["order"],options["fc"]  )

        if method == "spline":
            values = derivation.splineDerivation(valueCom,pointFrequency,order=2)
        elif method == "spline fitting":
            values = derivation.splineFittingDerivation(self.getComTrajectory(),pointFrequency,order=2)
        else:
            values = derivation.secondOrderFiniteDifference(valueCom,pointFrequency)

        return values