us.ihmc.robotics.filters.ZeroLagLowPassFilter类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中us.ihmc.robotics.filters.ZeroLagLowPassFilter类的一些代码示例,展示了ZeroLagLowPassFilter类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroLagLowPassFilter类的具体详情如下:
包路径:us.ihmc.robotics.filters.ZeroLagLowPassFilter
类名称:ZeroLagLowPassFilter

ZeroLagLowPassFilter介绍

暂无

代码示例

代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit

public static void main(String[] args)
  {
   ArrayList<Double> list = new ArrayList<Double>();
   
   double[] newList = new double[10];
   for(int i=0; i<10; i++)
   {
     list.add((double)i + 1);
     newList[i]=i+ 1;
   }
   
//      System.out.println("Original List:");
//      ArrayTools.printArray(newList, System.out);
//      System.out.println("");
   
//      ZeroLagLowPassFilter.preAndPostPendedToList(list);
//      
//      ArrayTools.printArray(list, System.out);

   double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(newList, 0.5);
   
   System.out.println(Arrays.toString(filteredList));
  }

代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit

preAndPostPendedToList(arrayListToFilter);
double[] reverseOrderFilteredList = getReserveredOrderedArrayCopy(filteredList);
filteredList = getReserveredOrderedArrayCopy(filteredList);

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public static void main(String[] args)
  {
   ArrayList<Double> list = new ArrayList<Double>();
   
   double[] newList = new double[10];
   for(int i=0; i<10; i++)
   {
     list.add((double)i + 1);
     newList[i]=i+ 1;
   }
   
//      System.out.println("Original List:");
//      ArrayTools.printArray(newList, System.out);
//      System.out.println("");
   
//      ZeroLagLowPassFilter.preAndPostPendedToList(list);
//      
//      ArrayTools.printArray(list, System.out);

   double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(newList, 0.5);
   
   System.out.println(Arrays.toString(filteredList));
  }

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

preAndPostPendedToList(arrayListToFilter);
double[] reverseOrderFilteredList = getReserveredOrderedArrayCopy(filteredList);
filteredList = getReserveredOrderedArrayCopy(filteredList);

代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit

/**
* This is a zero phase lag filter with the same performance and the Matlab filtfilt function
* when the filter type is a first order low pass filter. This will extrapolate beginning and end of data sequence using a "reflection method".  
* Slopes of original and extrapolated sequences match at the end points. This reduces end effects.
* @param arrayToFilter
* @param alpha this is [0, 1]. 0 = no filter, 1= all filter.
* @return
*/
public static ArrayList<Double> getFilteredArray(ArrayList<Double> arrayToFilter, double alpha)
{
  double[] filteredArray = getFilteredArray(ArrayUtils.toPrimitive(arrayToFilter.toArray(new Double[arrayToFilter.size()])), alpha);
 return new ArrayList<Double>(Arrays.asList(ArrayUtils.toObject(filteredArray)));
 
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

/**
* This is a zero phase lag filter with the same performance and the Matlab filtfilt function
* when the filter type is a first order low pass filter. This will extrapolate beginning and end of data sequence using a "reflection method".  
* Slopes of original and extrapolated sequences match at the end points. This reduces end effects.
* @param arrayToFilter
* @param alpha this is [0, 1]. 0 = no filter, 1= all filter.
* @return
*/
public static ArrayList<Double> getFilteredArray(ArrayList<Double> arrayToFilter, double alpha)
{
  double[] filteredArray = getFilteredArray(ArrayUtils.toPrimitive(arrayToFilter.toArray(new Double[arrayToFilter.size()])), alpha);
 return new ArrayList<Double>(Arrays.asList(ArrayUtils.toObject(filteredArray)));
 
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testZeroFiltering()
{
 double[] list = new double[10];
 for(int i=0; i<10; i++)
 {
   list[i]=i+ 1;
 }
 double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(list, 0.0);
 
 assertEquals(list.length, filteredList.length);
 
 for(int i=0; i < list.length; i++)
 {
   assertEquals(list[i], filteredList[i], 1e-8);
 }
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
  @Test(timeout = 30000)
  public void testZeroNonZeroAlpha2()
  {
   double[] list = new double[10];
   for(int i=0; i<10; i++)
   {
     list[i]=i+ 1;
   }
 
   double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(list, 0.3);
   
   assertEquals(list.length, filteredList.length);
   
   double[] answer = new double[]{  1.008900871140671, 2.002669570468903, 3.000798568229678, 4.000231894098929, 5.000043980329763, 5.999927901099211, 6.999694060330704, 7.998960518102349, 8.996529155441165, 9.988428746667216};
   
   assertEquals(answer.length, filteredList.length);

   for(int i=0; i < list.length; i++)
   {
     assertEquals(answer[i], filteredList[i], 1e-8);
   }
  }
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testZeroNonZeroAlpha()
{
 double[] list = new double[10];
 for(int i=0; i<10; i++)
 {
   list[i]=i+ 1;
 }
 double[] filteredList = ZeroLagLowPassFilter.getFilteredArray(list, 0.5);
 
 assertEquals(list.length, filteredList.length);
 
 double[] answer = new double[]{ 1.083089195191860, 2.041178390383720, 3.019856780767441, 4.008463561534882, 5.001302123069763, 5.994791746139526, 6.985677242279053, 7.969401359558106, 8.937826156616211, 9.875164031982422};
 
 assertEquals(answer.length, filteredList.length);
 for(int i=0; i < list.length; i++)
 {
   assertEquals(answer[i], filteredList[i], 1e-8);
 }
}

相关文章