コード例 #1
0
 public static Plotter createPlotter(String frameTitle) {
   PlotterPanel plotterPanel = new PlotterPanel();
   Plotter plotter = plotterPanel.getPlotter();
   plotter.setRangeLimit(1, 2, -.2, .2, .2, -.2);
   if (frameTitle == null) {
     frameTitle = "Plotter Panel " + plotterPanelId;
   }
   JFrame f = new JFrame(frameTitle);
   f.getContentPane().add(new JScrollPane(plotterPanel), BorderLayout.CENTER);
   f.pack();
   f.setVisible(true);
   return plotter;
 }
コード例 #2
0
  // Plot model-pred - measurement on a 2d graph
  public void showSample(int numPlotSample, String frameTitle) {

    Plotter plotter = createPlotter(frameTitle);
    // filter out zero velocity region
    int nSamples = getNumSamples();
    ArrayList<Point3d> com = new ArrayList<>(nSamples);
    ArrayList<Point3d> cop = new ArrayList<>(nSamples);
    packRobotComCopSeries(com, cop);

    for (int i = 0; i < nSamples; i += nSamples / numPlotSample) {
      plotter.addArtifact(
          new CircleArtifact("sensedCoP" + i, cop.get(i).x, cop.get(i).y, 0.005, true, Color.RED));
      plotter.addArtifact(
          new CircleArtifact("modelCoM" + i, com.get(i).x, com.get(i).y, 0.01, false, Color.RED));
    }
  }