Go to Post Engineering rules of thumb don't form the garbage that goes into the making of the robot. They take the garbage of the real world and turn it into more pure, if slightly diluted, data. - DampRobot [more]
Home
Go Back   Chief Delphi > Technical > Programming
Team 51   CD-Events   CD-Media   CD-Swap   CD-Spy   FRC-Spy   Unsung FIRST Heroes   WFA
portal register members calendar search Today's Posts Mark Forums Read FAQ rules
VEXpro
The Chief Delphi Forums are sponsored by Innovation First International, Inc.
Kettering University
ADVERTISEMENT

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-20-2011, 07:09 PM
lemiant's Avatar
lemiant lemiant is offline
the Dreamer
AKA: Alex
FRC #4334 (Alberta Tech Alliance)
Team Role: Leadership
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Calgary, AB, Canada
Posts: 532
lemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond repute
cRIO simulator

Is there some way to simulate a cRIO on a laptop when teaching programming?

EDIT: I love python but its not real developed enough yet, plus the school has experience with Java, so that is what we will be using.

Last edited by lemiant : 09-20-2011 at 07:32 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 09-20-2011, 07:25 PM
apalrd's Avatar
apalrd apalrd is offline
Embedded Programmer
AKA: Andrew Palardy (Most people call me Palardy)
FRC #0033 (Killer Bees)
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,152
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: cRIO simulator

You could program for a non-crio target.

If you are using LabVIEW, you can use indicators and sliders as your input and output. Create a new VI from scratch, drag a while loop and wait (about 25ms seems good for robots), and click the run button to simulate. If it tries to download to a robot, then you created the VI in an RT project (which you don't want to do).

If you are using a different language, you can compile C/C++ code for consoles fairly easily, but GUI's are fairly hard for new programmers to quickly create and GUI programming is nothing like RT programming.

Either way, you'll be simulating the algorithm and teaching programming concepts, not the actual use of the WPI library (which is only a small part of robot programming). This is still useful even during the build season, to prove algorithms before running them.

Algorithm development is one of my favorite parts of programming, and I spend a good deal of time each season simulating the more complex portions of code on my laptop while I'm not even at the shop.
__________________
Kettering University - Electrical Engineering
Kettering University SAE Teams
Chrysler Powertrain - Controls and Calibration

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Reply With Quote
  #3   Spotlight this post!  
Unread 09-20-2011, 10:01 PM
James Critchley James Critchley is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Apr 2011
Rookie Year: 2010
Location: Lake Orion, Michigan
Posts: 43
James Critchley is an unknown quantity at this point
Re: cRIO simulator

Are you looking to simulate the cRIO or a robotic environment?

Palardy's got it right. You can just "stub" out the entire cRIO as this is "only a small part of robot programming." I would even say VERY small part if your robot does only half the stuff the Killer Bees do.

To do this, just create one "hardware interface" subroutine/class and make a call to it every cycle through your robot code. Or stick it in another thread with a timer or however your team (and other teams who do not use LabVIEW) do it. The trick is to group all of your cRIO specific code in there... I'm not sure how the Java and C++ environments work, but you probably also have to create a surrogate Java class for the "main" process because that won't run in the PC environment either? That should just be a matter of creating a mostly empty class with the same interface and included using a different header file with the same class name.

This kind of partition in your robot code is HIGHLY recommended. It allows you to separate your robot control algorithms from the hardware interface and VALIDATE the hardware specific portion (polarity, units, encoder functionality, low level controls, etc.) INDEPENDENTLY. If you have a simulator, you can VERIFY the algorithms as well. You should have your SW team create a HW checkout program and NEVER test code on the robot unless it passes. This saves a lot of headaches and is a useful diagnostic tool for the entire season.

Once you have the partition, you can stick any kind of robot model you want (simple or complex) inside the stub for execution on the PC. Of course I highly recommend the Team 302 trainer VIRSYS http://www.virsys.org. If you can write a UDP send and receive routine for floating point arrays (we already have one that's close in C# / javascript) then you can get VIRSYS running for C++ in short order. The first (now second) release is designed as an instructional tool.

How do you plan on simulating the Joystick, other control boxes, and driver's station? This is not the cRIO. LabVIEW makes this easy with lots of virtual dials, switches, charts, and simple recognition of joysticks (limited to first 3 axes and 16? buttons). You can add that to the tool chain as a "driver station" stub in exactly the same way (just borrow the setup and UDP communications already available in the VIRSYS LabVIEW distribution).

I don't really know Java. However, if you are willing to give it a try, I can create a quick and dirty C++ example of this that should convert without too much difficulty.

Great question and good luck!!
Reply With Quote
  #4   Spotlight this post!  
Unread 09-21-2011, 08:00 PM
remulasce's Avatar
remulasce remulasce is offline
Code Associate
FRC #0597 (Wolverines)
Team Role: College Student
 
Join Date: Jan 2010
Rookie Year: 2007
Location: LA
Posts: 113
remulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to behold
Re: cRIO simulator

Code simulator is coming for Python.

See RobotPySim on https://github.com/robotpy. Current version is very (very (very)) early and lacks documentation, but will display the output of jaguars in response to the y axis of a joystick. Replace robot.py with your own, set up how to display outputs and receive inputs in robotconfig, and run robotpysim.py. Included test robot drives three motors in response to one joystick Y axis, controlled with w and s. Requires python 3.1.X (the same as the one running on the CRIO) and the correct pygame version for that release.
__________________
Studying CS:Games at USC. Minoring in the FRC Game Manual.

Student 294: 2007-2011
Mentor 597: 2013-

2008 FTC World Champions
2010 FRC World Champions
Reply With Quote
  #5   Spotlight this post!  
Unread 07-18-2012, 07:35 PM
DaveFrederick's Avatar
DaveFrederick DaveFrederick is offline
Registered User
FRC #1895
 
Join Date: Jan 2009
Location: Manassas,VA
Posts: 26
DaveFrederick is an unknown quantity at this point
Re: cRIO simulator - FrcSimulatorClient-full-0.1a.jar

There appears to be a new CRIO simulator available.

Has anyone gotten the FrcSimulatorClient-full-0.1a.jar to work?
Does anyone have documentation?

http://sourceforge.net/projects/frcsimulator/

Dave Frederick, Manassas VA
Reply With Quote
  #6   Spotlight this post!  
Unread 07-19-2012, 12:06 AM
BornaE's Avatar
BornaE BornaE is offline
2009 Control System Beta Test Team
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 341
BornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant futureBornaE has a brilliant future
Send a message via Skype™ to BornaE
Re: cRIO simulator - FrcSimulatorClient-full-0.1a.jar

Quote:
Originally Posted by DaveFrederick View Post
There appears to be a new CRIO simulator available.

Has anyone gotten the FrcSimulatorClient-full-0.1a.jar to work?
Does anyone have documentation?

http://sourceforge.net/projects/frcsimulator/

Dave Frederick, Manassas VA
I was a CSA(Control System Adviser) this year. that tool is used by the FTAs and CSAs to confirm the field functionality and troubleshooting. It only simulates a robot from the FMS comms point of view and not much else.
__________________
-Borna Emami
Team 39 LADS Video || Team 0x27 || NURC Entry Video
2007: AZ Champions, AZ GM Industrial Design Award, NV Finalist
2008: AZ Champions, AZ GM Industrial Design Award, AZ Delphi "Driving Tomorrow's Technology Award", NV Champions, NV GM industrial Design Award
2009: AZ Champions
Programmer
Reply With Quote
  #7   Spotlight this post!  
Unread 07-19-2012, 08:36 AM
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 542
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: cRIO simulator

One could conceivably use a Proxy (http://en.wikipedia.org/wiki/Proxy_pattern) to abstract WPILib from the actual code, allowing a mock implementation with GUI/output to be set up in its place while using the same calls and method signatures. However, you'd have to make sure everything you're using is covered by the proxy (which can be a lot of work).

I guess I've never thought about it -- would using the same package names in a mock implementation be bad form? I suppose it's not a big deal if released under the same license as the original. It sure would make it easier on the proxy (otherwise some configuration file would have to be set up, or the code in the proxy would have to be changed when building differently).
Reply With Quote
  #8   Spotlight this post!  
Unread 07-19-2012, 09:16 AM
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 540
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: cRIO simulator

Read one of my first posts on this forum as linked here:
http://www.chiefdelphi.com/forums/sh...231#post981231

That has not been updated in quite some time and the students that wrote most of it have moved on.

Perhaps you'll find some value in it.
Reply With Quote
  #9   Spotlight this post!  
Unread 08-07-2012, 08:49 AM
Spectare Spectare is offline
IgKnighters Programmer
AKA: Benjamin Pylko
FRC #3181 (IgKnighters)
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Rochester, New York
Posts: 11
Spectare is an unknown quantity at this point
Re: cRIO simulator - FrcSimulatorClient-full-0.1a.jar

Quote:
Originally Posted by DaveFrederick View Post
There appears to be a new CRIO simulator available.

Has anyone gotten the FrcSimulatorClient-full-0.1a.jar to work?
Does anyone have documentation?

http://sourceforge.net/projects/frcsimulator/

Dave Frederick, Manassas VA
I'm one of the ones working on that, it's in the very early stages and can only really be used to verify that code you've written works (to some degree). We do plan to add a gui display of the robot eventually.

As the wiki on the website says, just run `java --classpath FrcSimulatorClient-xx.xxx.jar:YourJarNameOrPathToClassFiles net.sourceforge.frcsimulator.Client --gui -s your.class.package.and.name`

We have changed the command line arguments in the svn(dev) version after developing a class to handle them, reading the doc within the code should help alot. (once we figure out a good way to post the javadoc, we'll do that, until then you can read the code or generate it yourself).
__________________
The programmers have constructed a new CaesarStatue(); at the feast of super() call!
A friend of mine and I are working on a robot simulator (sourceforge.net/projects/frcsimulator), check it out if you're interested!
Reply With Quote
  #10   Spotlight this post!  
Unread 08-07-2012, 11:13 AM
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 125
tr6scott is a splendid one to beholdtr6scott is a splendid one to beholdtr6scott is a splendid one to beholdtr6scott is a splendid one to beholdtr6scott is a splendid one to beholdtr6scott is a splendid one to beholdtr6scott is a splendid one to behold
Re: cRIO simulator

Quote:
Originally Posted by James Critchley View Post
Of course I highly recommend the Team 302 trainer VIRSYS http://www.virsys.org.
Looks like someone owes GoDaddy a couple of bucks.
__________________
The sooner we get behind schedule, the more time we have to catch up.
Reply With Quote
  #11   Spotlight this post!  
Unread 08-07-2012, 01:53 PM
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 6,597
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: cRIO simulator

Quote:
Originally Posted by tr6scott View Post
Looks like someone owes GoDaddy a couple of bucks.
Here's the new location: http://www.multibody.org/VIRSYS/
Reply With Quote
  #12   Spotlight this post!  
Unread 08-10-2012, 09:39 PM
James Critchley James Critchley is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Apr 2011
Rookie Year: 2010
Location: Lake Orion, Michigan
Posts: 43
James Critchley is an unknown quantity at this point
Re: cRIO simulator

Quote:
Originally Posted by tr6scott View Post
Looks like someone owes GoDaddy a couple of bucks.
Not exactly It's the hosting I'm not paying for. For some reason I only have one free economy hosting between my two sites. I could point the site to the multibody.org domain or to team302.org, but the subsequent VIRSYS link would need to be front page stuff and this seems inappropriate given the inactive state of VIRSYS development.

On the plus side, I won a contract that starts in a few weeks and some of the scope is relevant to making progress on VIRSYS.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 02:41 AM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © Delphi and Pontiac Central High School