martes, 4 de enero de 2011

NXT Two Wheels Keys

The two-wheeled inverted pendulum (Two Wheels) is a variant of the typical engineering problem of inverted pendulum on a moving truck. In this version introduces new control variables associated with the two axes of rotation that has the new system, as well as moments of inertia of the motors.


The solution implemented with LEGO MINDSTORMS NXT known for his tremendous mechanical simplicity. Any provision of two motors and wheels on the LEGO kit applies to stabilize an inverted pendulum. In fact, the NXT Tribot (three-wheeled robot base) can also be used as TwoWheels


As noted, I have used in this case for a TwoWheels Tribot


This was my first version of the inverted pendulum:


Really the key component in this solution is a device called GyroSensor HiTechnics.


The HiTechnics GyroSensor is a component designed for LEGO NXT compatible with the I2C serial communications interface that provides a measure of the speed of rotation on an axis. In our case, NXT TwoWheels the GyroSensor lets us know the speed of rotation in units of degrees per second, ranging from 0 to 1024, returning a value close to 512 at rest.

The following chart shows GyroSensor response to a swing, square wave.


The following table shows the integral of the previous graph:

The first experience before facing the pendulum should be invested directly characterize the sensor and perform some previous practice of measuring tilt, where we learn to make two key exercises: Bias Estimation and Numerical integration.

The numerical integration is the process by which we estimate the absolute position of our inverted pendulum, from the speed (with a bit of memory recall that dx / dt is the rate, and conversely the integral of velocity, is the position. According to this principle we should integrate GyroSensor measurement or by a method RungeKutta or by first-order linear integration, which in our case will suffice.

The Bias factor is the reference measurement (theoretically 512), we estimate, because its exact value is unknown, since it depends on manufacturing processes and further varies with temperature. Its value therefore must be upheld at all times.

When we have the integral position value and the value of bias, we can determine the absolute position in degrees of inclination of the platform, as the difference between the Integral and Bias.

Although it seems a bit complicated, making a simple practice of "standard mail" with a single engine means the dynamics quickly. (This is to make a small program that keeps a beam level with GyroSensor solidarity, which always keep it horizontal but revolve with the platform).

And from there, once dominated the extent of GyroSensor the problem of stabilizing the inverted pendulum can be addressed using a dual classic PID controller (Proportional-Integral-Derivative) the first PID to the tilt and the second PID control TwoWheels our position if we do not want to go running around the house until it crashed against a wall.

Position control is easily solved by changing the reference desired position Xo of our PID position. The first experience can be solved by a timer thread that reference this position moves at constant speed, but more interesting is controlled via Bluetooth that reference.

Bluetooth communication is very easy to program, since both the LEGO NXT and the PC communication port implementing a standard COM series and from there, simply send a little message every time we wish to increase or decrease the reference position.

Basically this is the mental guide we must follow to understand the development of our TwoWheels.


I hope you enjoy this project as much as me.

Other Projects: aquí.
Other Blogs: http://ballbotexcel.blogspot.com/  http://nxtballbot.blogspot.com/

4 comentarios:

  1. NXT Two Wheels Keys is a great blog,it is very useful. Thanks for it!!

    Wheel balancers

    ResponderEliminar
  2. Your blog is interesting and informative too. I have fully read your blog. Thanks for sharing your views. Wheel balancers.

    ResponderEliminar
  3. Hello Tomás,

    I’m making a lego Mindstorms balancing robot, like a Segway, using the gyro sensor from a Nintendo Wii. It balances OK (I modified some code from here: http://robotsquare.com/2012/02/13/tutorial-segway-with-robotc/ ) but it is very jerky when I try to make it move.

    I looked at lots of youtube videos of this kind of robot, and yours seemed to be the best! I wondered if you would share your source code?

    I saw in the blog post that you used 2 PID controllers, but didn’t quite understand what the inputs are, and how you combine the outputs.

    I realise that it is a long time since you did this, I hope you can still remember something about it!

    Thanks,

    Ian.

    ResponderEliminar