Robot Controller Simulator

Does anyone know of a program that can simulate a robot to test my programs without having to have a upload them into the RC?

I know that there was one that worked with PBASIC, has anyone made or found one that works with C/C++??

The MPLAB IDE has a “SIM” simulation mode (it’s in the menus), but I haven’t dug into it yet. It sounds like that is what you want.

The MPLAB SIM can be used to run/walkthrough your code and inspect values and follow the execution, but it’s not like Rob Bayer’s RoboEmu of previous years.

To use it:

  1. Add “_SIMULATOR” to the macro definitions under the Project->Build Options->Project “MPLAB C18” tab. Click on Add and type it in. Make sure you remove this macro before loading the program onto the real controller.
  2.      Select Debugger->Select Tool->MPLAB SIM. this gives you some new control buttons on your menu bar.
    
  3. Set breakpoint on any source line by right clicking on a line and selecting “Set breakpoint”
  4. Can set watch – but cannot “watch” aliases, must use the real name. Also, use to view struct.
  5. Can view variable values by placing the cursor over the name, but not aliases or structs. Can view variables in any active source file.
  6.      Click on the "run" button to start your program's execution
    
  7.      Click on the "step" buttons to walk through the code one instruction at-a-time.
    
  8.      Click on "Halt" to freeze your programs execution, so you can look at things
    

Limitations:

  • No graphical output
  • printfs don’t get displayed
  • It’s difficult to use your interrupts (both internal timers and external) and they will mess-up your program’s execution unless you block them. You can block timers for instance, by adding a conditional compile statement like:

#ifdef _SIMULATOR
  OpenTimer1(TIMER_INT_OFF &   /* Turn OFF timer interrupt for MPLAB SIM */
             T1_16BIT_RW &
             T1_SOURCE_INT &
             T1_PS_1_8 &
             T1_OSC1EN_OFF &
             T1_SYNC_EXT_OFF);
#else
  OpenTimer1(TIMER_INT_ON &    /** Set to ON for normal execution */
             T1_16BIT_RW &
             T1_SOURCE_INT &
             T1_PS_1_8 &
             T1_OSC1EN_OFF &
             T1_SYNC_EXT_OFF);
#endif


You will find the simulator Useless if you use a all types and try to do math. It will choke. you must simulate on the controller to save a buch of trouble. it is good for seeing if it will run through the code but dont rely on the values of the variable.