Quote:
Originally Posted by techkid86
It depends on what you're trying to keep track of in auto. If you're concerned only with distance, then one would work, but you would have to make sure all motors follow it. If you're using PWM, my team found it easiest to just splice the PWM cable into 2 end points so it can connect 2 Jags to 1 PWM output. This saves from having to set up sync/follower sets in code. ((obviously you would still need at least 2 PWM, one for each side))
if you're concerned about turning, (like when going over rough terrain) you may wish to use a gyro as well, as encoders will only track wheel spin, and not robot distance
|
Driving straight for a desired distance is currently the main objective. However, it would be nice to be able to turn after going a set distance. My mentor did bring up the point about having wheels slip while going over rough terrain and we do have a gyro installed but I wasn't aware that it could be used to drive a distance.
Just starting adding some of the code but I am having difficulty with the leftControl. The error I am getting is: "The field RobotDrive.m_frontLeftMotor is not visible"
Code:
RobotDrive tankDrive = new RobotDrive(0, 1);
Encoder encoder = new Encoder(0 ,1 , true, EncodingType.k4X);
PIDController leftControl = new PIDController(0.1, 0, 0, encoder, tankDrive.m_frontLeftMotor);
I was looking at WPI docs and I realized that I may need to use the second constructor listed opposed to what I am doing now:
RobotDrive(int leftMotorChannel, int rightMotorChannel)
Constructor for RobotDrive with 2 motors specified with channel numbers.
RobotDrive(int frontLeftMotor, int rearLeftMotor, int frontRightMotor, int rearRightMotor)
Constructor for RobotDrive with 4 motors specified with channel numbers.
RobotDrive(SpeedController leftMotor, SpeedController rightMotor)
Constructor for RobotDrive with 2 motors specified as SpeedController objects.
RobotDrive(SpeedController frontLeftMotor, SpeedController rearLeftMotor, SpeedController frontRightMotor, SpeedController rearRightMotor)
http://first.wpi.edu/FRC/roborio/rel...obotDrive.html