BRAT Biped Autonomous Tutorial

Last modified by Eric Nantel on 2023/01/23 10:17

Biped BRAT Autonomous Tutorial.

Updated 12/20/2011

Safety first! Wear eye protection and never touch a powered robot!

Note: This tutorial uses the Bot Board II, BASIC Atom Pro 28, a Sharp GP2D12 sensor, and a Buffered 2-Axis Accelerometer (DE-11).

Software:
  - BASIC Micro Studio
  - BRAT Servo Offset Finder Program v3 (09/16/09)
  - Autonomous Walk Code (09/16/09)
  - Autonomous GP2D12 Code (09/16/09)
  -- Video: Avoiding an obstacle (mpg)
  -- Video: Taking a break (mpg)
  -- Video: Demonstrating proximity beeps (mpg)
  - Autonomous 1-Axis Accelerometer Code (09/16/09)
  -- Video: Getting up front and back (mpg)
  - Autonomous 2-Axis Accelerometer Code (09/16/09)
  -- Video: Getting up front and side (mpg)


Image of Biped BRAT.
 
Step 1.
Make sure your servos are plugged into the appropriate channels, as shown in Table 1.

*Note, P9 is used by the speaker, so we can't plug a servo in there.

Bot Board I/O Connection
P4 Left Ankle
P5 Left Knee
P6 Left Hip
P7 Right Ankle
P8 Right Knee
P10 Right Hip

Table 1.

 
Step 2.
Make sure the Bot Board's jumpers are set according to Table 2.

Refer to Figure 2 for help with jumper settings.

*Note, the VS to AX0 jumper enables the program to monitor the servo battery voltage. When the battery is low, the robot can beep in warning.

Bot Board II Jumper Settings
Enable A, B, and C buttons
5v I/O Group 0-3
VS I/O Groups 4-7 and 8-11
Enable SPKEN (Speaker Enable)
Enable VS (Servo Voltage) to AX0 (P16)

Table 2.


 
Figure 2.

 
Step 3.
Download and install the BASIC Micro Studio. Download the BRAT Servo Offset Finder program, and load it into the IDE.

Program the Atom Pro, and follow these instructions to find your robot's offsets.

  • Press A to decrease the servo offset by 5us.
  • Press C to increase the servo offset by 5us.
  • Press B to change which servo is being manipulated, and to save your offsets. The order of the program is shown in Figure 3.

Note, if you have the Speaker enabled, when you press the B button you will hear a short tone. The tone will raise in pitch when you change from servo to servo, and will lower in pitch and be longer when you get back to Start.


Figure 3.


Step 4.
Place the robot in a position as close to neutral as possible, and turn it on. Your robot should go to and hold the neutral position, and should resemble figures 4-1 through 4-3. If the joints are off by more than 15° you may have made an error in assembly. To correct this, remove the center screw from the round servo horn, pull the servo horn off the servo, rotate until it's aligned, then reattach the servo horn.

Use the A, B, and C buttons to straighten the BRAT as shown in Figures 4-1, 4-2, and 4-3.

Note, if you are building the robot with HS-422 servos, you will notice the hip servos oscillate if the robot is lifted off the ground. This is normal, and is due to the lower power servo. When the robot is walking, the effects are minimal. Using a voltage that is higher than 6vdc will make the oscillations worse. When building a robot with more powerful servos such as HS-475, HS-485, or HS-645, you will not see this effect.

After you've cycled through the servos and adjusted them to match Figures 4-1 through 4-3, pressing the B button again will save your servo offset values to the Atom Pro's EEPROM.


Figure 4-1.

 


Figure 4-2.


Figure 4-3.


Step 5.
Now download the BRAT Autonomous Walk Code, load it into the IDE, and program your BRAT.

Congratulations, your BRAT will now be able to walk around! The autonomous walk program will make the BRAT follow this sequence: walk, walk, walk, turn, long-stride, long-stride, kick, turn, stop.

To change the behavior of your robot, you can modify the code below the label "main" and above the label "move". You can also create sequences following the format shown in the code below the label "move". We will provide several more code examples including common sensors.

 
Step 6.
Use double-sided tape to attach the GP2D12 sensor to the BRAT's head area. The exact position doesn't matter too much, as long as the sensor is facing toward the front of the robot.

Plug the sensor in to the channel shown in the following table.

Bot Board I/O Connection
P19 (AX3) GP2D12 Sensor

Table 6.


Figure 6.

 
Step 7.
Now download the BRAT Autonomous GP2D12 Code, load it into the IDE, and program your BRAT.

Congratulations, your BRAT will now be able to roam without bumping into anything! We also added a "behavior" looping counter so the robot will periodically go into a resting position. You can edit the pauses to change how long it rests and you can change the value of the looping counter to change how often it rests. The GP2D12 sensor is read before each step when the robot is walking forward. You will hear a short low beep if nothing is detected. If an object is detected, the beep raises in pitch depending on how close the object is. When the object is about 8" away, the robot will back up one step, turn left two steps, then continue forward. The code also illuminates LEDs depending on which command is being processed.

Check out these videos:
  - Avoiding an obstacle (mpg)
  - Taking a break (mpg)
  - Demonstrating proximity beeps (mpg)


Step 8.
Use double-sided tape to attach the accelerometer sensor to the BRAT's head area. With the accelerometer, the sensor's physical position isn't as important as the axis orientation. Make sure you follow the orientation shown in Figure 8.

Plug the sensor in to the channel shown in the following table.

Bot Board I/O Connection
P17 (AX1) Accelerometer Sensor - Y Axis
(Used for Front-to-back tilt)
P18 (AX2) Accelerometer Sensor - X Axis
(Used for Side-to-side tilt)

Table 8.


Figure 8.

 
Step 9.
Now download the BRAT Autonomous 1-Axis Accelerometer Code, load it into the IDE, and program your BRAT.

For this program, we are only using the values from the Y Axis. The Y Axis measures the front-to-back tilt, so the BRAT can tell when it has fallen onto its back or front. We will incorporate the X Axis in a later program.

Congratulations, your BRAT will now be able to roam without bumping into anything, and get back up if it falls!

Check out this video:
  - Getting up front and back (mpg)

 
Step 10.
Now download the BRAT Autonomous 2-Axis Accelerometer Code, load it into the IDE, and program your BRAT.

For this program, we have added the accelerometer's X Axis to measure side-to-side tilt. Now if the BRAT falls onto its side, it will know to roll over in order to get back up. We have also incorporated a more advanced "get up from back" routine, which will enable robots with lots of cabling or weight in the back to stand one foot at a time. Additionally, we've added a "startled" behavior. If the BRAT is in resting mode and something is suddenly detected by the GP2D12 sensor, the BRAT will be startled, lean back, and beep.

Congratulations, your BRAT will now be able to roam without bumping into anything, and get back up if it falls!

Check out this video:
  - Getting up front and side (mpg)

Tags:
Created by Eric Nantel on 2023/01/23 09:58
Copyright RobotShop 2018