Introduction

One of the most pressing challenges within autonomous mobility lies in high-speed racing scenarios where vehicles must interact and overtake at high speeds. These scenarios are particularly challenging because autonomous vehicles require advanced data-driven methods to identify the intent of other vehicles while simultaneously planning their trajectories. Although full-scale, high-speed testbeds such as Roborace exist, their space and cost requirements are highly demanding. To address these issues, we created Pocket Racer, an open-source, 1:28 scale autonomous racing platform designed for high-speed research that is accessible to everyone. Our platform operates in typical indoor environments like university hallways or classrooms, making high-speed autonomous driving research more accessible and feasible.

Background

Building a scaled-down autonomous vehicle is quite a complex task. Please keep in mind the following considerations:

Budget

Although the material cost of building a vehicle is less than 250 USD, several tools are needed:

  1. Basic electronic tools (i.e. screwdriver, long nose, soldering tool, glue gun, gear puller recommended)
  2. A computer with a GPU (alternative: cloud computing)
  3. 3D printer

Thus, the real cost of having a fully-functioning vehicle can fluctuate (depending on which tools are readily accessible or not). Please keep this in mind before jumping immediately into the project.

Knowledge

We provide two primary methodologies for autonomous vehicle racing on our platform. These methods and their resources are detailed below:

  1. Deep Learning: We recommend viewing university lectures on Deep Learning via YouTube. Our platform uses Vision Transformers (RaceViT) tailored for autonomous racing, leveraging Learning from Demonstrations (LfD) shared across multiple vehicles.
  2. Sensor Fusion and Probabilistic Robotics Methods: We recommend the Probabilistic Robotics (Intelligent Robotics and Autonomous Agents series) 1st Edition book by Sebastian Thrun for a deeper understanding of sensor fusion and probabilistic methods.

Most of the code we use is in Python. Familiarity with deep learning frameworks is essential. While the project initially utilized Keras, we have transitioned to TensorFlow for better performance and deployment capabilities. PyTorch is also a viable alternative, given its recent advancements in deployment.

3D-Printing

It is necessary to have access to a 3D printer. Because the parts are (at most) palm-sized, 3D printers around less than 100 USD (such as the Sondori Pico 3D printer) will be enough. We also recommend the Prusa Mini+ or MK3S+ with +0.02mm tolerance PETG filament if you are serious about getting quality prints. Knowing how to use Computer-Aided Design (CAD) is also necessary, provided that you are interested in making modifications to your vehicle in the future.

Electronics

You should be able to understand how to use the following as well:

  1. Raspberry Pi with General Purpose Input Output (GPIO) ports
  2. Hardware pulse width modulation (PWM) signaling and UART protocols
  3. Solder wires and understand how remote-controlled cars work
  4. The basics of First-Person-View (FPV) equipment (if you plan on driving your car with an FPV remote steering wheel setup)

For detailed code, please visit our GitHub repository

Bill of Materials

Several materials are needed to successfully build a Pocket Racer autonomous vehicle. Our bill of materials will be periodically updated to reflect the latest revisions. Note that the cost of components does not include shipping costs. Additionally, there are a total of three methods for controlling the vehicle during data collection. The recommended method is the low latency option, as it offers the fastest communication protocols for real-time control and data collection.

Vehicle Components

Vehicle Components

Chassis

  • 1. Kyosho Mini Z series tires
  • 2. Wltoys A969 RTR

3D Printed Parts

  • 3. 3D printed Battery Mount
  • 4. 3D printed Motor Mount
  • 5. 3D printed Frame

Powertrain

  • 6. ESC
  • 7. 2S Lipo Batteries
  • 8. Brushless Motor

Compute Unit

  • 9. Raspberry Pi Zero 2w
  • 10. 32GB SD card
  • 11. 5v DC fan

Camera

  • 12. IMX708 Arducam Camera

Build Timelapse

Preparing

What you need

  • 3d printed chassis
  • Wltoys K969 or K989
  • Raspberry pi zero 2w
  • Simonk 30A ESC
  • Rocket mini DRZ Atomic Pro 3500KV (Use one with similar spec if not available)
  • Arducam
  • M12 lens
  • 5v DC fan (20mm*20mm*10mm)
  • Front rims & tires
  • Rear rims & tires (wide type recommended)
  • Screws
  • Tools (Screw driver, long nose, soldring machine, gear puller recommended)

Preparing rims & tires

If your RC’s stock tires have grooves/patterns or are not made of rubber, changing them to slick rubber tires is recommended to enhance tire grip. Equipping rims and tires for Kyosho Mini Z series work for this set. Remember to select rims according to the wheel hub’s shape, which is square for this set.

3d printing

Print ‘Chassis.stl’ and ‘motormount.stl’ using 3d printer. Choose the highest fill rate possible to ensure rigidity for reducing impact on camera

Preparing 3d printed Chassis

Remove all the supports. Note that there is a slot at the back of camera holer for arducam’s CSI cable, and it can take time and effort to be destroyed.

Prepare RC

This manual is based on Wltoys k969. You can also use the k989 or 284131 from Wltoys.

Disassemble cowl by detaching four R-shaped pins.

Unscrew cowl mounts at the front and rear.

Disconnect servo motor with the switch box.
Detach upper body plate by unscrewing the 5 points as shown.

Take all the wheels off.

Unscrew everything except battery holer and separate them from the lower body plate.
Take the battery out by removing R-shaped pin of the battery holder.

Solder electronics

Solder the electronics according to this wiring diagram.

Disassembling

Remove front diff

Unscrew shock absorber mount at the front.

Unscrew and pull out the bolts holding front upper arms.

Unscrew front differential case.

Remove front differential.

Get this front wheel hub assembly out of knuckle

Detach rubber ring.
Push the small shaft out to separate wheel hub from cv joint

Attach rubber ring to the wheel hub again and put it back into knuckle.
Do not assemble the front differential case again yet.

Motor Change

Unscrew toe control bar at the rear.

Unscrew rear shock absorber mount.

Unscrew and pull out bolts holding rear upper arms.

Unscrew and disassemble rear diff case.

Pull out the driveshaft and motor mount assembly from front and rear differential case.

Disassemble all the gears and motor mount assembly from drive shaft

Screw the new motor to the printed motor mount.

Assemble nylon gears to connect motor and driveshaft. Use the smallest gear (15T) for driveshaft and biggest one (24?T) for the motor.

Attach rear differential’s pinion gear to driveshaft.

Assemble rear differential system. Put the bearing holding the differential gear at the right place.

Screw shock absorber mount, rear differential case, rear upper arm and toe control bar.

Screw shock absorber mount, front differential case and front upper arm.

Put all the wheels back on.

Screw both differential cases, servo motor and motor mount to body plate. Put the battery back into battery holder.

Camera Installation

Pull out the camera connector pin of arducam and change the CSI cable to white, thinner one.

Penetrate camera cable through the slot behind chassis head.

Push the arducam into the space of chassis head. Chassis can fix the camera rigidly enough without adhesive, but glue them if you need more rigidity.

The camera pin on pi zero board works just the same. Connect the other end of the camera’s CSI cable here.

Electronics System Installation

Screw Raspberry pi 2w zero board on chassis using 4 M2 12mm screws and nuts.

Screw 5v dc fan on chassis using 4 M2 20mm screws and nuts.

Install esc to chassis using adhesive.

Screw chassis to RC

Install Chassis

Screw chassis to RC

Assembly FAQs

Is it mandatory to change wheels and tires?

It is optional. However, using grip tires is highly recommended since the Pocket Racer is designed to race indoors.

Which tool should I use to change wheels and tires?

Using a wheel wrench is ideal to screw / unscrew wheels. However, you can also use a long nose plier, too.

Can I use any other motor than DRZ Atomic pro 3500kv?

If it’s hard to get the specific motor, you can use another sensored BLDC motor as long as it can endure 30A current from.the ESC.

Printed motor mount looks different compared to the one in the manual

The one you printed is the latest version of the motor mount. It has multiple holes for mounting the motor to allow using different gear ratios.

Bolting on the chassis is too hard.

Although the chassis have holes for all the bolting places, but the chassis is printed nearly 100% fill. It might be hard to bolt on the chassis, especially at the step where you mount chassis on differential covers. I recommend tapping the hole using M2 screws first, and then applying socket set screws for precise bolting.

Wheel hub breaks away from the knuckle and diff gear too easily.

Wheel hub can be fixed to knuckle when a wheel nut is applied on it. You can put the wheel on in advance if needed.

Connecting & Hotspotting via SSH

General Setup:

  • Always charge batteries as a set.
  • Secure batteries and ensure wiring is tucked under the rubber band.
  • Avoid touching the camera lens to prevent data shifts.
  • Refrain from touching the rear of the car due to high temperatures.

Connection and Setup:

  • Turn on the mobile hotspot (Windows: SSID "hello", password "farewell"; Ubuntu: activate WiFi hotspot).
  • Insert freshly charged batteries.
  • Wait for the hotspot to detect an IP address (Ubuntu: use `arp -a` in terminal to find the IP address of the Raspberry Pi). Each SD card has a unique address—make a note of this to easily identify the correct Raspberry Pi in future sessions.
  • Open a terminal (Windows) or terminal (Ubuntu).
  • Connect via SSH: `ssh pi@IP_ADDRESS`.
  • Enter password "farewell" when prompted.
  • Once logged in, activate the PWM by typing `sudo pigpiod`.
  • Navigate to scripts directory: `cd miniz/scripts`.

Collecting Data:

  • Activate the Bluetooth controller by pressing the smallest button on top.
  • Start Bluetooth device scanning: `bluetoothctl scan on`; look for the device labeled "PRO CONTROLLER". Each controller has a unique address—connect to each controller initially to identify its unique address. Make a detailed note of these addresses so you can easily recognize and connect to the correct controller in future uses.
  • Connect to the controller: `bluetoothctl connect ADDRESS`.
  • Start the data collection script: `python3 collect.py`.
  • Record data in 1-minute intervals; the system pauses and restarts after 10 seconds.
  • Allow the car to rest for 1 minute after data collection before shutting down.
  • Recharge the used batteries.
  • Repeat the process as needed for additional data collection.

Deploying the Trained Model:

  • Open the deployment script for modifications: `sudo nano final3d.py`. Adjust the hyperparameters for desired speed at the beginning of your deployment session.
  • Launch the deployment script: `python3 final3d.py`.
  • Position the RC car at the original location where the model was trained to ensure consistency.
  • Carefully observe the car's behavior during operation. Note any steering issues or excessive speed. If the car steers off-course due to tire conditions or debris, or if the speed is inconsistent (potentially due to variations in battery power output), terminate the script by pressing `Ctrl+C`.
  • Re-open the deployment script for further modifications: `sudo nano final3d.py`.
  • Fine-tune the hyperparameters at the end of the script based on your observations.
  • Redeploy the script and repeat the steps until the car reliably completes laps autonomously.