botblocks
botblocks is a stack for robotics rapid prototyping. write 6 lines of python and you have a robot driving around in sim. change one line and the same code runs on hardware.
it's built around three ideas:
- (subsystems, providers) robots have reusable
Subsystems likeArmorDiffDrive, and are implemented byProviders likeCameraUSBorServoSTS. - (one loop, many robots) nearly all boilerplate is derived from data you already have (like cad files), so you can simply swap in new robots
- (one loop, many backends) your
robot.loopruns against a mujoco sim or a usb-connected robot with no code changes - (ml as a first-class citizen) vision models, LLM agents, and learned policies are ready to use in your loops
sim your first robot
from botblocks import *
robot = Robot().load('menagerie/ufactory_xarm7')
@robot.loop
def loop(bot, env):
bot['drive'].power(fwd=1, turn=0)
MujocoEnv([Plane(10), Box(0.1, pos=[0, 0.4, 0]), robot]).start()here we
- loaded an existing robot from a library
- set up a function to run every tick
- used the robot's preconfigured drive system
- built a physics simulator hosting a ground
Plane, aBox, and the robot - connected to the sim and watched it run!
run your first real robot
other than the MujocoEnv physics simulator, you can swap in LocalEnv to run the same code on your own computer. just specify that motor control is provided by ServoSTS:
from botblocks import *
robot = Robot().load('public/so101')
@robot.loop
def tick(bot, env):
bot['arm'].move([0, 0, 0.01])
bot['jaw'].target(0.5)
LocalEnv([robot], providers=[ServoSTS]).start()botblocks supports any robot! if yours isn't predefined, you can upload a .urdf and meshes to the project page, or import the .step and assign its subsystems with a few clicks. an Arm's kinematics are inferred from geometry.
first-class ml
plug in any model, and run it anywhere, even hosted locally:
from botblocks import *
robot = Robot().load('menagerie/ufactory_xarm7')
# todo...