DEV Community

Daniel Ioni
Daniel Ioni

Posted on

🏭 Urban lab2: Building an Electric Scooter with AI, Reinforcement Learning and 3D Printing

🏭 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:

  1. Modify the CAD model
  2. Slice the model
  3. Print it
  4. Test it
  5. 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
Enter fullscreen mode Exit fullscreen mode

Top comments (0)