Go to Post I think we sometimes forget that FIRST is not just about building robots. Its purpose is to educate and inspire young people in the field of science and technology. - amanda [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-05-2005, 19:32
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Code Simulator

I've been playing with the idea of creating a simulator for next year, where you would input code and an onscreen diagram would show you the values of sensors, location on the field, etc. How would I be able to simulate what code would do in a real world environment? I can understand making a scripting simulator (DRIVE_10_FEET kinda thing), but I can't comprehend how to take arrays/structs/variables in a piece of code and relate it to how a robot would react.

Thanks for the help guys, if/when I finish this I'm going to definetly post it here =)

EDIT: Anybody have an idea on what language I should use? I'm thinking of C# so I can have an excuse to learn it ( ), but maybe VisualBasic for ease of use...
__________________
http://www.mikesorrenti.com/

Last edited by Mike : 29-05-2005 at 19:41.
  #2   Spotlight this post!  
Unread 29-05-2005, 20:17
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Code Simulator

Quote:
Originally Posted by MikeWasHere05
I've been playing with the idea of creating a simulator for next year, where you would input code and an onscreen diagram would show you the values of sensors, location on the field, etc. How would I be able to simulate what code would do in a real world environment? I can understand making a scripting simulator (DRIVE_10_FEET kinda thing), but I can't comprehend how to take arrays/structs/variables in a piece of code and relate it to how a robot would react.

Thanks for the help guys, if/when I finish this I'm going to definetly post it here =)

EDIT: Anybody have an idea on what language I should use? I'm thinking of C# so I can have an excuse to learn it ( ), but maybe VisualBasic for ease of use...
The way I'm thinking of doing it for URC is to load the HEX files (which are in INTEL HEX) and running it on a PIC18 simulator/VM, which was hooked up to a hardware simulator (including another PIC18 VM running the master firmware) and the OI (probably just written in C).

As for your description, you would want a real-time C preproccessor, plus a VM. (Or just a C scripting engine).

Either way, I would like to here how it goes.
  #3   Spotlight this post!  
Unread 29-05-2005, 20:24
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Thumbs up Re: Code Simulator

Personally, I'd do it in C++, if only because I already know it. I've read a few books on C#, but I know it no where near well enough to do the fairly in depth way that will be required for this. Depends on your learning style though: if you like to get into the heavy stuff right away on a realy project, go right ahead.

I'm not positive if you're talking about a full blown simulator which would emulate all aspects of a full RC program, or just a simple training device. I'll assume the latter. (First one. I always get confused... )

There are two ways you could do it. The first way is to go from a compiled hex and execute it fairly directly (maybe?), which simplifies the final programming, but requires you to learn all the hex codes of the RC. You could also go from the source code and interpret it, which may make programming harder/longer, but will definetely require less study of something you'll use only once.

I'd personally go with the second method (from source). I've experimented with creating my own C-like interpreted language and I'd probably use something similar to that. The basic idea is the code goes through each file and builds a giant hierarchy of "variable" and "function" objects. A variable can store any value (ignore typing a way for simplicity) and a function knows how interrprut individual statements in a function.

Interrupts could also probably be fairly easily handled. Just have a seperate thread which wakes on a button press or every x ms and runs through an functions stored in a special location/vector/array.
__________________

  #4   Spotlight this post!  
Unread 30-05-2005, 13:06
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Code Simulator

Guys,

I strongly suggest that you learn about the simulator which you already have before you go off and try and reinvent the wheel.

Look at Introduction to MPLABŪ SIM Software Simulator for a good introduction.

Mike

__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #5   Spotlight this post!  
Unread 30-05-2005, 23:10
JJG13's Avatar
JJG13 JJG13 is offline
Yoda
AKA: Joshua Graffman
None #0180 (SPAM)
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Martin County, Florida
Posts: 105
JJG13 has a spectacular aura aboutJJG13 has a spectacular aura aboutJJG13 has a spectacular aura about
Re: Code Simulator

Having a robot code simulator is an interesting idea.

My thoughts:

We use the C language and there are C compilers for PCs. So theoretically you could compile the code for a robot on a PC with minimal changes. I already do something like this. I cut and paste code on my computer to test to see if it works as I expect it to before I try it out on the robot. The problem is that even if the logic is right the numbers are wrong. For instance, if I want to rotate right 20 degrees I can check my code on my computer and see that the pwms for the right drive motors are decreasing while the left ones are increasing but I cannot tell if I'm going too far or too fast or even if there is enough power going to the motors to for the robot to move at all. What I would need in a simulator would be to calculate the physics of the situation. This would probably be harder than making a C interpreter.

However, if you do make a simulator, share it, because I would use it.
__________________
Behold the power of SPAM.
  #6   Spotlight this post!  
Unread 31-05-2005, 16:19
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Code Simulator

From this thread:
Quote:
Originally Posted by jgannon
I've used RoboEmu2 a lot this season. While it doesn't explicitly support autonomous mode, you can write your autonomous routine in Default_Routine(), and it will run just fine. [...] RoboEmu2 is definitely very useful for showing how input from sensors or users translates into outputs on the PWMs.
How does RoboEmu2 differ from what you're proposing?
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_
  #7   Spotlight this post!  
Unread 31-05-2005, 16:37
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Code Simulator

Don't know exactly, but it would support auton and interrupts.

But yeah, Roboemu gets the job done mostly.
__________________

  #8   Spotlight this post!  
Unread 31-05-2005, 20:52
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: Code Simulator

I've used RoboEmu, nice program. The difference between mine and RoboEmu, is mine will be geared mostly towards autonomous mode (it'll also have support for user controlled).

User controlled mode would be similar to the RoboEmu program, a virtual joystick, the ability to change the values of sensors. It'll also have a view of where the robot is on the field, how the arm is positioned, etc.

To see how the arm/other limbs are positioned will be a hard problem to solve, seeing as each teams is different. Originally, it'll be for a generic type of arm, and hopefully it will evolve into some type of customization system.

Autonomous mode will be the same as user controlled, except that it runs just from the code (like in real life). Not sure how I'm gonna handle advanced sensors such as a gyroscope or CMUCam, so those probably won't be implemented in the first few versions.

All in all, with the massive amount of projects I've thrown into a ToDo pile, this will probably result into a very basic version by the end of the summer. Maybe not something to completely replace Roboemu, but definetly as an alternative.
__________________
http://www.mikesorrenti.com/
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of the Box Camera Code russell Programming 9 21-10-2009 05:28
Simulator to Test Code? jlewellen Programming 3 03-02-2005 16:36
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28
Sourceforge for Code Repository and other stuff SilverStar Programming 9 15-01-2005 21:16
heres the code. y this not working omega Programming 16 31-03-2004 15:18


All times are GMT -5. The time now is 16:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi