Autonomous

Your question is a bit confusing. Are you trying to get code that will make the drive turn x degrees when called? Like


turnDegrees(45); // turns 45 degrees clockwise

Also, if you’re looking for help on rotations, you’re going to need a gyroscope (https://www.vexrobotics.com/276-2333.html)
This should still be compatible with v5 come August.

Your question is a bit confusing. Are you trying to get code that will make the drive turn x degrees when called? Like


turnDegrees(45); // turns 45 degrees clockwise

Also, if you’re looking for help on rotations, you’re going to need a gyroscope (https://www.vexrobotics.com/276-2333.html)
This should still be compatible with v5 come August.

You don’t need potentiometers on your drivetrain, those have a rotation limit of 270 degrees. However, if you mean shaft encoders, then yes you would need those for that command to work. You don’t need a gyroscope unless you are trying to measure the robot’s rotation, that is, in degrees. This is really only useful for turning accurately.

I think he was looking into wheel rotations, not robot rotation. For wheel rotation you would need quadratic encoders or integrated motor encoders, though with v4 the quads are more accurate.

It isn’t confusing at all, he is calling a built ROBOTC function. The correct answer is

The encoders are built into the new v5 motors.

You only need one encoder for it to work, I recommend you use two on each side or one on a free spinning wheel.

However, if you are using a holonomic drive, then you would need on on each motor.

Your second question was not very specific, so I’m going to give it my best shot:

To apply this to your code, first plug both wires into digital ports. Then set up the sensor by selection the two ports that you want to use. To call this value in your code, simply use SensorValue(encodername).

V5 doesn’t ship till August. As last year was his first year, he may not be using V5 next season. I know my program isn’t going to be able to afford all of it immediately.

If you’re using quadrature (not quadratic; no such thing) encoders and tank configuration, it’s good to have two. (But you can get by with one.)

Here’s how the motors and sensor setup screens look for a typical 4 motor, 2 quad sensor setup:

First, the motors:

Screen Shot 2018-05-03 at 10.28.44 PM.png

And here’s how the pragmas look for that setup:


#pragma config(Sensor, dgtl1,  rightEncoder,   sensorQuadEncoder)
#pragma config(Sensor, dgtl5,  leftEncoder,    sensorQuadEncoder)
#pragma config(Motor,  port2,           rightfront,    tmotorVex393_MC29, openLoop, driveRight)
#pragma config(Motor,  port3,           rightrear,     tmotorVex393_MC29, openLoop, driveRight, encoderPort, dgtl1)
#pragma config(Motor,  port4,           leftfront,     tmotorVex393_MC29, openLoop, reversed, driveLeft)
#pragma config(Motor,  port5,           leftrear,      tmotorVex393_MC29, openLoop, reversed, driveLeft, encoderPort, dgtl5)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//