Sunday, December 20, 2009

The Deadline

After my last post, I emailed my professor asking for help on the questions I was stuck on. He got back to me early yesterday giving me a lot of time to  (thanks!). Here are some realizations that followed.

In my last post, I noticed some very strange behavior from the model. The responses I was getting didn't agree with the LTI model responses. Turns out there were two problems. First, my selection of a time delay block was not the best choice. Since the rest of the model uses blocks intended for continuous time and the time delay block is explicitly discrete time, the response was undefined. My professor added the integrator block in its place and rewired signals accordingly.



I don't think this problem could have been avoided. I still consider myself a Simulink novice. A problem like this has to be tripped over before you can really understand what's going on under the hood, a classic learn-from-your-mistakes scenario.

Running the model with a initial angle offset of 5 was way to high for the non-linear simulation. Units for the angle of the platform in both the linear and non-linear models is radians. Since the linear model is reachable, it will glady map any input you give it to some 'reasonable' output. However, using 5rad (~280°) on the non-linear simulation model was sure to deliver unstable behavior. This violates the assumption from an earlier post that the angle will remain small.

This could have been avoided if I was more diligent tracking units through the modelling process. At the time that I arbitrarily picked 5 for the initial angle offset, if I had realised that the model was expecting radians at the time, I would have set a value that was more appropriate.

The following two charts show the response in the system and actuation after the corrections have been made. Poles are set to -3+i and -3-i, and initial angle offset is .35rad.





With these lessons learned, I prepared to build the software for the control. This would help me identify appropriate poles in conjunction with the characteristic polynomial identified in my last post.

A few basic properties and conversion factors needed to be found first. For example, the accelerometer outputs 0 → 50 when pitching up (leaning backward) from 0° → 90°, and 255 → 204 when pitching down (leaning forward) over the same range. Once converted to the same range of 0 → 50, scaled by (π/2)/50 (~0.0314). This is handled in one of two switch blocks in the section labelled "Raw Data Conversion to Radians". Another conversion needed to take place to get the velocity value into the motors. After doing some testing, 100% power correlates to ~.30897m/s.



Everything seemed ready for the first test, so I went forward with installing the software on the NXT, and for the first time ever... nothing happend. There was an "Error: Unknown error - Download program" error reported back from the transfer. Baffled, I did some research online. On forum post suggested re-flashing the firmware on the device. I gave it a try. In the middle of the "Preparing the NXT..." step, the NXT began to make a clicking sound. Figuring it was part of the flash procedure, I let it click for about fifteen minutes with no progress. Frustrated, I cancelled the flash restarted my computer and the NXT, and still nothing but clicks from the NXT. I believe that the unit did not fully accept the re-flash from my computer, and some additional time will be needed to debug the problem.

No comments: