basic drive setup problems


My daughter is using graphic RobotC to program her robot for autonamous operation. After a recent rebuilt, she found a problem that she can’t resolve: if she uses the motor setup as shown in the picture, “forward” command would drive the robot backward, and vise versa. she has tried to change the “reversed” checkbox between the two ports for left and right motor, that would fix the forward/backward commands, but then “turnLeft” would turn the robot to the right, and “turnRight” would turn it left. she has also tried to re-initialize all the motors connected to the brain. she didn’t have this problem before the recent rebuild. What else could be done to fix this?




My guess would be that the left motor is actually plugged into port 12 and the right motor to port 6.

if the robot is going north as forward, the west side motor would be “Left” motor, and east side motor would be “Right” motor, correct? or is it the other way around?

Yes, that is correct.

if we switch the cable ports, it would work correctly. then the issue becomes, the motor physically is on the “left” side (according to the previous definition of “left”), but in motor setup, it has to be designated as “right” motor to work. that shouldn’t be the case, right? it seems that the brain is hard coded to think that port has to be “left”, that’s why we re-initialized the brain, but it didn’t make any difference.

Could you post a photo of the build and wiring? That’ll help me wrap my head round it!

here is the robotC code for testing:

#pragma config(Sensor, port1, backBumper, sensorVexIQ_Touch)
#pragma config(Sensor, port7, armBumper, sensorVexIQ_Touch)
#pragma config(Sensor, port11, touchLED, sensorVexIQ_LED)
#pragma config(Motor, motor2, armMotorRight, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor3, hookMotorRight, tmotorVexIQ, PIDControl, reversed, encoder)
#pragma config(Motor, motor6, driveMotorRight, tmotorVexIQ, PIDControl, reversed, driveRight, encoder)
#pragma config(Motor, motor8, armMotorLeft, tmotorVexIQ, PIDControl, reversed, encoder)
#pragma config(Motor, motor9, hookMotorLeft, tmotorVexIQ, PIDControl, encoder)
#pragma config(Motor, motor12, driveMotorLeft, tmotorVexIQ, PIDControl, driveLeft, encoder)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

float touchCount;

task main()
setTouchLEDColor(touchLED, colorRed);
repeat (forever) {
if (getTouchLEDValue(touchLED) == true) {
forward(100, degrees, 50);
wait(.5, seconds);
backward(100, degrees, 75);
wait(1, seconds);
turnLeft(90, degrees, 75);
wait(1, seconds);
turnRight(90, degrees, 75);

here is the current/updated motor/port assigment.motor_port

here are pictures of the robot:

back of the robot:


bottom of the robot:


in telops mode, the drive is fine.

in autonomous mode, forward/backward is normal, turnLeft goes right, turnRight goes left.

if the cables to port 6 and port 12 are switched, everything is reversed (forward goes back, turnleft goes right)

Just start super simple and go from there.

Write a program that is just for one motor:

setMotor(leftMotor, 50);
setMotor(leftMotor, 0);

Then check that the only the left wheels move and that they move forward. If the right move, you need to name the ports and change the drivetrain side. If it goes backwards you need to change the invert tickbox.

Then do the same but just for the right motor. Once you know they are both correct, you should be golden.

thank you very much for your suggestions! after doing a few tests, I think we found the problem - it was a combination of reversed cable ports and motor settings.

1 Like