Read Serial array then plot it

Hello @HackinHarry,

Can you please share one of your datasets (zip) for a longer duration?

I am generating some plots in 3D and this is some of the data plotted from your posted dataset:

image

I generated some data for testing but not realistic:

image

Code (minimal) for 3D plot:

// Plotting NMEA GPGSV data (azimuth and elevation) in 3D
// Author: glv
// Date:   2023-07-16

// Inspiration:
// https://discourse.processing.org/t/read-serial-array-then-plot-it/42389

// References:
// https://github.com/esutton/gps-nmea-log-files

String [] GPGSV; 
float sNum, el0, az0;

public void settings() 
  { 
  size(400, 400, P3D); 
  }
  
public void setup()
  {
  background(0);
  // Try one of these:
  //GPGSV = loadStrings("https://raw.githubusercontent.com/HarryDrones/NACA4Series/master/GPGSV.txt");
  GPGSV = loadStrings("https://raw.githubusercontent.com/esutton/gps-nmea-log-files/master/Random_NMEA_generator.txt");
  println(GPGSV[6]); 
  println(GPGSV.length);
  delay(2000); // To see above
  colorMode(HSB, 32, 100, 100);
  }
  
public void draw()
  {
  background(0);
  surface.setTitle(nf(int(frameRate)));
  lights();
  translate(width/2, 2*height/3, -200);
  
  rotateY(frameCount*(TAU/720));
  push();
  rotateX(TAU/4);
  stroke(5, 100, 100);
  circle(0, 0, 400);
  line(0, 0, 0, 0, 0, 200);
  pop();
  
  for (int i= 0; i<GPGSV.length; i+=1) // Increase as required.
    {
    String items[] = (split(GPGSV[i], ','));
    if (items[0].equals("$GPGSV") == true) 
      {
      sNum = PApplet.parseFloat(items[4]);
      el0 = PApplet.parseFloat(items[5]);
      az0 = PApplet.parseFloat(items[6]);
      println(sNum, az0, el0);
      strokeWeight(2);

      //3D plot using transformations
      push();
      rotateY(radians(az0));
      rotateZ(radians(-el0));
      stroke(sNum, 50, 100);
      point(150, 0, 0);
      pop();      
      }
    }      
  }    

With random data (link in code):

image

:)

1 Like