Alpha Rex Rbt Program
Introduction
The Alpha Rex comprises probably the most complex of the RoboCenter series of robots, both from the mechanical design perspective and the software programming perspective. The following discussion will concentrate on software programming of the Alpha Rex. The program described below illustrates two advanced programming techniques: state machines and abstraction. A state machine design handles basic movements such as tilting side to side and striding the robot's feet forward and backward. Abstraction handles combining the basic movements into more complex movements, such as walking forward and turning right and left.
The Nerd's impressions: REX Weather Force 2020 for Microsoft Flight Simulator. 'REX WeatherForce 2020 does exactly what it claims to do, very accurately and very well. In my opinion it should be the first add-on you get for MSFS.' Alpha Rex Rbt Program Download. After compiling and running the program in your NXT. Alpharex.zip - This zip contains a really great program written for the NXT Alpha Rex. Contains several sample programs for the NXT. Compiled using the LEGO Mindstorms NXT software with the mtest2.rbt program. NXT 1.0 Projects by Category: Projects by Building. 1:Before running the program,the Alpha Rex's hands should be closed and pointed forward.Put your hand in front of the Alpha Rex and it should start walking. Ok,could you make the Alpha Rex's hands closed and pointed forward?I couldn't make it and wasting time finding the mistake.Then,I realize something from the video. Alpha Rex Robot Type: Humanoid - What this robot can do: Alpha Rex performs tasks that only the most sophisticated robots can do. Walk on two legs like a real person! With built in rotation sensors on the two Servo Motors powering his legs, and an Ultrasonic Sensor nabling Alpha Rex to see, you can program Alpha Rex to go where you want with precision! LEGO Mindstorms NXT 2.0: Alpha Rex code This is a very small segment of code that sets up Alpha Rex's movement and reactions. In this segment, you can see the two sound tiles separated by a 0.5 second wait tile. This is where it says 'Green Please' and then waits for a ball to be placed in its hands.
The inspiration for this program comes mainly from sources other than the Mindstorms RoboCenter software examples for the Alpha Rex. The RoboCenter examples perform basic movements such as walking forward and turning. However the examples are rather inadequate when it comes to combining basic movements into more complex movements, such as having your Alpha Rex move in a figure eight pattern. Furthermore, including such functionality as having the Alpha Rex walk around avoiding obstacles behooves the application of more advanced programming techniques.
The following sections describe these techniques in much more detail. The final section, following the description of these techniques, presents the development of a complete program for avoiding obstacles.
Basic Movements - State Machine Approach
The Alpha Rex mechanical design falls into a category referred to by robotics hobbyists as a toddler biped. Generally speaking a toddler robot uses only two servos for movement, like the Alpha Rex. One servo shifts the robot's weight from one foot to the other foot. The other servo moves the feet backward and forward. Efficiency and economy in programming dictates that these basic movements link together seamlessly to provide more complex movements, such as walking forward, or turning right. Seamless movement, from a programming perspective, requires that movements do not depend on other movements.
Seamless movement means that a composite movement, such as tilting left and moving the right foot forward, may be combined together without the programmer needing to concern themselves with the details of servo position, direction of rotation, and amount of rotation. The composite movement routines, described below, make use of two basic building blocks: a routine for tilting the robot side to side, and a routine to move the robot's feet back and forth.
For a complete discussion on how these two movements can be combined into composite movements see pages 33-37, 56-57, and 65-66 of the Parallax manualAdvanced Robotics with the Toddler, by Bill Wong and Ken Gracey. The reader is pointed to the above reference for a detailed understanding of toddler movements, and since the Alpha Rex is a toddler type robot these considerations apply. I highly recommend reading the above pages before continuing with the rest of this discussion.
Tilting from Side to Side
The C motor (plugged into port C) moves the robot from side to side. Unlike the RoboCenter example, the following subroutine uses the C motor as a servo (as opposed to a simple motor). Using a motor as a servo means that the primary function of the motor is to move, or actuate a lever arm over a limited distance (or travel). Moving a limited distance means that the motor does not rotate an unlimited amount, rather the motor rotates only that amount necessary to move the lever, or connected mechanical component the required amount. In the case of the Alpha Rex the components are the robot's two legs, which have two degrees of freedom in the way they can move: shifting the weight of the robot from one leg to the other, and moving one leg forward at the same time moving the other leg backward. The rotation sensors built into the NXT motors allow them to work very nicely as servo motors.
Tilting the Alpha Rex side to side may be broken down into nine separate cases defining the C motor action necessary to implement a basic movement. The following table lists these cases, or states. The first column provides a numerical identifier that the software can use to identify each possible state. The second column gives the movement from the previous position to the new position, such as the robot moving from tilting to the right to tilting to the left. The last two columns describe the required C motor action to perform the movement in the second column. You will note included in the table certain trivial movements, such as moving center to center. These are essentially 'do nothing' states that may occur because a previous movement left us in the state in which we already desire to be.
State | Movement | Number of Rotations | Direction of Rotation |
---|---|---|---|
0 | Center to Center | none | none |
1 | Right to Center | 0.75 | ↑ |
2 | Left to Center | 0.75 | ↓ |
3 | Center to Right | 0.75 | ↓ |
4 | Right to Right | none | none |
5 | Left to Right | 1.5 | ↓ |
6 | Center to Left | 0.75 | ↑ |
7 | Right to Left | 1.5 | ↑ |
8 | Left to Left | none | none |
The tilt subroutine makes use of a single state variable to contain the previous position state of the robot: left, right, or center. Table 2 associates each of three possible tilt movements and tilt states (previous position) with a unique identifier number.
ID# | Movement | Previous Position |
---|---|---|
0 | Tilt back to the center position | Center |
1 | Tilt to the robot's right side | Right tilt |
2 | Tilt to the robot's left side | Left tilt |
Thus the most previous position may be represented by a number 0, 1, or 2. And the new movement we are about to perform by a number 0, 1, or 2. Hence we may use a simple formula for determining the state in table 1 above: State ID equals three times the new movement plus the previous position, or
StateID = 3 * NM + PP
where StateID is the State ID in table 1,
NM, the new movement, and
PP, the pervious position
For example, if the previous position is “center†and we want to tilt left, then
StateID = 3 * 2 + 0 = 6
Looking at table 1, the associated movement (in the same row) as StateID 6 is 'center to left', as expected.
The NXT-G code shown below implements the tilt subroutine. The code uses a state variable 'Tilt_Previous' to maintain the previous tilt position of the robot. A switch statement handles all the cases in table 1. The subroutine has only one input parameter: one of the numbers from the first column of table 2. Hence, when using this subroutine as a My Block we only need to know what tilt position we wish the robot to assume: left, center, or right. We do not need to know anything about the servo positions or how to move them. This abstraction removes these details from the programmer who uses the tilt subroutine in a higher level program.
Striding Forward and Backwards
The B motor (plugged into port B) moves the Alpha Rex feet forward and backward. The development of the striding subroutine follows very closely the development of the tilting subroutine described above. Similar to tilting the robot side to side, moving the robot's feet backward and forward may be broken down into nine separate cases as shown in table 3.
The first column gives the State ID used by the software. The second column gives the movement of the robot's feet. To understand the movement column, think of the movement as saying which foot in front has to move to a new position. For example, 'right to center' means that the right foot has to move from in front to the center position directly below the robot. 'Left to right' means that the left foot has to move from in front to the rear of the robot. 'Right to left' means that the right foot has to move from in front to the rear of the robot. Keep in mind that the feet move concurrently. That is, when the right foot moves forward, to the front of the robot, the left foot moves, simultaneously, to the rear of the robot. The last two columns describe the required B motor action to perform the movement in the second column.
State | Movement | Number of Rotations | Direction of Rotation |
---|---|---|---|
0 | Center to Center | none | none |
1 | Right to Center | 0.75 | ↓ |
2 | Left to Center | 0.75 | ↑ |
3 | Center to Right | 0.75 | ↑ |
4 | Right to Right | none | none |
5 | Left to Right | 1.5 | ↑ |
6 | Center to Left | 0.75 | ↓ |
7 | Right to Left | 1.5 | ↓ |
8 | Left to Left | none | none |
Similar to the tilt subroutine, the stride subroutine makes use of a single state variable to contain the previous stride state of the robot: left foot forward, right foot forward, or both feet in the center position. Table 3 associates each of three possible stride movements and stride positions with a unique number.
Alpha Rex Rbt Program Login
ID# | New Movement | Previous Position |
---|---|---|
0 | Both feet to the center position | Feet centered |
1 | Right foot to forward position, left back | Right foot forward, left back |
2 | Left foot to forward position, right back | Left foot forward, right back |
Similar to the tilt subroutine, we may use a simple formula for determining the state in table 3 above: State ID equals three times the new movement plus the previous position, or
StateID = 3 * NM + PP
where StateID is the state ID in table 3,
NM, the new movement, and
PP, the previous movement
The NXT-G code shown below is very similar to the tilt subroutine. The code uses a state variable 'Stride_Previous' to maintain the previous stride position of the robot. A switch statement handles all the cases in table 3. The subroutine has only one input parameter: one of the numbers from the first column of table 4. Hence, when using this subroutine as a My Block we only need to know what stride position we wish the robot to assume: left foot forward, both feet centered, or right foot forward.
Alpha Rex Rbt Program 2020
Composite Movements
Walking forward and backward, turning from left to right and right to left may be accomplished by simply combining together tilt and stride My Blocks in the correct sequence. For example, to walk forward we must accomplish the following: tilt left, move right foot forward, tilt right, move left foot forward. Conversely we may walk forward by: tilting right, moving the left foot forward, tilting left, and moving the right foot forward. The NXT-G code for walking forward is shown below.
Turning the Alpha Rex involves an added principle: friction. That is, the robot does not so much turn as it pivots. It pivots by centering its weight over both feet (center tilt position) and moving one foot forward and the other backward. For example, if the right foot moves from the forward position to rear position (concurrently the left foot moves forward), the robot will pivot to the left.
Scanning for obstacles
The Alpha Rex uses motor A to both move the robot's arms up and down (rather functionally useless) and for panning the ultra-sonic (US) sensor back and forth. The NXT-G subroutine shown below rotates the US sensor to the left and takes a reading, then it rotates the US sensor to the right and takes a reading. The readings are stored in two variables: one for the left reading and one for the right reading. The main program uses these readings to determine what to do when the US sensor 'sees' an obstacle in front of the Alpha Rex. You may note that the NXT-G code inserts a pause between the motor block and the read US sensor block. This pause allows the mechanical movement of the US sensor to stabilize before the sensor gets read, thus increasing the reliability of the reading.
Avoiding obstacles
The NXT-G code shown below ties all the ideas and code previously discussed into a practical program for the Alpha Rex. The code below comprises the main routine programmed into the Alpha Rex. In software parlance the main routine sometimes gets referred to as the 'executive routine' or the program 'entry point', because this where the program first starts when executed.
The program works by first executing the 'AR_US_Scan' My Block. The execution of this block stores the reading from the US sensor, taken when pointed to the left, in the variable US_Reading_L. Conversely, the reading from the right gets stored in US_Reading_R. The main routine then checks to see if either reading indicates that the robot sees an obstacle closer than 15 inches. If so, then the program compares the two readings to determine whether the robot has seen the obstacle to its left or right side. If the robot sees the obstacle to its right, then it turns left to avoid the obstacle. Conversely if the robot sees the obstacle to its left, then it turns right to avoid the obstacle. If the robot does not see an obstacle on either side, then it walks forward.
The AR_US_Scan My Block and the movement My Blocks indeed hide a great deal of painstaking complexity from the programmer creating the code for the main routine. He does not need to know the details of how the sensor works or takes its reading. He does not need to know the details of how to make the robot walk or turn. He only needs to drop the appropriate My Block in the correct position. By now you should be able to see the power of abstraction in software design. Abstraction eliminates the need to know the details and makes the code very simple and straight forward.
(click on image for enlarged view
Tip: If the robot moves exactly opposite from the manner that you expect, then manually rotate the relevant motor shaft 180 degrees. Also, before running the program, make sure that the robot's feet are positioned dead center below the robot. You may have to adjust both motor C and motor B drive shafts.
References
- Advanced Robotics with the Toddler, by Bill Wong and Ken Gracey
Source Code Files
Alpha Land is a freeware program that will help you easily run property management business. Alpha Land software intended for Homeowner' Associations, Condominiums, Housing Cooperatives, Single Family Homes, etc.
- AlphaLandSetup.exe
- Rosfactory
- Freeware (Free)
- 2.7 Mb
- Win98, WinME, WinNT 3.x, WinNT 4.x, WinXP, Windows2000, Windows Media Center Edition 2005, Windows Vista
LinPlug Alpha AU 2.2.2v is a very tractable and powerful program which features an easy to learn subtractive design with special attention being paid to recreating the warmth and feel typically found in early-1980s analog synthesizers.The Alpha. ...
- Alpha2DemoAU.dmg
- LinPlug
- Commercial ($59.00)
- 711 Kb
- Mac OS X
Live Alpha 1 is considered as a smart and useful software plug-in that augments or replaces standalone titling devices and character generators for use in live Web casts.Professional titles created in any imaging program can be overlaid on live video. ...
- Live Alpha
- Consolidated Video
- Trial ($99.00)
- 1.7 Mb
- Windows XP, Windows 2000
VPP - Velocity Prediction Program - a Matlab library for sailing boat performance simulation. Based on DSYHS or user provided data.The new beta version replaces the previous alpha version after some bugs fixing and enhancements in the ...
- gvpp_beta_r5.tar.gz
- gianlisi
- Freeware (Free)
- 262 Kb
- Windows
Alpha-Office is an office suite written in Just BASIC to offer an easy to use set of tools for anyone who has need of them. The suite will include: A Task Manager, Graphics Program, Spreadsheet, Notepad Clone, Wordpad Clone, and much more.
- Alpha-Office
- Coop
- Freeware (Free)
- Windows
Hide windows program (hide applications)completely through a hotkey or as an icon in system tray.Hide some less used icons from tray.Arrange the windows on taskbar based on your choice.Automatically maximize all new windows or only new IE windows.
- THSetup.exe
- Eusing Software
- Shareware ($19.95)
- 747 Kb
- Win95, Win98, WinME, WinXP, Windows2000, Windows2003
A freeware submission program for FFAs and classified sites to submit to the free for all link sites or classified sites of your choice. Contains 25 free submission sites. ...
- InstallSubmitByRick.exe
- Sensei J. Richard KirkhamB.Sc.
- Freeware (Free)
- 779 Kb
- WinXP, Windows2000, Windows2003
Find hidden programs on your computer. Identify them and kill them with Program Sleuth. Is your computer running slower then it used to? This powerful program will show you what is really running on your computer. You will be able to stop any program that you cannot recognize.
- ProgramSleuth_Install.exe
- Screaming Bee LLC
- Shareware ($9.95)
- 521 Kb
- Windows2000, WinXP
Data recovery program recovers deleted files from corrupt, deleted, formatted windows partitions. Software is equipped with 3 recovery modes; quick scan, extensive scan and file trace to perform effective data recovery.
- recoveryfixwindows.exe
- Data Recovery Program
- Shareware ($69.00)
- 3.97 Mb
- WinNT, WinXP, Windows2000, Windows2003, Windows Vista
Inbound links checker easily analyzes backlinks on publisher website and monitors all link status like backlink, direct link, java script link etc. Backlinks checker program generates link status report in txt or html file format as per need.
- backlink-checker.exe
- Data Recovery Utility
- Shareware ($69.00)
- 958 Kb
- Win98, WinME, WinNT 3.x, WinNT 4.x, Windows2000, WinXP, Windows2003, Windows Vista
BarcodeAnywhere is a powerful yet very easy-to-use barcode creator program which you can trust to meet your barcode everyday needs anywhere your business leads to. BarcodeAnywhere can generate barcode images in three basic ways:Output barcode images to clipboard so that you can paste directly into your document. Save barcode images as image file which can then be incorporated into your document or used in whichever way you like.
- 45002.exe
- Data Recovery Directory
- Shareware ($99.00)
- 125 Kb
- Win98, WinME, WinNT 3.x, WinNT 4.x, Windows2000, WinXP, Windows2003, Windows Vista
OutlookPasswordRecovery is a program to monitor your kids e-mail accounts. MS outlook lost password forgot passwords recovery tool specifically designed for the users who works on Multiple Email accounts. Password recovery crack outlook passwords.
- oepr.exe
- Undelete Data
- Shareware ($30.00)
- 800 Kb
- Win98, WinME, WinNT 3.x, WinNT 4.x, Windows2000, WinXP, Windows2003
Related: