Hello everyone - I’m trying to get my robot to call the distance it has traveled, and I’ve tried to do this through calling the rotation of the drivetrain motors in the above code, but I’m thinking about calling the rotation of the individual motors. Is there another way to call the rotation of the motors or the distance the robot has traveled? I also tried defining a double variable with motor encoder degrees.
In the above code
On a more serious note this is definitely possible with the Motor.position(degrees)
(in C++) multiplied by the circumference of the wheel divided by 360 to find how many inches forward the robot has moved.
If the motors are geared together it won’t matter that much to call all of the left motors and all of the right motors individually, but it is still good practice for redundancy if one motor fails.
If you have all of the motors included as part of the pre-made drivetrain from vexcode then it is still possible to manually call out individual motors with
motor leftMotorA = motor(PORT2, ratio18_1, false)
and other calls for different ports and different motors.
1 Like