Sixteenth day

Greetings everyone!

These are the main topics covered today.

Remote control:

The reseller is still out of stock, we are considering different hardware options.

PID control:

Last time, a serial port data plotter was shared to all of you. Today, the same functionality wa acomplished but with object oriented programing (OOP), this should easily let us plot several lines (this is useful when tuning the PID controller, for example). Below, you can find the new code:

  1. import processing.serial.*;
  2. Serial Arduino;
  3. int ioval;
  4. LinePlot myLinePlot;
  5. void setup()
  6. {
  7.   size(1500,1023);
  8.   background(0);
  9.   //setup Serial
  10.   Arduino = new Serial(this, “COM3”,115200);
  11.   Arduino.bufferUntil(‘\n’);
  12.   //construct linePlot
  13.   myLinePlot = new LinePlot(1400,color(255));
  14. }
  15. void draw()
  16. {
  17.   // background reset on frame
  18.   background(0);
  19.   myLinePlot.plot();
  20. }
  21. void serialEvent (Serial Arduino)
  22.   {
  23.    ioval = int(Arduino.readStringUntil(‘\n’));
  24.    myLinePlot.addVal(ioval);
  25.   }
  26. class LinePlot
  27.   {
  28.     ArrayList wave = new ArrayList();
  29.     int waveLength;
  30.     color c;
  31.     float prevX = 0, prevY = 0;
  32.     LinePlot(int tempWaveLength,color tempC)
  33.       {
  34.         waveLength = tempWaveLength;
  35.         c = tempC;
  36.       }
  37.     void addVal(int val)
  38.       {
  39.          wave.add(val);
  40.          if(wave.size() >= waveLength)
  41.             {
  42.               wave.remove(0);
  43.             }
  44.       }
  45.     void plot()
  46.       {
  47.         stroke(c);
  48.         for(int i = 0; i < wave.size()-1; i++)
  49.           {
  50.             if(prevX == 0 && prevY == 0)
  51.               {
  52.                 prevX = i;
  53.                 prevY = ((Integer)wave.get(i));
  54.               }
  55.             line(prevX, prevY, i, ((Integer)wave.get(i)));
  56.             prevX = i;
  57.             prevY = ((Integer)wave.get(i));
  58.           }
  59.       }
  60.   }

Shield:

Some soldering here and there, the lack of various components was counterproductive, but nothing serious, it will probably be finished next week.

IMU sensor:

The calibration routine is only for octave users (software available for debian users), this means that the instalation of debian is our next step. Due to some rules of the school, we shall not install it untill next week.

Testing motors FAIL (no, we didn’t record it):

Trying to measure the response of the motors to the PWM, one of the motors broke it’s mounting and some of the cables were damaged. Happily, an emergency button was activated right on time before it was too late. The cause of this incident was the configuration of the ESC, which lead to an abrupt change of the motor’s rotational speed.

Today’s post has come to its end, we hope you have enjoyed it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s