Go to Post Please stand up and be proud of who you are and what you believe in! - MattK [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 14-02-2009, 22:34
smackee618 smackee618 is offline
Registered User
FRC #1327
 
Join Date: Jan 2009
Location: St. Louis, MO
Posts: 7
smackee618 is an unknown quantity at this point
No robot available to test code on

So... I'm the lead programmer for my team, and we have encountered many mechanical problems, the result being that I have no way to test my code. This is bad because the ship date is looming large.

Advice?
  #2   Spotlight this post!  
Unread 14-02-2009, 22:48
smackee618 smackee618 is offline
Registered User
FRC #1327
 
Join Date: Jan 2009
Location: St. Louis, MO
Posts: 7
smackee618 is an unknown quantity at this point
Re: No robot available to test code on

I forgot to mention that I'm using labview. Also, sorry if this has been asked before.
  #3   Spotlight this post!  
Unread 14-02-2009, 22:52
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,082
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: No robot available to test code on

This happens a lot. To veteran and rookie teams alike... I know that I've been programming our robot between matches more times than I can count.

I do have some advice, though (some of this won't help this year, but might come in useful in preventing this in the future).

1. Code in "units". Don't write a 1000 line program, build it, and expect everything to work the first time. It just doesn't happen. Even if you only have a day to test code, try to test it incrementally. First get the drive working. Once you're happy with that, move onto the scoring functions.

2. There are two types of tuning/debugging you will need to do: correctness testing, and parameter tweaking. A complicated sequence of commands is something that you can either get right or wrong. Other things, like PID loops, time delays, etc. need to be tweaked until they work well. You can oftentimes do "correctness" testing by running your C++ code on a PC (taking out cRIO specific things as necessary). Or you can try your LabView code in a non-real time environment. Make sure your function(s) output expected values. But tuning needs access to the robot. So make sure your code is correct before downloading to the machine, and worry about tweaking afterwards if you can.

3. Have a plan. Know what you want to get working first, what can wait, and what is just bells and whistles.

4. Write maintainable code. Use parameters and constants liberally. These will make changing things that much easier.

Good luck! It sucks sitting around watching the mechanical folks do their thing (hopefully none of my team's mechanical team is reading this). But know that you are in good company!

EDIT: I posted before I saw you are using LabView. Still, these points should apply.
  #4   Spotlight this post!  
Unread 14-02-2009, 23:13
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,756
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: No robot available to test code on

Very good advice so far.

I'd add that with LV you can do a bit more unit testing than in C/C++. As an example, I assume you'll want to put code in your teleop for your manipulator. First write the button or joystick code, but just update global variables. You can disconnect the modules from the cRIO, run cables, and go ahead and test that you got the joystick logic correct and that setpoints to other modules look correct. Then you write a periodic loop to read the setpoint, read a pot, run through a PID to control the motor, etc.

Another tip for quicker LV coding. Avoid constants if you have any doubt of the end value. Instead, put the values into front panel controls and make your initial guesses be the defaults. Later when you can start running and need to tune, you can just type new values in without stopping, modifying, and rerunning.

Good luck.
Greg McKaskle
  #5   Spotlight this post!  
Unread 14-02-2009, 23:42
smackee618 smackee618 is offline
Registered User
FRC #1327
 
Join Date: Jan 2009
Location: St. Louis, MO
Posts: 7
smackee618 is an unknown quantity at this point
Re: No robot available to test code on

Awesome pointers. I really like the idea of separating the debugging and tuning into correctness testing and parameter tweaking components. Thanks very much. Hopefully, come competition day, we'll only need to worry about tweaking a bunch of PIDs.
  #6   Spotlight this post!  
Unread 14-02-2009, 23:55
Jetweb Jetweb is offline
is good at making robots find walls
AKA: Jonathan
FRC #0179 (Children of the Swamp!!!)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Jupiter, FL
Posts: 213
Jetweb is a name known to allJetweb is a name known to allJetweb is a name known to allJetweb is a name known to allJetweb is a name known to allJetweb is a name known to all
Re: No robot available to test code on

Quote:
Originally Posted by smackee618 View Post
Awesome pointers. I really like the idea of separating the debugging and tuning into correctness testing and parameter tweaking components. Thanks very much. Hopefully, come competition day, we'll only need to worry about tweaking a bunch of PIDs.
Just a hint for tuning a bunch of PID's quickly. Make a box with 3 pots that plug into the driver station and write some code to take them and set there values to the loop dynamically.

I'm not a labview person so you might be able to do that with labview instead of pots, but that's how we old fashion people on my team do it.
  #7   Spotlight this post!  
Unread 15-02-2009, 01:25
Boydean's Avatar
Boydean Boydean is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Apr 2007
Rookie Year: 2003
Location: SC
Posts: 319
Boydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant futureBoydean has a brilliant future
Send a message via AIM to Boydean
Re: No robot available to test code on

All these things are really good. Ill just add in my two-cents.

A. Get someone on the team that is pretty good at logic. It doesn't need to be someone that really is into programming. Get them to sit next to you and walk through the program with them; step by step. This will kill alot of debugging time when the robot it ready for real testing. Trust me it works.

B. Write comments in your code...and some more comments. It doesn't matter if your the only programmer writing comments just for your self will help a lot. Its the simplest thing to do but yet the easiest thing to forget.

C. If you have any limits on your robot, stuff that prevents your robot from killing it self. Program thoughs first, before you test anything make sure those limits work. Its one thing to sitting around waiting for the mech. guys to get the robot done, its something else watching them fix it when it just killed it self.

All the advise mention is great. This being the fourth year being the only programmer on our team(1 FLL, 1FVC, 2FRC). Just remember, its tiring to program but not as tiring as sawing and drilling. So its up to you to keep the energy flowing at all times(just a little something random). Good luck!
__________________
  #8   Spotlight this post!  
Unread 15-02-2009, 01:51
smackee618 smackee618 is offline
Registered User
FRC #1327
 
Join Date: Jan 2009
Location: St. Louis, MO
Posts: 7
smackee618 is an unknown quantity at this point
Re: No robot available to test code on

Quote:
Originally Posted by Jetweb View Post
Just a hint for tuning a bunch of PID's quickly. Make a box with 3 pots that plug into the driver station and write some code to take them and set there values to the loop dynamically.

I'm not a labview person so you might be able to do that with labview instead of pots, but that's how we old fashion people on my team do it.
I am not completely sure of what you are suggesting here. I think you are saying that the pots will to allow you to tune the PID on the fly. If so, this sounds like a really good idea for people who are not using labview. Labview makes it easy, though (front panel ftw)

I'm getting off topic here, but this talk about pots has sparked my interest. Assuming that I was correct about pots being used to tune the three values in a PID controller, I have another question (I don't know much about PIDs, so this might be a dumb question). How do you determine the range of values that you want the pot to give you for the PID? Do you just make an educated guess?

Also, thanks for all the great advice from everybody. I'm starting to feel the old excitement again.
  #9   Spotlight this post!  
Unread 15-02-2009, 01:59
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: No robot available to test code on

Quote:
How do you determine the range of values that you want the pot to give you for the PID?
It's basically an educated guess, based on reasonable gain ranges for your application.
__________________
Get yer robot source code here!
  #10   Spotlight this post!  
Unread 15-02-2009, 07:52
deusex's Avatar
deusex deusex is offline
Registered User
FRC #0422
 
Join Date: Oct 2007
Location: Maggie Walker
Posts: 5
deusex is an unknown quantity at this point
Re: No robot available to test code on

yeah, the same testing problems happened to me. However, I used the electronics board to supplement for the whole board and just used the status LEDs of the stuff to get it to the point where most of it would work.

-Anthony
__________________
As Witicha Falls....

So Falls Witicha Falls
  #11   Spotlight this post!  
Unread 15-02-2009, 08:33
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: No robot available to test code on

This is the first year I haven't been in your situation. What my team did (and what I now recommend EVERY team do) was build the kitbot on day 2 and just left it alone with the programmers. Come week 5 when the mechanical team needs to steal all our precious electronics, we don't care because we already finished all the moving-base stuff: TCS, camera control, PID control, etc were all done while the robot was in the design + prototyping stage.

I completely feel for you: it really sucks getting blamed for poor performance when its mostly the mechanical team's fault for not letting you program on the robot. Try to point out that if they don't give the programmers a few hours on the robot, everything they build will be mostly useless because it won't be controllable. A slight reduction in mechanical capabilities because of something only partially finished is more than made up by a massive increase in robot control.

If you do get time on the robot though, remember to prioritize. Don't waste your valuable hours trying to get TCS or camera control working, those take days or weeks to get right. Plus you can keep your control system and tune the camera after ship. Here's the order I'd work in:
1) Basic robot control (1-button, 1 actuator)
2) Basic autonomous (drive-straight, drive in circle, etc)
3) More advanced robot control (one-button for multiple functions if your robot has them)
4) Get the gyro working, then do more advanced autonomous (pattern-running)
5) Traction control
6) Camera control
Of course, your priorities will vary. A shooter bot would probably have a much higher priority on camera control. But always keep in mind you can keep your control system after ship. If it doesn't HAVE to be tested on the competition bot, then don't waste your pre-ship time coding it.
  #12   Spotlight this post!  
