View Single Post
  #4   Spotlight this post!  
Unread 08-02-2015, 22:42
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,609
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: How to Code Gyro to Help with Straight Strafing?

The gyroscope does not have to be at the COG of the robot, but it is helpful if it is somewhere near the COG.

How you do this depends greatly on your drive system. The two most likely drive chassis to use "strafing" are mecanum and h-drive. I do not have any experience with lobster, crab, or swerve.

Mecanum: The easiest way to do this is to use the Holonomic Drive class, in "field coordinates". We got one of these working in December using the cRIO, and the code is posted at https://github.com/frc3946/MecanumDrivetrain.

H-drive: While strafing, use the "tank drive" wheels to maintain your bearing (that is, azimuth) while you strafe. This can be done using a PID, or probably just with a very simple "P" loop - if you're too far left, rotate a bit to the right, if you're too far left rotate a bit to the left. The amount of rotation would be proportional (that's the P) to the error in your current bearing. If the proportionality constant is too large, you'll oscillate around the correct angle; if too low, you'll keep drifting away. We're using H-drive this year, but haven't written this yet - we have an adjustable strafe wheel mount, so we are hoping that we don't rotate very much. In any case, our rotation will be controlled primarily by a pair of range finders rather than the gyro.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote