BRAT Biped Autonomous Tutorial

Last modified by Eric Nantel on 2026/04/06 12:54

Biped BRAT Autonomous Tutorial

Updated December 20, 2011

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

Hardware required: Bot Board II, BASIC Atom Pro 28, Sharp GP2D12 sensor, Buffered 2-Axis Accelerometer (DE-11).

Software & downloads:

Biped BRAT.

Autonomous — Verify Servo Channel Connections
Step 1 / 10

Make sure your servos are plugged into the appropriate channels per Table 1. Note: P9 is used by the speaker and cannot be used for a servo.

Bot Board I/OConnection
P4Left Ankle
P5Left Knee
P6Left Hip
P7Right Ankle
P8Right Knee
P10Right Hip
Table 1.
Autonomous — Configure Bot Board II Jumpers
Step 2 / 10

Set the Bot Board II jumpers per Table 2. The VS to AX0 jumper enables the program to monitor servo battery voltage — when the battery is low the robot can beep a warning. Refer to Figure 2 for the jumper layout.

Bot Board II Jumper Settings (Table 2)
EnableA, B, and C buttons
5VI/O Group 0–3
VSI/O Groups 4–7 and 8–11
EnableSPKEN (Speaker Enable)
EnableVS (Servo Voltage) to AX0 (P16)
Table 2.

Figure 2 — Jumper diagram

Autonomous — Find Servo Offsets
Step 3 / 10

Download and install BASIC Micro Studio. Download the BRAT Servo Offset Finder Program v3, load it into the IDE, and program the Atom Pro. Then use the buttons to find offsets:

  • A — decrease servo offset by 5µs
  • C — increase servo offset by 5µs
  • B — change which servo is being adjusted, and save offsets (order shown in Figure 3)

If the Speaker is enabled, pressing B plays a tone that rises in pitch as you cycle through servos, and drops to a longer tone when returning to Start.

Figure 3 — Servo offset finder sequence.
Autonomous — Calibrate Robot to Neutral Position
Step 4 / 10

Place the robot as close to neutral as possible and turn it on. It should hold the neutral position resembling Figures 4-1 through 4-3. If any joint is off by more than 15°, remove the servo horn, rotate to align, and reattach. Use the A, B, and C buttons to fine-tune.

Note: HS-422 hip servos may oscillate when the robot is lifted off the ground — this is normal and minimal when walking. Higher voltage makes oscillations worse. Higher-power servos (HS-475, HS-485, HS-645) do not exhibit this.

After adjusting all servos to match Figures 4-1 through 4-3, pressing B saves the offset values to the Atom Pro's EEPROM.

Figure 4-1 (front view).
Figure 4-2 (side view).
Figure 4-3 (rear view).
Autonomous — Load Basic Walk Code
Step 5 / 10

Download the BRAT Autonomous Walk Code, load it into the IDE, and program your BRAT.

The BRAT will now walk autonomously following this sequence: walk × 3, turn, long-stride × 2, kick, turn, stop. To customise behavior, modify the code between the labels "main" and "move", or create new sequences following the format below the "move" label.

Autonomous — Mount & Connect GP2D12 Sensor
Step 6 / 10

Use double-sided tape to attach the GP2D12 sensor to the BRAT's head area, facing the front. Exact position is not critical. Plug the sensor into the channel shown in Table 6.

Bot Board I/OConnection
P19 (AX3)GP2D12 Sensor

Table 6.

Figure 6 — GP2D12 sensor mounted.
Autonomous — Load GP2D12 Obstacle Avoidance Code
Step 7 / 10

Download the BRAT Autonomous GP2D12 Code, load it into the IDE, and program your BRAT.

The BRAT can now roam without bumping into obstacles. The sensor is read before each step. A short low beep means nothing is detected; the beep rises in pitch as objects get closer. At ~8" the robot backs up one step, turns left two steps, then continues. A looping counter periodically puts the robot into a resting position. LEDs illuminate based on the current command.

Videos: Avoiding obstacle · Taking a break · Proximity beeps

Autonomous — Mount & Connect Accelerometer
Step 8 / 10

Use double-sided tape to attach the accelerometer to the BRAT's head area. Axis orientation is critical — follow the orientation shown in Figure 8 exactly. Plug the sensor into the channels shown in Table 8.

Bot Board I/OConnection
P17 (AX1)Accelerometer Y Axis (front-to-back tilt)
P18 (AX2)Accelerometer X Axis (side-to-side tilt)

Table 8.

Figure 8 — Accelerometer orientation.
Autonomous — Load 1-Axis Accelerometer Code
Step 9 / 10

Download the BRAT Autonomous 1-Axis Accelerometer Code, load it into the IDE, and program your BRAT.

This program uses only the Y Axis to detect front-to-back tilt — the BRAT can tell when it has fallen forward or backward and get back up. The X Axis will be incorporated in Step 10.

Video: Getting up front and back

Autonomous — Load 2-Axis Accelerometer Code
Step 10 / 10

Download the BRAT Autonomous 2-Axis Accelerometer Code, load it into the IDE, and program your BRAT.

This version adds the X Axis for side-to-side tilt detection — if the BRAT falls onto its side it will roll over to get back up. It also includes an improved "get up from back" routine for robots with heavy cabling, and a "startled" behaviour: if the BRAT is resting and the GP2D12 suddenly detects an object, it will lean back and beep.

Video: Getting up front and side

Tags:
Created by Eric Nantel on 2024/07/03 09:21
Copyright RobotShop 2018