Dear Steve , i don't have a big background in tuning LQR control system i have been reading a lot, but i don't find a book/web where teach you tecniques to chose the Q matrix and the P, and i like to add to the gelway a second control loop wich calculate the pwm offset to mantein the gelway in a desired body yaw angle, for make more easy the navegation. can you help me to calculate that ?.

Hey Phillip, the LQR was one of the harder things for me to understand. I best it off the NXTway-GS documentation, it should be floating around in one of my references. My superviser for the project was like a Control Systems guru so he sought of steered me through the LQR. I used Matlab to determine Q and P values.

In regards to the second loop I believe it could be possible but it really isn't my strong point, and I probably be less help then good. During my project I tried to contact the NXTway-GS people but never got a response, maybe you might have better luck.

Hi Steve, again following your steps, I have been trying to simulate the diagram of Figure 2.6: Marvin servo controller block diagram, using the files GELway.my GELway Controller.m, but the simulation did not converge, and i know that the files are correct because the simulation of the digram of NXTwayGS works fine, could you share the filesystems. mdl with me?, plus can you tell me why you say that the first signal is thetha_ref-thetha if in the figure 2.6 is thetha-thetha_ref? appreciate your help

I've been trying to get this program working with no luck. I've compiled the source code with Lejos 0.8.5. I have made the following changes:
- Change the "port.readValue()" with "gyro.readValue()" using the class GyroSensor in Lejos. If I try to read directly from the port I always get a 0 value.
- Delete the EOPD code, since I am not using this sensor.

The program compiles well but the robot doesnt get upright. I've been watching at the values that I get from the Gyro Sensor and I think is not working well. When it get calibrated I get a value of "3" for the offset. Then, when the robot tilt the values from the gyro are in the range +/- 0-100. I've read that you get an offset of 600 aproximately and a values of the gyro acceleration between 0 al 1023. is this correct? I think the problem could be that the code is made for a range of values from 0 to 1023 not from 0 to 100 that is what I'm getting.

What value you obtain for the offset? And what range for the gyro acceleration?

// Make sure we only add to the sum when there has actually // been a previous call (delta_t == now if its the first call). if (delta_t != now) { angle += getAngleVelocity() * ((double) delta_t / 1000.0); } lastGetAngleTime = now;

For any of you interested in a Segway robot, you should take a look at leJOS 0.9.0 there is a new sample program SegwayPilotDemo, that provides pretty much everything you need to get a Segway up and running...

Hey, sorry haven't been on here in ages. The source code for the robot can be found at http://code.google.com/p/gelway/ As for disabling the EOPD sensor, let me know if you still need help, and I can revisit my code, it's probably written in my thesis somewhere, it's been a few years