RunTwin

Try your Pybricks program on a simulated copy of your own robot and field.

Run runs the file that is showing. It can import the other files by name: a file named moves.py is imported with import moves.

Output


    

Run

Ready.

Hub buttons
Click here to drive with the keyboard

With no controller, the keyboard stands in while the box above has the focus: W A S D is the left stick, the arrow keys the right stick, T F G H the d-pad, Z and C the triggers, J K U I are A B X Y, Q and E are LB and RB, 1 and 2 are View and Menu.

Hold a button down as you would on the hub. Center stops the program, unless the program has moved its stop button, and the run ends when you let go.

Start pose

The start pose places the middle of the drive axle. x runs along the field's length and y along its width, from the far left corner. A heading of 0 faces along x and grows clockwise.

Match

In a match, every run starts the robot at the start pose, on the field as the run before left it, and the runs share the match's time. Changing the field starts the match again.

Robot

Import a BrickLink Studio file (.io) or an LDraw file (.ldr, .mpd) of your robot. RunTwin measures the wheels, the axle track and the robot's size from it, and draws the model in the view. A model has no cables and no weight, so set the ports and the mass yourself, and check which way is forward. The model is drawn in one piece: its attachments do not move.

What is on each port
PortDeviceDrivesTurns this way to go forward Sensor forward (mm)Sensor to the right (mm)Sensor up (mm)Sensor faces (°)

All three motor sizes behave like the medium motor for now. A motor that drives nothing turns freely. A sensor is placed from the middle of the drive axle, at the height of the surface; it faces 0 to look ahead and 90 to look right. A sensor senses along one level line and never the robot's own frame. Place a force sensor where its button's face is when released: up to 6 mm outside the frame, or the frame meets things first. A color sensor looks straight down, whichever way it faces, and sees the surface image or the top of a field element.

Attachments: each hinged across the robot and moved by a motor
NamePortRaised by turning Pivot forward (mm)Pivot to the right (mm)Pivot up (mm) Length (mm)Width (mm)Thickness (mm)Mass (kg) Start angle (°)Low stop (°)High stop (°) Remove

An attachment swings up and down on a hinge that runs across the robot. Its pivot is measured from the middle of the drive axle, at the height of the surface. Angles are degrees above level, with the attachment pointing forward.

Lines for this robot


    

Field

The image stays in your browser and in the field file you save, as a PNG at most 1024 pixels across. Its top left corner goes on the field's far left corner.

Field elements: boxes, fixed in place or free to move
Namex (mm)y (mm)Heading (°) Length (mm)Width (mm)Height (mm) FixedMass (kg)ColorRemove