Go to Post The 3 probably stands for the number of years this season will take off your life - JohnSchneider [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 20-09-2011, 20:09
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: 562
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 : 20-09-2011 at 20:32.
  #2   Spotlight this post!  
Unread 20-09-2011, 20:25
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
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 - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #3   Spotlight this post!  
Unread 20-09-2011, 23:01
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: 45
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!!
  #4   Spotlight this post!  
Unread 21-09-2011, 21:00
remulasce remulasce is offline
Registered User
no team
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Mtn View
Posts: 140
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.
__________________
Student 294: 2007-2011
Mentor 597: 2013-2015
Google SWE: 2015-
  #5   Spotlight this post!  
Unread 18-07-2012, 20:35
DaveFrederick's Avatar
DaveFrederick DaveFrederick is offline
Registered User
FRC #1895
 
Join Date: Jan 2009
Location: Manassas,VA
Posts: 37
DaveFrederick is a jewel in the roughDaveFrederick is a jewel in the roughDaveFrederick is a jewel in the rough
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
  #6   Spotlight this post!  
Unread 19-07-2012, 01:06
BornaE's Avatar
BornaE BornaE is offline
Registered User
FRC #0842 (Formerly 39)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Gilbert, Arizona
Posts: 359
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
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 0x27
  #7   Spotlight this post!  
Unread 19-07-2012, 09:36
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: 945
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).
  #8   Spotlight this post!  
Unread 19-07-2012, 10:16
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: 1,622
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.
  #9   Spotlight this post!  
Unread 07-08-2012, 09:49
Spectare Spectare is offline
Team Hacker
AKA: Benjamin Pylko
FRC #3181 (Pittsford Panthers)
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Rochester, New York
Posts: 16
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).
  #10   Spotlight this post!  
Unread 07-08-2012, 12:13
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: 518
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
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.

  #11   Spotlight this post!  
Unread 07-08-2012, 14:53
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: 8,570
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/
  #12   Spotlight this post!  
Unread 10-08-2012, 22:39
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: 45
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.
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


All times are GMT -5. The time now is 23:00.

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