Unread 15-02-2009, 09:52
omalleyj omalleyj is offline
Registered User
AKA: Jim O'Malley
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: New Jersey
Posts: 132
omalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to beholdomalleyj is a splendid one to behold
Re: No robot available to test code on

Do you have old robot parts from previous years? We have a small test robot that can be used as a test bed while the competition robot is being worked on.
Knowing that programming this year would be worse than last because of all the changes I took extra steps. I built a plywood box that has a PDB, DSC, 2 Victors, 2 Jaguars on it. The cRIO can be placed in it or removed with only two screws. The ethernet connection is held in place with velcro.
It did require buying an extra PDB, extra connectors, and making extra cables, but I can move things between the real robot and the test bot in about 10 minutes. This allows me to have a development test bed that we can bolt onto a test chassis, or I can bring home. When we ship the robot I will still be able to work on programming, and only the weight of the cRIO, ethernet, and camera will count against the weight allotment.
It is probably too late to do this now, but I would recommend that every programming team put together a system in the off season that can be easily moved and modified. This year we put the slick wheels on the test bot and were programming traction control way before the competition robot was in shape to drive. Sure things needed to be tweaked, but basic testing was done and it was a matter of tuning, not basic debugging.
  #13   Spotlight this post!  
Unread 15-02-2009, 15:43
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,833
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: No robot available to test code on

Don't forget the withholding limit... perhaps you can hold back parts of your robot, or replicate the drive base, to work on your code after ship date.

Jason

P.S. Oh, year, just for reference... our lead programmer has made a very small request for this year. He would like one hour with the robot, in final configuration, before we ship. He has based that on a couple seasons of previous experience, and we might... just might... be able to give him an uninterrupted hour with the machine on Monday night.
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
White Paper Discuss: 2003 Automated Dead Reckoning Test Code CD47-Bot Extra Discussion 10 07-09-2005 11:25
Simulator to Test Code? jlewellen Programming 3 03-02-2005 16:36
Updated Encoder Code Available Kevin Watson Programming 2 04-01-2005 01:00
New Code Simulator Available? authgeek1218 Programming 1 03-12-2003 13:18
TechnoKats Automated Test Drive Code Greg McCoy Programming 1 16-01-2003 17:45


All times are GMT -5. The time now is 01:59.

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