Welcome to BSim, a behavior based robot simulator. BSim is designed to allow users to experiment with behavior based programming techniques without requiring access to an actual robot (The B in BSim stands for behavior). BSim enables users to create simple worlds of rigid objects and light sources and to program robots to interact with these worlds. Various behaviors and tasks are built into the simulator to give users a feel for what can be accomplished with behavior-based programming. The simulator is accessible as a Java applet on a web page to permit maximum availability of the software.
BSim is a Java applet which runs inside your browser. To use BSim you will need an up to data Java Plugin which you can download and install from www.java.com.
The BSim applet is 800 by 600 pixels so you will need to set your screen resolution to be at least that in order to see the entire applet on the screen. Larger screen resolutions are recommended.
To run a simulation, just press the Start button on the simulator control panel. Or, you can also repeatedly press the Step button to step through the simulation one time step at a time. You can stop a running simulation by pressing the Stop button. To reset the simulator to the last time that the Start button was pressed, press the Reset button.
Several prearranged simulations can be selected from the Simulations menu, or you can build your own simulated worlds, and program your own robots to perform tasks in that world. The simulation can be run in a more true to life noisy world, or it can be run in Fantasy Mode. In Fantasy Mode, the robot get exact readings from it's wheel encoders and can turn exact angles and move exact distances. To turn on Fantasy Mode, select the Options menu and select the Fantasy Mode menu item. From the same menu you can also set how much latency the robot's light sensors have. To set the latency, again select the Options menu and select the Set Latency menu item. Move the slider to set how much latency there should be in the world.
The world in BSim consists of a two dimensional plane with walls, lights, pushable hockey pucks and robots. To add something to the world, click on the corresponding world tool button on the left side of the world view. Click anywhere on the world view to add the selected item to the world and simulation. Solid objects, such as robots, walls and hockey pucks, cannot overlap when added to the world, and you will see an error dialog appear if you try to do so. You can reposition any object added to the world by dragging the object to a new location. You can also delete objects by selecting the object and then pressing the Delete or Backspace keys.
To add a wall to the world, click the Wall world tool button. To position the wall, first press and hold the mouse button on the world view to indicate where one end of the wall should go. Then drag the mouse to the location where the other end of the wall should go and then release the mouse button. As you drag the mouse, the wall will be drawn to indicate where it's position would be if the mouse button were released. Once the wall is placed you can move its end points by selecting the wall and then moving the position handles at either end of the wall.
Hockey Pucks are small round objects which can be pushed by other moving objects. A robot can push at most one hockey puck at a time. To add a hockey puck to the world, click on the Hockey Puck world tool button. Then, click on the world view to add the hockey puck to the world at the location of the mouse cursor.
All lights are point sources in BSim. The lights are at the same level as all other solid objects, so any solid object can block a view of a light source. To add a light to the world, click on the Light world tool button. Then, click on the world view to add the light to the world at the location of the mouse cursor.
Robots are what makes BSim fun! The robots in BSim are circular differential drive robots with a bumper, two IR proximity sensors, two photo sensors and wheel encoders. The photo and IR sensors face diagonally from the front of the robot at 45 degree angles.
Each robot supports a simple, yet powerful, behavior-based programming system which includes a set of primitive behaviors and a priority list arbiter. A robot's program is called a task. A task is a prioritized list of behaviors which all simultaneously compete to control the robot. The arbiter chooses which behavior is successful. You can program each robot by configuring a set of behaviors, prioritizing the behaviors for the arbiter, and then loading the behaviors into the robot.
To add a robot to the world, click on the Robot world tool button. Then, click on the world view to add the light to the world at the location of the mouse cursor. The robot can be reoriented by selecting the robot and then moving the green orientation handle.
The sensor panel on the right side of the world view is immediately updated to be the sensor panel of the robot just added. To view the sensor panel for a robot previously added, just click on the robot you are interested in. The sensor panel shows the state of all the robot sensors and also a brief history of the behaviors chosen by the robot's arbiter.
To program a robot, double click on the robot to make the Robot Programmer dialog appear. On the left side of the Robot Programmer are two selectable lists. The left most list is the behaviors list and it contains the list of primitive behaviors that the robot supports. The list on the right side is the task list and it contains the behaviors that make up the robot's current task. A task is a prioritized list of configured behaviors that make up the robot's program.
You can add a behavior to the current task in any one of three ways. You can either select the behavior from the Behaviors menu, double-click the behavior in the behaviors list, or select the behavior in the behaviors list and click the Add button. To remove a behavior from the current task either double-click the behavior in the behaviors list, or select the behavior in the behaviors list and click the Remove button.
You can configure any behavior in the robot's task by selecting the behavior in the task list and then changing the behavior's parameters which appear on the right side of the Robot Programmer. To change a parameter, click on the parameter's value and then edit the value in the text box, or drop down list that appears. If you edit the value in a text box, be sure to hit the Enter button to finish changing the value! The text box will then disappear and the new parameter value will be displayed in gray. You can also use any of a number of ready made tasks by selecting a task from the Task menu. To load the current task into the robot, click the Load button. To leave the robot's program unchanged, click the Cancel button.
The robots in BSim currently support a fixed set of behaviors. A behavior can be configured to act in different ways by setting the behavior's parameters. What follows is the current listing of all behaviors and their parameters, although this list is constantly being updated to make the robots more flexible and interesting.
The Avoid behavior (given 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 toward obstacles. The magnitude of Gain determines how tightly the robot arcs.
The Cruise behavior drives the wheels at constant speeds. The behavior can try to drive the wheels at any speed, positive or negative, but the robot speed will max out at +/- 255. In the general case, the Cruise behavior drives the robot moves in circular arcs.
The Escape behavior is a ballistic behavior triggered whenever the robot bumps into something. The behavior is performed in three steps: backup for a specified amount of time, spin a certain angle, and go forward for a specified amount of time. A random component can be added to the spin angle by setting the Random parameter to be non zero. In general, the spin angle will be Spin + Random * 2 * (random() - 0.5) where random() is a function that returns a random number between 0 and 1. The robot will turn in the direction which will require the least amount of rotation to end up at the desired angle.
The GDR behavior determines what speeds to set the wheels to by applying a linear transformation (a matrix multiplication) to a pair of input signals which can be either the IR sensors, or the photo sensors. The transformation is as follows:
Translation = a11 * left + a21 * right + a31
Rotation = a12 * left + a22 * right + a32
Active = a13 * left + a23 * right + a33
where Translation is the translational velocity of the robot, Rotation is the rotational velocity of the robot, and Active is wether or not GDR requests control of the robot. Left and right are 0 or 1 if the input signal is the IR sensors, and between 0 and 255 if the input signal is the photo sensors.
The Gizmo behavior adjusts the robotís position relative to a light source such that the sensed brightness matches a predetermined value. If the light is too dim, the robot drives forward, and if the light is too bright, the robot drives backward. The behavior drives the robot in a straight path and sets the wheel speeds using a proportional controller.
The Home behavior tries to drive the robot toward a light source. Home uses a proportional controller to home on a light source whenever the robotís photo sensors see light. The robot homes on the light by pivoting in the direction of the light and then moving forward a step. The robot determines the direction to the light by calculating the difference between the two photo sensor measurements.
The London behavior moves the robot in a rectangular path. London is able to perform precise 90-degree turns because its implementation is carefully tuned to the timing of the simulator. However, if the simulator is not operating in Fantasy Mode, the London behavior will gradually wander away from the desired path.
The Remote behavior responds to commands from a user-controllable joystick panel which is made visible once the simulator starts. This control can drive the robot forward, backward, and pivot the robot left and right.
The Stop behavior sets the wheel speeds to zero.
The Wall Follow behavior uses the robot's left and right proximity sensors to perform wall following. The Wall Follow behavior begins in a START state, and remains there until either the left or right proximity sensor detects an object. Whenever the robot detects an object on the left, the behavior enters a LEFT state that moves the robot forward and to the right. If the robot detects an object on the right, the behavior enters a RIGHT state. In this state, the robot moves forward and to the left. From the LEFT and RIGHT states, once the robot has veered so far away that its proximity sensors are not detecting anything, the robot enters a LEFT_LOST or RIGHT_LOST state. The LEFT_LOST state moves the robot forward and left in an effort to search for the wall and the RIGHT_LOST state moves the robot forward and right. This continues until either a proximity sensor is triggered (transitioning the behavior back to the LEFT or RIGHT state), or the lost states time out and the behavior goes back to the START state. If at any time the last chosen behavior was not the wall-following behavior, the behavior immediately resets to the START state.
The Wander behavior causes the robot to meander aimlessly.
Tasks are sets of behaviors which have been configured and prioritized to perform some sort of useful function. BSim contains a number of predefined tasks which you can experiment with or you can create your own. The predefined tasks are accessible from the Tasks menu in the Robot Programmer and are described in this section.
The Collection Task brings scattered pucks to a light source. The Collection Task uses behaviors Escape, Dark-push, Anti-moth, Avoid, Home, and Cruise in order of decreasing priority. Under the control of Cruise, the robot drives straight until it comes to an object. If the IR sensors detect the object, the robot turns toward the object. Upon colliding with the object, one of two things occurs. If the object is an immovable wall, then Escape takes control and drives the robot away from the object. If the object is a movable puck, then the robot begins to push the puck. If the robot is pointed away from the light source, Dark-push becomes active and forces the robot to turn away, abandoning the puck. If a light source is visible to the robot, then Home becomes active and the robot homes on the light. When the robot approaches too close to the light and the apparent brightness becomes too great, the Anti-moth behavior triggers turning the robot away from the light.Contents
The London Task loads the London behavior, which drives the robot in a square path. The Escape behavior is not added here, in order to show how open loop control can fail, allowing the robot to wander from its path and become stuck.Contents
Simulations are complete worlds with programmed robots and objects which can be loaded and run. All available predefined simulations are accessible from the Simulations menu in the main BSim window. The simulations are described below.
To start your own simulation select New from the Simulations menu. The world will be cleared of all objects.Contents
The Collection Simulation demonstrates the Collection Task. A robot is positioned in a room with scattered pucks and a central light source. As the simulation runs, the robot moves the pucks to the vicinity of the light source.Contents
The Gizmo Simulation demonstrates proportional control using the Gizmo Task. A robot programmed with the Gizmo Task is positioned facing a light source. Initially, the gain for the Gizmo behavior is set to a low value, while world latency is set to a high value. As the simulation runs, the robot moves slowly toward the light source, stopping when a specified light intensity is reached. If the gain is increased and the simulation restarted, the robot will oscillate around the point of desired light intensity.Contents
The London Simulation demonstrates a weakness of open loop control. A robot programmed with the London Task is placed in a square-shaped corridor. The robot follows the corridor perfectly in Fantasy Mode, but will eventually get stuck once Fantasy Mode is switched off and noise is added to the system.Contents