View Single Post
  #2   Spotlight this post!  
Unread 01-04-2009, 11:13
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Programming Crab Drive

This is a problem that will take some time and patience to think through. I don't want to deprive you of that learning experience, but I'll give you some insight as to how we do crab.

Our left stick is our crab stick and the right stick is the drive stick. Up until last year, we mainly only looked at the X-axis of the crab stick to determine the desired crab angle. Centered meant an angle of 0 (straight ahead) and full left/right represented +- 90 degrees. Last year and this year, we took the approach of treating the crab stick as a polar coordinate system. We look at the angle component and map that directly to a crab angle (i.e. point the stick 45 forward right and the crab angle becomes +45). The trick here is to also look at the magnitude component and treat the angle as 0 unless it's outside of some deadband.

It gets slightly more complicated with the drive stick. We will behave differently depending on where the crab stick is. If the desired angle is between +- 30 degrees we treat the drive stick as a standard arcade stick. Once we get beyond the 30 degree mark, we only look at the Y component of the drive stick to get a desired speed for all wheels. This is because if you were to allow a tank turn while crabbed, the wheels will oppose each other. Once we get to +-30 degrees around +-90, we allow tank turn again, however we have to do some logic to make sure the wheels are driving in the right direction instead of opposing each other. We usually don't allow tank turn when crabbing, but this year had some benefits (we also had something similar in 2003).

Beyond that, you can do some cool things based on what buttons are pressed on the controller. For example, last year, we had buttons to do car steering (front wheels crab, back wheels fixed at 0) and monster steering (front and back crab opposite each other to get a tighter turn radius).

The biggest thing that you need to do is think through exactly what you want the behavior to be. Once you know that, it's just a matter of piecing the program logic together.

You guys are close enough where if you have problems along the way, have Herb get a hold of us and we can try to walk you through your issues.
Reply With Quote