Go to Post If everyone else in the world is an idiot, you may need to recalibrate your idiotness scale. - GaryVoshol [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 Rating: Thread Rating: 4 votes, 4.75 average. Display Modes
  #1   Spotlight this post!  
Unread 20-02-2007, 16:11
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Programming tricks (and former trade secrets)

Now that the robots are on their way to their respective drayage, I'd like to hear about some of the innovative, clever, or just plain cute programming features that teams came up with this year. Did you implement a particularly elegant control system? Did you manage to make the driver's job trivial this year? I understand if you want to keep things mysterious for a few weeks, but please consider adding to the thread once you've demonstrated your robot in competition.

Here are a few novel things the TechnoKats did this year.
  • The programmers figured out how to be lazy and not have to physically reach into the robot and push the PROG button in order to load new software. With a single wire connected between a digital output and the external PROG pin, the robot can push its own button. We have it programmed to set the output low when the letter 'p' is received on the program serial port.
  • Since the team managed to build a second robot with a fully-functioning appendage, we needed to keep track of two separate sets of PID control constants. That was enough of a push to get us to adapt Kevin Watson's EEPROM-based configuration code for our use. With a special "tuning box" plugged in to one of the OI ports, we can adjust the constants on the fly, and then save them to EEPROM. No more recompiling just to accomodate a slightly lighter or heavier bit of hardware!
  • Since we already had the necessary EEPROM framework in place, we also gave the operators "presets" that they can store and recall at will.
Anyone else feel like sharing?
  #2   Spotlight this post!  
Unread 20-02-2007, 16:21
Rob2713g's Avatar
Rob2713g Rob2713g is offline
Registered User
FRC #0540 (Screaming Eagles)
 
Join Date: Apr 2006
Rookie Year: 2004
Location: VA
Posts: 143
Rob2713g has a spectacular aura aboutRob2713g has a spectacular aura aboutRob2713g has a spectacular aura about
Re: Programming tricks (and former trade secrets)

Our programming team created a 2 joystick drive for mecanums, which provides much more control than the common single joystick drive.
__________________

2007 - NASA/VCU Regional Winners (Thanks 2108 & 843!)
2006 - Championship Curie division
2006 - NASA/VCU Semi-Finalists (Thanks 510 & 587!)
2005 - NASA/VCU Quarter-Finalists (Thanks 388 & 619!)
  #3   Spotlight this post!  
Unread 20-02-2007, 17:05
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 2,000
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: Programming tricks (and former trade secrets)

We renamed and (re)defined everything in our program making everything VERY modular and easy to read. Some of these things can even be copied, pasted and tuned for many other robots.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #4   Spotlight this post!  
Unread 20-02-2007, 17:19
meatmanek meatmanek is offline
Programmer/physicist/mathematician
FRC #0868 (TechHounds)
Team Role: Programmer
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Carmel, Indiana
Posts: 142
meatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to behold
Re: Programming tricks (and former trade secrets)

Along the lines of renaming things...

Our team uses an 'abstraction layer' which consists of a bunch of global variables and two functions: abstractIn() and abstractOut().
The global variables are things like driveLeft, driveRight, joyL, joyR, etc.
Our abstraction code takes renaming it one step farther. Rather than using the 0-255 scale where 127 means stop, we shift it down 128 (signed char, rather than unsigned), and we also invert motors where it makes sense. (one side of the drivetrain, any appendages where the motor is 'backwards')

This helps make our code MUCH more readable and configurable, and makes algorithms a bit simpler.

Another trick we did this year was one big state machine for teleoperated mode. In the past, our robot has been nothing more than a glorified remote control car. This year, our robot knows what it's supposed to be doing, with a set of states for each objective, and so the drivers are freed to think more about the game, rather than the robot.
  #5   Spotlight this post!  
Unread 20-02-2007, 17:50
benhulett benhulett is offline
Registered User
FRC #1895
 
Join Date: Feb 2007
Location: Manassas
Posts: 28
benhulett is on a distinguished road
Re: Programming tricks (and former trade secrets)

Designed a "level code" to make the arm operator's job 10x easier
Ex: you push this button, the arm moves to level 2 and sets the motor to neutral (until you push another button)
We can have it working with and without an encoder
  #6   Spotlight this post!  
Unread 20-02-2007, 18:01
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 852
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Send a message via AIM to Cuog
Re: Programming tricks (and former trade secrets)

I made the robot fight gravity actually it was a code w/ the accelerometer that would try and push back, but with no testing it made driving impossible because I got the direction that it corrects wrong, so it fights itself, oops

In the way of useful things I did this year, I got our omniwheel bot to drive mostly straight(still have to tune that) using a gyro chip that hopefully will self calibrate. The drive code also very nicely allows us to drive it FPS style with one joystick for translation and the x axis on the other for spin.
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.
  #7   Spotlight this post!  
Unread 20-02-2007, 18:11
Robo_Coyote's Avatar
Robo_Coyote Robo_Coyote is offline
Cheap_Shot
AKA: Chris Chandler
FRC #1323 (MadTown Robotics )
Team Role: Mechanical
 
Join Date: Sep 2006
Rookie Year: 2005
Location: Madera
Posts: 115
Robo_Coyote is a splendid one to beholdRobo_Coyote is a splendid one to beholdRobo_Coyote is a splendid one to beholdRobo_Coyote is a splendid one to beholdRobo_Coyote is a splendid one to beholdRobo_Coyote is a splendid one to behold
Re: Programming tricks (and former trade secrets)

Our programer made our lift motor a 20000 position servo with a program that state level 1 is between position 5000, and 7500 and so forth. He also got most of our operational programing done first time ever for that.
__________________
2005- Uc Davis Spirit Award
2006 nationals second highest score thanks to 233, and 1184

We need a longer highlight list....... sigh

"To invent all you need is imagination and a pile of junk" - Thomas Edison
  #8   Spotlight this post!  
Unread 20-02-2007, 20:03
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Programming tricks (and former trade secrets)

I've been working on a library that will work with version 3.0 of the C18 compiler. I'm almost there...

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #9   Spotlight this post!  
Unread 20-02-2007, 20:23
meatmanek meatmanek is offline
Programmer/physicist/mathematician
FRC #0868 (TechHounds)
Team Role: Programmer
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Carmel, Indiana
Posts: 142
meatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to behold
Re: Programming tricks (and former trade secrets)

Quote:
Originally Posted by Cuog View Post
I made the robot fight gravity actually it was a code w/ the accelerometer that would try and push back, but with no testing it made driving impossible because I got the direction that it corrects wrong, so it fights itself, oops

In the way of useful things I did this year, I got our omniwheel bot to drive mostly straight(still have to tune that) using a gyro chip that hopefully will self calibrate. The drive code also very nicely allows us to drive it FPS style with one joystick for translation and the x axis on the other for spin.
Last year, we used mecanum wheels to drive our robot. I played with some code using the YRG to make the joystick always be relative to the driver, rather than the robot. Push forward on the joystick, and it goes down the field, push right on the joystick, and it goes right on the field, twist the joystick and the robot will turn. Unfortunately, our drivetrain was too fast, capable of turning about one revolution per second (without the rest of the robot, I don't know what it was with all of that). The YRG was limited to 80 degrees per second. I wanted to get another gyro, but we never followed through on that.

If you're using a DAA to control an arm, you might consider using a quadrature encoder. DAAs are prone to drift, and aren't very accurate when you integrate them twice to get position.
  #10   Spotlight this post!  
Unread 20-02-2007, 20:27
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 852
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Send a message via AIM to Cuog
Re: Programming tricks (and former trade secrets)

I had to slow down the speed of our spin because at full speed the spin is roughly 2 rev/sec, not drivable at all, the YRG is on there to adjust the spin so that we spin reliably and dont over spin.

the DAA was intended to push back against another robot when they bump us, sadly it ended up fighting itself so thats something I'm going to try and fix on thursday otherwise it will just be scrapped.
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.
  #11   Spotlight this post!  
Unread 20-02-2007, 20:50
kitscuzz's Avatar
kitscuzz kitscuzz is offline
Not alotta posts
AKA: Kit
FRC #1389 (Worst Case Scenario)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Home
Posts: 47
kitscuzz will become famous soon enough
Re: Programming tricks (and former trade secrets)

We were just proud to get so many systems to work together:

The adc is now working in conjunction with the gyro code to integrate 400 times a second (which needs a long long, but we made it reset every 360 degrees to prevent overflow).

I'm soon to add in the Dual Axis Accelerometer to account for tilt so that I can kill the gyro integration if the tilt exceeds a certain angle.

We used the eeprom and trig funtions in order to make field-oriented holonomic (which I almost had working perfectly when they tore it out of my hands to ship it... hardware team didn't get the robot done until yesterday... sadness). And we're working on sticking the gyro bias into the eeprom as well in order to prevent recalculation every time you turn on the robot.

The encoder (a banner IR sensor) counts the number of times a wheel turns in order to keep track of the height of the arm.

And we were going to do the camera, but the autonomous ended up being so enormous, that we had to abandon it. We made the whole thing with multiple light tracking, and we had a plan, but it was just too difficult to get it running straight without a working Dual Axis Accelerometer and perfect camera code that we had to give up. 15 seconds is not very much time.

Although it's not particularly useful code, anyone who wants it can PM me for the accelerometer and gyro code we made. It's a little too processor intensive if your planning on doing the camera, but it can integrate up to 6200 times a second to keep really close track of the gyro angle or velocity. For whatever reason, we couldn't seem to make it keep track of the velocity very well, but we cut the error on the angle down to .5 degrees for a full spin on the bot.

Last edited by kitscuzz : 20-02-2007 at 20:54.
  #12   Spotlight this post!  
Unread 20-02-2007, 21:16
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Programming tricks (and former trade secrets)

I wrote a two-shot arm control module--if the arm's potentiometer value is more than a certain amount, it will send full speed out to that joint, otherwise, it will send a slower value until it is within a "deadband". Unfortunately, I didn't get as much testing in as I wanted to because the gear that meshes with the worm-tooth kept losing teeth and the robot dentist got more and more agitated as the night went on...I nicknamed our 'bot "gear muncher" because I broke 3 gears yesterday and 2 the day before. Little brass teeth are littering the floor. Not Good. We have some hardened steel gears coming, though.

I also have an EEPROM solution in place--you move the arm to where you want it, then hold a button combo on the handheld and the robot saves that position to the EEPROM and will recall it when that button is pressed.

Of course, our code still isn't done. It's...functional...which is an improvement over last year.

JBot
__________________
Aren't signatures a bit outdated?
  #13   Spotlight this post!  
Unread 20-02-2007, 21:24
kitscuzz's Avatar
kitscuzz kitscuzz is offline
Not alotta posts
AKA: Kit
FRC #1389 (Worst Case Scenario)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Home
Posts: 47
kitscuzz will become famous soon enough
Re: Programming tricks (and former trade secrets)

Quote:
Originally Posted by JBotAlan View Post
I also have an EEPROM solution in place--you move the arm to where you want it, then hold a button combo on the handheld and the robot saves that position to the EEPROM and will recall it when that button is pressed.

JBot
Hey, that's an excellent idea! Well now I have a solution for resetting the arm position before each match. The banner IR encoder solution I talked about is arbitrary, this will keep it in place.
  #14   Spotlight this post!  
Unread 20-02-2007, 21:29
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Programming tricks (and former trade secrets)

Quote:
Originally Posted by meatmanek View Post
Our team uses an 'abstraction layer' which consists of a bunch of global variables and two functions: abstractIn() and abstractOut().
The global variables are things like driveLeft, driveRight, joyL, joyR, etc.
Our abstraction code takes renaming it one step farther. Rather than using the 0-255 scale where 127 means stop, we shift it down 128 (signed char, rather than unsigned), and we also invert motors where it makes sense. (one side of the drivetrain, any appendages where the motor is 'backwards')
We've done this for several years. We have one set of functions that maps user inputs into various abstract state variables (speed and heading, for example, arm angle, etc), and a second set of functions that maps these state variables into pwms and relay settings. This is nice, since it means that the autonomous modes are programmed the same way.

I also got the students to use a rigorously defined finite state machine for the autonomous mode this year, and it really paid off. We gained a lot of autonomous functionality without a lot of extra effort, and it's a lot more debuggable.

Otherwise, the other neat innovation was using large numbers of infrared sensors to do a lot of our work (especially in autonomous). They also give us a "virtual bumper" that can keep us from hitting things we don't want to.
  #15   Spotlight this post!  
Unread 20-02-2007, 21:31
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Programming tricks (and former trade secrets)

Quote:
Originally Posted by meatmanek View Post
Last year, we used mecanum wheels to drive our robot. I played with some code using the YRG to make the joystick always be relative to the driver, rather than the robot. Push forward on the joystick, and it goes down the field, push right on the joystick, and it goes right on the field, twist the joystick and the robot will turn. Unfortunately, our drivetrain was too fast, capable of turning about one revolution per second (without the rest of the robot, I don't know what it was with all of that). The YRG was limited to 80 degrees per second. I wanted to get another gyro, but we never followed through on that.
Get the ADXRS300EB gyro (or the Sparkfun breakout board equivalent, which is easier to wire), and you won't regret it. Last year we made a prototype holonomic drive, and it was way fun to drive, and user-centric coordinates allow you to easily do things like spin while driving.
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
Former FIRST student and mentor dies in a tragic rocket attack in Iraq today. Munkaboo General Forum 48 19-04-2005 12:21
Off-season competetions and former teams Venkatesh Off-Season Events 5 10-12-2004 17:23
Harry Potter and the Chamber of Secrets Ryan Dognaux Chit-Chat 33 01-12-2002 19:57
scouting tips and tricks Rick Scouting 1 08-01-2002 00:52


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

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