View Single Post
  #2   Spotlight this post!  
Unread 24-04-2010, 16:24
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,086
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Programming a Crab Drive System

Quote:
Originally Posted by Tom Line View Post
If I put the speed to 1 (full) and the rotation to 1 (full) I get a wheel speed of 2+. I was assuming the full-scale wheel speed was from -1 to 1. Is that not the case?
Yes, the wheel speed is -1 to 1. However, the spreadsheet/equations do not account for this at all in that implementation. Our code had a thing like this in it:

Code:
	// only need to scale if speed > 1
	if (highest_speed > 1.0 )
	{
		// scale each speed by the highest speed
		for (int i = 0; i < 4; i++)
			speeds[i] /= highest_speed;
	}
It would just have made the spreadsheet more complicated to implement it that way, so I left it out.

Quote:
Originally Posted by Tom Line View Post
In addition, when I put in Speed 1, Angle 0, Rotation 1, I get a picture where the two left wheels are 90 degrees from the supposed angle of travel shown in the overall motion. That would seem to me to be physically impossible, as it appears you are trying to literally drag those two wheels sideways.
Yes, I think that is how it ends up working, and it is a bit counterintuitive. Generally speaking, I don't think we used high values of rotation and high values of speed particularly often.

Keep in mind that you *cannot* travel in a straight line AND rotate at the same time without some external thing helping you compensate (for instance, a gyro), because you will always be having to adjust things relative to the robot. This is probably where part of the confusion comes from. However, with a gyro and a PID controller, you can make it go in a straight line and rotate at the same time without too much effort.

On the same website, we have our 2009 code posted which has a SwerveDrive.cpp with an implementation of this stuff there. We ended up finding an annoying bug in our implementation though (it had to do with the way that we calculated the shortest path for our servos).. but, I never updated the site with the code. Or maybe I did, I don't recall. But its a useful starting point in any case.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff