Raspberry Pi robotics · Bare metal · V0
The SDK for Raspberry Pi robots: bare metal, Linux-free, run straight from IntelliJ.
Any robot. Here are a few.
A robot arm picks up LEGO bricks and sorts them by color.
Arm design by mareklew (Rebrickable MOC-178586)
namespace demo.sorter
import grandtheorem.rpi.Pi
import namespace grandtheorem.buildhat
import namespace nylon.time
# A color-sorting arm on the Build HAT. Put a red,
# yellow, green or blue brick in front of the Color
# Sensor, and the arm picks it up, turns to that color's
# side and lets it go.
#
# The ports: the base on A, the lift on B, the gripper
# on C and the Color Sensor on D. Where each one turns
# to is in settings.code.
#
# The lift and the gripper hold wherever each run leaves
# them (`holdAfterRuns()`): the arm stays up against
# gravity, and the gripper keeps its grip on a brick,
# with no push or squeeze to tune.
# Sorts bricks until it's stopped.
entrypoint.default sort() {
let hat = BuildHat.connect(Pi)
let base = hat.motor(Port.A)
let lift = hat.motor(Port.B)
let gripper = hat.motor(Port.C)
let eye = hat.colorSensor(Port.D)
lift.holdAfterRuns()
gripper.holdAfterRuns()
release(gripper)
lift.runToPosition(UP, LIFT_SPEED)
base.runToPosition(PICK, TURN_SPEED)
println("ready to sort red, yellow, green and blue")
var sorted = 0
while (true) {
if (sortOnce(base, lift, gripper, eye)) {
sorted = sorted + 1
println("sorted ${sorted}")
}
sleep(100.milliseconds())
}
}
# Sorts the brick in front of the sensor, if it's a
# color the arm sorts: picks it up, carries it to its
# color's side, lets it go, and comes back over the
# sensor. Answers whether it sorted one.
let sortOnce(
base: Motor,
lift: Motor,
gripper: Motor,
eye: ColorSensor
): boolean {
if (let color? = steadyColor(eye)) {
if (sorts(color)) {
println("a ${colorName(color)} brick")
sleep(1.seconds())
lift.runToPosition(DOWN, LIFT_SPEED)
grip(gripper)
lift.runToPosition(UP, LIFT_SPEED)
base.runToPosition(sideFor(color), TURN_SPEED)
release(gripper)
base.runToPosition(PICK, TURN_SPEED)
return true
}
}
return false
}
# Closes the gripper on a brick. It holds there,
# squeezing the brick, until it's opened.
let grip(gripper: Motor) {
gripper.runToPosition(CLOSED, GRIP_SPEED)
}
# Opens the gripper.
let release(gripper: Motor) {
gripper.runToPosition(OPEN, GRIP_SPEED)
}
How it works

01
Write the card
Nylon is the whole system on the board. There is no OS to install under it.

02
IntelliJ finds it
Connect it to your network, and it appears in the IDE. No SSH, no terminal.

03
Press run
Your program compiles, streams to the board, and runs. The robot moves.
Built for advanced robotics
Nothing underneath
Your program runs as a Nylon isolate, directly on the hardware. No Linux, no middleware.
A crash stays in your program
Crash isolation. Even after a failure, the board keeps running, ready for the next run.
Hardware with a type
Pins, motors and serial lines are typed devices. The compiler catches the mistake before the robot does.
Unlock the full power of Raspberry Pi
No Linux underneath: your program has the whole board, a 64-bit processor and hundreds of megabytes of memory, far more than a microcontroller. Async arrives in V1.
Compiled, not interpreted
Everything compiles to native code. No interpreter sits between your code and the chip.
Share code with ease
A library is a single file. Share the file, or point a project at its Git repository. Nothing installs system-wide.
Soon
Real-time flight controlV1
A drone flight controller written in Nylon, with hard real-time guarantees from Nylon kernel modules.
Calling FFI librariesV1
Nylon assemblies package and deploy C-bindable code, so existing drivers and libraries come along for the ride.
Grid Compute ClustersV2
Boards bring up their own Wi-Fi, find each other and compute as one fleet. Deploy an application across all of them in one step.
Boards
Nylon is the SDK that brings robotics home — for everyone. The tutorials take you from a blinking light to a robot you drive from a gamepad. Where you go after that is up to you.
Start with a tutorial