
What is PICRoboSim?
PICRoboSim is lab software which provides a simulation of the
Stevens Institute of Technology Engineering Design I robot project. Its
main feature is that C/C++ code written for the PIC-based robots used
in
Design I runs through the simulator without modification, demonstrating
the simulated robot's behavior on-screen. It was written by Chris Merck
as part of his design project in the fall of 2006 and is still somewhat
under development. PICRoboSim is also intedend for use in the E115
Intro to Programming course for Engineers and E121 Design I to help
students develop their programming skills and write effective robot
control programs for use in the Design I robotics competition.
The source code for PICRoboSim is available on this website under a free software license, see downloads section.
Project Goals
- Provide near-100% code compatibility with c2cpp-based robot C code
- Provide a qualitatively and quantitatively accurate simulation of robot performance
- Provide a manual control feature to help programmers create their algorithms
- Allow customization of virtual robot to match student's actual design
- Allow the implementation of machine learning algorithms to develop/optimize robot code (see below)
- Portability and modularity to facilitate code reuse
- Improving the freshman engineering design curriculum through use in E115 and/or E121 courses
Download
The latest version of PICRoboSim may be downloaded from
here.
The PICRoboSim Handbook can be found
here.
Installation
On Windows: Download the executable installer, extracting to the
default location of C:\. This must be done on a windows PC that
has Visual Studio 2005.
On Linux/Unix: Unsupported as
of now. If someone pays me to work on this (i.e.: summer project) I
will rewrite the platform dependant sections and the code will compile
and run on at least Linux and NetBSD in addition to Microsoft Windows.
Documentation and Usage Instructions
The PICRoboSim Handbook can be found
here.
For the old, rather hacked together usage instructions,
click here.
Screenshots

A
visualization consisting of an SDL screen displaying the robot's position,
sensor data, and a raycasted 3D view of the arena from the robot's
perspective.

Configuring the robot's light sensor positions using the Robot Configuration Screen.
Editing the student's robot control program in Microsoft Visual Studio.
Sample Application Outside of Course Requirements
The following histograms showcase the statistical power of PICRoboSim.
The simulator was used to run over 2000 time-trials of two different
versions of a robot C program. The results were made into histograms
which show the improved performance of the second version of the code.
These images are taken from my Design I final report.

Tecnical Details

Above is a diagram detailing the workings of the simulator. In short, a
session control thread runs first and manages the simulation. It spawns a control, or
brain thread containing student C code and then the
engine thread,
which provides a complete emulation of the competition arena used in
Design I: the mechanics, lighting, and rules. To simplify the whole
program I didn't use mutexes or semaphores (no thread synchronization).
Instead I just carefully constructed the communication variables, and
hard-kill the brain thread when needed (even though some people on ##c
thought that unconditionally killing a thread was a
realy bad idea).
Machine Learning?
Assuming many instances of the simulation may be run in a short
period of time it may be possible to implement machine learning or even
a genetic algorithm to have the robot's code "write itself". I have
entertained various ideas concerning methods, including using lisp,
lisp to C conversion, C learning, and even machine code learning. Of
course, machine code learning is out of the question, but I did get
some
interesting reactions from people on #lisp (a freenode irc channel).
UNIX Port:
Because of the standard C/C++ techniques employed in writing
PICRoboSim, and also due to the use of free open source libraries such
as SDL, PICRoboSim is lighly portable. I spent a short while (two
hours) playing with #ifdef blocks and managed to get the simulator to
compile on Ubuntu Linux. With but a little more work (and motivation)
PICRoboSim should run on any of the free Unixes. Most of this work is
in porting the multithreading code to pthreads. If anyone is interested
in a port, please contact me.

The simulator running under Ubuntu Linux Feisty, with not all of the glitches worked out!
Contact
Please direct questions, comments, and contributions to my email: cmerck at stevens dot edu.