LEGO® Tetrix Motor Encoder Pack
4 stars based on
44 reviews
When the Connecticut Robotics Society CRS ran its motor encoders nxt robotics annual odometry and dead-reckoning event this June, the winning entry completed the First, the robot took advantage of the Lego Mindstorms rotation sensors encoders which allowed it to measure wheel position with a 1. These devices were coupled to the motors and controller in a closed-loop system that allowed the robot to monitor its performance at all times.
Competing robots complete one circuit of the course shown in gray. The wining robot is the one that finishes closest to its starting position. To do so, it must navigate four 5-foot corridors and four 1. In this article, I will discuss the dead-reckoning techniques used for the competition, and provide details motor encoders nxt robotics its implementation in the Lego Mindstorms system.
Completing the contest course required two kinds of maneuvers: I will provide background on Peeves' approach to both. My primary focus will be on the PID algorithm and how it was used to keep the robot on track when following a straight-line path. I will also discuss how the PID control logic was used to absorb orientation errors when the robot executes "not exactly degree" turns.
The Connecticut Robotics Society odometry course was constructed from the cheapest material I could find. Wood is so expensive these days that I chose PVC pipe. This article is written in the hope that the techniques that benefited one robot can also benefit others.
If you wish to adapt some of these ideas to your own projects, there should be enough information in this article to get you started web links and book references are included. Motor encoders nxt robotics also hope that true subject-matter experts will join in follow-up discussion on the robotics newsgroups, thus helping to make machine-control algorithms accessible to a wider group of robot implementers.
Figure 2 shows the basic layout of the Peeves platform. The robot was built from the stock Lego Mindstorms kit with the addition of 2 rotation sensors that motor encoders nxt robotics purchased separately.
The brain of the Mindstorm system is the RCX "brick. The drivers can also be set to brake or free-turning states. The Mindstorms kit comes with two high-efficiency 9-volt DC gearmotors that feature an internal fly wheel and reduction gearing.
Peak, unloaded motor speed is RPM when running on fresh batteries. One of the motor encoders nxt robotics appealing features motor encoders nxt robotics the Lego Mindstorms system is the speed with which a robot can be constructed.
Two months later, a completed robot was running the course. That convenience does come with certain constraints. Design options are limited by what can be accomplished using Lego parts though Lego enthusiasts like to say, "you are limited only by your imagination".
And while individual Lego components are motor encoders nxt robotics of mass-produced precision, the overall assembly of a Mindstorms system is sometimes less perfect than a robot builder would prefer.
This is particularly true with regard to the wheel and motor encoders nxt robotics systems. Peeves is heavy enough that the flex of its plastic axles give the wheels a significant and asymmetric inward tilt. When possible, the effects of these limitations were reduced through appropriate mechanical design. Of course, there are significant limits to how sophisticated a program you can write in a graphical programming environment. The stock Lego utilities were inadequate to the task motor encoders nxt robotics coding a dead-reckoning robot, so a different motor encoders nxt robotics was necessary.
Other solutions such as legOS and lejos actually replace the firmware providing more efficient and fully featured implementations. I chose NQC because it appeared to be the simplest, most easily mastered solution given the short turn-around time for my project. For example, the firmware supports a maximum of 32 variables, does not support arrays or floating-point data types, and is limited to two-byte signed integers. Some of these limitations are lifted if you install the new 2.
The firmware supports multitasking, timers, sensors, motor control, a datalog, etc. Multitasking, events and conditional branching based on sensors and motor encoders nxt robotics, but no variables or arithmetic.
A wonderful introduction to programming for a child, but not practical for any but the simplest applications. Thus, it can share the system with programs written in RCX code.
Important limitations are imposed by its dependency on the firmware. Available free of charge at http: Replaces the RCX firmware. Probably the best choice in terms of efficient use of processor, smallest image, best use of memory. Requires a separate installation of the GNU gcc compiler. If you have never installed gcc, expect to spend a week of evenings doing so.
Both replace the RCX firmware. Nearly full featured implementations of the language restricted to 4-byte integer and float data types. Motor encoders nxt robotics is quite small under 10K. Its successor, lejos is larger, but provides a Math class with sine, cosine, exponential and log functions. Requires separate installation of a Java compiler. Other Alternatives There is a surprisingly large number of alternative programming options for the RCX. Luis Villa compiled a list at http: Figure 3 shows the gear train used in Peeves.
The configuration is a compromise between the geometry imposed motor encoders nxt robotics the Lego components and the need to obtain as fine a resolution from the wheel encoders as possible. The more accurately the robot can measure wheel rotation, the more accurately it can dead-reckon.
Each motor is coupled to an encoder through a 1: The rotation sensors are rated for a maximum speed of RPM. The gear train provides a Thus, for each rotation of the wheel, the encoder rotates Although I experimented with gearing that provided a higher resolution with less backlash motor encoders nxt robotics, it exceeded the RPM sample rate supported by the sensors and had to be abandoned.
The placement of the large, tooth gears in the robot's gear train requires that Peeves use the motor encoders nxt robotics wheels provided in the Mindstorms kit. The Lego wheels are rather wide and soft for a dead-reckoning robot harder, narrow wheels provide better accuracybut provide good traction.
This value, the clickis used extensively in the Peeves software. The two gearmotors that came with the Mindstorms kit that was used to build Peeves are not perfectly matched.
Due to variations in manufacture, one runs about 5 percent slower than the other. An imbalance in motor output is important in a differential steering system because even small variations in wheel speed can result in the robot straying from a straight-line path. The default tendency for Peeves was to curve to its left. In the PID approach, a controller monitors the error in the system its deviation from some desired value, or set point and makes corrections based on three criteria.
The Proportional response is based on the magnitude of the observed error, the Integral of that error error accumulated over timeand the Derivative of the error the rate at which the error changes over time. The PID approach was the basis of the system used to control Peeves and keep it following a straight line. To illustrate the idea behind the PID technique, motor encoders nxt robotics apply it to the familiar problem of steering an automobile on highway.
We desire to keep the car in the center of its lane. If the car begins to drift to the right, we apply a correction by turning the steering wheel to the motor encoders nxt robotics to stop the movement away from the centerline.
In this case, the set point is simply for the car to travel in a straight line. We define the speed of the car's lateral movement as our observed rate of error.
The faster it moves away from the centerline, the higher the error. Naturally, a competent driver does not overcorrect. So, if the error is small, our response is small. If the error is large, our response is large. If we turn the wheel enough, the car will stop moving to the right and drive in a straight line. Motor encoders nxt robotics the car will have drifted from the center of the motor encoders nxt robotics, we will have achieved an error rate of zero because we define the error in terms of the lateral speed, not distance off-center.
Still, we do care about the car not being in the center of its lane. So we define a second kind of error, the accumulated error. And, referring back to our driving example, we realize that the correction applied to the steering is often proportional to values: If all goes well, the car will reverse its rightward drift and return to the center of its lane fairly quickly. Perhaps a little too quickly If we do not back off from the correction as motor encoders nxt robotics approach motor encoders nxt robotics center of the lane zero accumulated errorthe car will overshoot the centerline and begin to drift to the left.
If that happens, we need to make a second, counter-adjustment so that the car returns to the right. But if we over-correct, we may need another counter-adjustment to the left. If this continues, the system will oscillate. The car analogy illustrates the three basic components of the Motor encoders nxt robotics technique.
In general, we consider the instantaneous and integrated accumulated error and make a proportional adjustment. Although this adjustment is often enough, it sometimes leads to a system that tends to overcorrect and oscillate as it returns back to the set point.
In such cases, we add the third correction to help settle the system. For purposes of this discussion, we will let e t represent a general error function and use the following variation of the PID equation: There are several web sites describing the PID technique. Many books on control theory also discuss the PID technique. At least one of these is available on line: