Log in

View Full Version : simulator (now that the bot is shipped)


mcktim
06-03-2006, 15:17
Is there any kind of simulator that one can use to try out some code now that the robots have shipped. (we still have the joysticks and operator controller)

Thanks

JJG13
06-03-2006, 16:28
You can make your own simulator. With some finagling, it is possible to get the code from your robot to comile on a PC. You can then feed the program inputs and print out the outputs to see if they match what you want. If you want to get fancy, you can make your own GUI to simulate your whole OI and display outputs. This is what I have done so I can (theoretically) test all code before placing it on the robot and have confidence that it works.

Here is a pic:
http://img377.imageshack.us/img377/3193/robotsim1ju.th.jpg (http://img377.imageshack.us/my.php?image=robotsim1ju.jpg)

ewankoff
06-03-2006, 16:55
that looks like a pretty cool program could you post it here for the not so much programmers

lkdjm
06-03-2006, 16:55
Would you be so kind as to give us a hint on how to do that? Did you make that in visual basic? (i have that so i could do it!) If you posted that program entirely I would be forever in your debt. Thanks
-Dave
-564.first@gmail.com

kjhobin
06-03-2006, 17:21
this looks like a valuble resource for teams, could you please share your app?

lemoneasy
06-03-2006, 19:29
is that a real program JJG13? I think that just using last years board, for those who have it, is much simpler to run it through then emulating the whole control board system.

If that is a real simulator though, those are some interesting autonomous modes...

Jimbo5051
06-03-2006, 19:37
I think it is possible to use an older robot that you still have.

lkdjm
07-03-2006, 14:42
I think it is possible to use an older robot that you still have.

The point of having a simulator is to save time. If you have a usb to serial converter, uploading to the bot can take up to 5 minutes. I know this because I have to deal with it. With a simulator, you can test the progam and be already solving the problem in 5 minutes or less. It is not only easier, but it is a big time saver. If only I had a simulator...

JJG13
08-03-2006, 18:45
Would you be so kind as to give us a hint on how to do that? Did you make that in visual basic? (i have that so i could do it!) If you posted that program entirely I would be forever in your debt. Thanks
-Dave
-564.first@gmail.com


First I modified the code until it would actually compile on my computer. To do this I put #ifdef COMPILE_FOR_ROBOT... #endif around much of the hardware specific code in the .c files such as ifi_startup.c. I then created a new file called PCCompile.c to contain my version of all the functions I removed using that method as well as functions in FRC_library.lib. I chose to create the GUI in a different program since I HATE writing GUIs in straight C using the windows API and I did not want the gui code mixed with the robot code. To communicate between the robot code and the GUI I used the window's clipboard. Now here's the clever part. I used my versions of GetData and PutData in PCCompile.c to facilitate the communication between the two programs. The robotcode currently sends txdata, and the relay values via the clipboard in PutData and receives rxdata and the digital inputs in GetData. I had to do several other things to make the code work and I'll probably write a whitepaper to explain this in more detail once I get enough time.

Edit: Attached are the PCCompile.c and PCCompile.h files. This contains most of the code that makes the simulator work.