BSim Docs

Welcome to BSim! BSim is simple robot simulator for learning and experimenting with behavior-based programming techniques. BSim is a companion learning tool to Robot Programming: A Practical Guide to Behavior-Based Robotics by Joseph L. Jones and Daniel Roth.

Using BSim

BSim simulates a simple flat world containing lights, walls, and pushable objects along with a programmable robot. You can choose from multiple preconfigured simulations to explore specific principles of behavior-based robotics or you can build your own.


Select from any of the prebuilt simulations using the dropdown at the top of the left panel:

Run a simulation

You can run a simulation using the buttons just below the simulated world:

Simulation settings

You can alter the behavior of the current simulation using various settings shown on the left panel:

Modify the world

You can tap objects in the simulated world to select them. When an object is selected, it will have a light blue color. You can drag objects to different locations.

Press the Delete key to delete a selected object.

You can also add objects to the world by tapping anywhere on the world. Select which type of object you want to add to the world using the lower dropdown on the left pane. To add a Wall, select Wall from the drop down, and then click and drag on the world to position the Wall.

Program the robot

To program a robot, tap on the robot to select it. Then tap on the Program Robot button on the right-hand pane to bring up the Robot Programmer dialog. Alternatively, just double-tap on the robot.

The Behaviors column shows the set of available behaviors that can be added to the robot's programmable Task. To add a behavior to the robot's Task, select a behavior in the Behaviors list and then tap Add.

The Task column shows the ordered behaviors that make up the robot's programmed Task. The order of the behaviors in the Task determine their execution priority from highest to lowest priority. To remove a behavior from the robot's Task, select the behavior you want to remove in the Task column and then tap Remove.

Selecting a behavior in the Task column will bring up the Properties pane for that behavior. Each behavior has properties that you can configure.

Changes to the robot's programmed Task are applied immediately. When you're done programming the robot, close the dialog.

Robot behaviors

Each robot has a built-in set of behaviors that you can select from and configure to program the robot's Task. Each behavior has behavior-specific properties that you can configure.


The Anti-Moth behavior triggers when the total light intensity measured by the robot's light sensors exceeds its Light Level parameter, causing the robot to turn away from the light by spinning a random amount to the left or right.


The Avoid behavior (give a positive Gain parameter) moves the robot forward and left if the right proximity sensor is on, or forward and right if the left proximity sensor is on. This tends to make the robot avoid obstacles. If Gain is negative, the robot turns towards obstacles. The magnitude of the Gain determines how tightly the robot arcs.


The Cruise behavior drives the robot wheels at the specified speeds.

Dark Push

The Dark Push behavior backs up and spins away whenever the robot pushes an object when no light is visible.


The Escape behavior triggers whenever the robot bumps into an obstacle, causing the robot to backup, spin, and go forwards.


Named after the light-phobic fuzzy critter with the same name, the Gizmo behavior uses a proportional controller to attempt to position the robot such that the average of its light sensor values equals the specified Light Level. If the light is too dark, the robot drives forwards. If the light is too bright, the robot drives backwards.


The Home behavior drives the the robot towards a light source.


The London behavior drives the robot in a square path.


A behavior for controlling the robot using the keyboard arrow keys.

Wall Follow

The Wall Following behavior uses the robot's proximity sensors to follow a wall.

Robot sensors

The sensor values for the last selected robot are displayed on the top of the right panel. Each robot has two forward facing light sensors, two short-range proximity sensors, a force-sensitive bump sensor, and wheel odometers. You can also see which robot behavior is currently executing.