Quote:
Originally Posted by artdutra04
Programming "absolute" mecanum/swerve, as in you push the joystick left and no matter what way the robot is oriented it moves left relative to how the drivers are facing, is more difficult. This latter case involves the use of a gyro to track current robot heading, and a lot of trig functions for each of the wheel outputs.
|
More difficult, but not all that much so for a mecanum/holonomic. 2077's field-relative stick code looks like:
Code:
double x = stick3.getX();
double y = stick3.getY();
double angle = (gyro_.getAngle()+180)/180.*Math.PI;
stick3.setX(x * Math.cos(angle) - y * Math.sin(angle));
stick3.setY(x * Math.sin(angle) + y * Math.cos(angle));
driveTrain_.drive(stick3, stick2.getX());
It's interesting to listen to the emerging consensus (with which I don't disagree) that a swerve drive wins virtually all the pure physics comparisons, but comes off worst or near-worst in:
- Hardware Complexity
- Weight
- Cost
- Reliability
- Development Time
- Software Complexity
In other words, practically every engineering factor other than pure physics. Don't forget making a robot is engineering, of which theoretical physics is a part, but only a part.