π Urban Lab: Building an Electric Scooter with AI, Reinforcement Learning and 3D Printing
title: "π Urban Lab: Building an Electric Scooter with AI, Reinforcement Learning and 3D Printing"
published: false
description: "A technical deep dive into Urban Lab, an open-source electric scooter project combining 3D printing, AI, reinforcement learning, ESP32 and real-time trajectory planning."
tags: ["3dprinting", "reinforcementlearning", "opensource", "robotics"]
cover_image: https://via.placeholder.com/1000x420/4CAF50/FFFFFF?text=Urban+Lab+Scooter
canonical_url: https://dev.to/danielioni/urban-lab
π΄ Urban Lab: Building the Scooter of the Future
What happens when you combine 3D printing, artificial intelligence, reinforcement learning and robotics into one open-source mobility project?
This is Urban Lab.
Developed in Rimini, Italy, in collaboration with MyZubster, the project explores how accessible hardware and open-source software can be used to prototype a smarter and more sustainable electric scooter.
The goal is simple:
Build, experiment, learn, document β and share everything with the community.
π― The Project
Urban Lab combines several technologies into a single experimental platform:
- π¨οΈ 3D-printed components
- π§ Artificial Intelligence
- π€ Reinforcement Learning
- π§ Real-time trajectory planning
- π‘ ESP32-based electronics
- π± Mobile control
- π Web dashboard
- π§ Open-source development
The project is designed as an experimental platform rather than a finished commercial vehicle. :contentReference[oaicite:1]{index=1}
π© Hardware Architecture
The current prototype is designed around:
| Component | Specification |
|---|---|
| Frame | Carbon fiber, 120 Γ 40 cm |
| Motor | Brushless 800W / 48V |
| Battery | LiFePO4 48V / 20Ah |
| Controller | VESC 60A 12S |
| Wheels | 10" pneumatic |
| Brakes | Hydraulic 160mm |
| Suspension | Shock-absorbing fork |
| Electronics | ESP32 + sensors |
The estimated hardware budget described in the project documentation is approximately β¬1,510. :contentReference[oaicite:2]{index=2}
π¨οΈ 3D Printing
One of the main ideas behind Urban Lab is to make as many components as possible accessible through digital manufacturing.
The project includes 3D-printed components such as:
- Frame sections
- Folding mechanism
- Battery enclosure
- ESP32 mount
- Wheel mounts
- Mudguards
- Grips
- Anti-slip deck components
The documented prototype estimates approximately 127 hours of printing and 10 kg of filament. :contentReference[oaicite:3]{index=3}
This approach makes rapid iteration possible.
Instead of waiting weeks for a new mechanical component, we can:
- Modify the CAD model
- Slice the model
- Print it
- Test it
- Iterate
That's the core philosophy of Urban Lab.
π§ Reinforcement Learning
The most experimental part of the project is the use of Reinforcement Learning.
Urban Lab integrates Telekinesis RLbotics into a custom Gymnasium environment.
The objective is to experiment with policies capable of learning behaviours such as:
- Dynamic stabilization
- Braking optimization
- Energy efficiency
- Adaptation to different surfaces
The project defines a custom observation space containing variables such as:
python
class ScooterEnv(gym.Env):
"""
Observations:
- Speed
- Inclination
- Battery level
- Obstacle distance
- Motor RPM
- Motor temperature
Actions:
- Acceleration
- Braking
- Steering angle
"""The important part isn't simply putting an AI model on a scooter.
The interesting challenge is creating a simulation environment where the model can safely learn before deployment.
π§ MIGHTY: Real-Time Trajectory Planning
Urban Lab also experiments with MIGHTY, an open-source trajectory-planning system.
The idea is to combine perception, localization and trajectory generation to create smoother navigation.
The architecture includes:
Visual-Inertial Odometry
Depth estimation
3D mapping
Trajectory optimization
Real-time obstacle avoidance
The project documentation describes a target architecture where trajectory generation runs continuously as the vehicle moves.
A simplified example:
mighty = MightySimulator()
mighty.add_obstacle(3.0, 2.0, 1.0)
mighty.set_goal(10.0, 5.0)
while not goal_reached:
mighty.compute_trajectory()
mighty.avoid_obstacles()
mighty.move(dt=0.1)
This creates an interesting separation of responsibilities:
RL learns behaviour.
Trajectory planning determines where to go.
The embedded controller executes the commands.
π‘ ESP32: Connecting the Physical World
The ESP32 acts as the embedded control layer.
The prototype monitors information such as:
Speed
Battery
Temperature
GPS position
Movement state
Lock state
A simplified firmware structure looks like this:
struct ScooterState {
float speed = 0;
float battery = 100;
float temperature = 25;
float gpsLat = 44.0576;
float gpsLon = 12.5653;
bool isMoving = false;
bool isLocked = false;
};
The firmware continuously reads sensors, updates the system state and communicates with the application layer.
π± Mobile Application
Urban Lab also includes a React Native control application.
The application is designed to communicate with the scooter through Bluetooth Low Energy.
Example:
const connectDevice = async (device) => {
const connectedDevice = await device.connect();
await connectedDevice
.discoverAllServicesAndCharacteristics();
const data = await readCharacteristic();
setScooterData(parseData(data));
setConnected(true);
};
This provides the foundation for a future user interface for monitoring and controlling the prototype.
π Web Dashboard
The project also includes a real-time dashboard.
The interface can expose information such as:
<div class="card">
<div class="card-icon">β‘</div>
<div class="card-label">Speed</div>
<div class="card-value" id="speed">
0.0 km/h
</div>
</div>
<div class="card">
<div class="card-icon">π</div>
<div class="card-label">Battery</div>
<div class="card-value" id="battery">
100%
</div>
</div>
The idea is to provide a single interface for observing the physical system in real time.
ποΈ Project Structure
The repository is organized around the different layers of the system:
urban-lab-scooter/
βββ 3d-printing/
β βββ stl-files/
β βββ slicer-profiles/
β βββ assembly-guide.md
β
βββ rl/
β βββ environments/
β βββ configs/
β βββ scripts/
β
βββ mighty/
β βββ configs/
β βββ scripts/
β
βββ firmware/
βββ app/
βββ docs/
This structure keeps mechanical design, machine learning, trajectory planning, firmware and applications separated while allowing them to communicate through defined interfaces.
πΊοΈ Development Roadmap
The project follows several development phases:
Phase Duration Activity
1 2 weeks CAD and 3D design
2 2 weeks 3D printing
3 1 week Hardware assembly
4 2 weeks Software and firmware
5 2 weeks AI and Reinforcement Learning
6 1 week MIGHTY integration
7 1 week Testing and calibration
The current roadmap includes final assembly and road testing as subsequent steps.
π€ Open Source by Design
Urban Lab is intended to be an open-source project.
There are several ways to contribute:
π Bug reports
π‘ Feature proposals
π§ Firmware and software
π¨οΈ 3D-print testing
π Documentation
The goal is not only to build a scooter, but to create a platform where other developers, makers and researchers can experiment with the same technologies.
π Resources
Urban Lab
https://github.com/DanielIoni-creator/urban-lab
Telekinesis RLbotics
https://github.com/telekinesis-ai/telekinesis-rlbotics
MIGHTY
https://github.com/mit-acl/mighty
MyZubster
https://myzubster.org
π What's Next?
The next development steps include:
π§ Final mechanical assembly
π§ͺ Hardware testing
π΄ Controlled prototype testing
π€ Further RL training
π§ Trajectory-planning experiments
π More sensor data
π± Improvements to the mobile application
π Dashboard improvements
The long-term objective is to build a robust experimental platform for AI-assisted sustainable mobility.
π± Final Thoughts
Urban Lab is more than an electric scooter.
It's an experiment in what happens when open-source hardware, AI, robotics and digital manufacturing meet in the real world.
The project started from a simple question:
What if we could build the mobility technology we want to use instead of simply buying it?
Urban Lab is our attempt to answer that question.
And we're building it openly.
π Urban Lab β Open source technology for sustainable mobility.
β If you're interested in the project, check out the repository, experiment with the code and contribute.
#οΈβ£ Tags
#3DPrinting #ReinforcementLearning #OpenSource #Robotics
Top comments (0)