I’ve put the line tracking code into my robot, but it keeps going backwards whether I invert the motors or not. Could this be because it uses arcadeDrive while the rest of my code uses tankDrive? If so, how can I fix it? If not, what else could it be and how can I fix it?
You should use the drive(speed, curve) function, since a joystick isn’t actually being used in the tracking code.
Do you mean that I should be able to use the arcade drive thing anyway? Or do I need to change that?
Are you sure that removing the code to invert the motors didn’t change the robot direction? You can also change the sign of the computed robot speed in the code and that should also flip the direction.
The use of the arcade vs. tank functions don’t stick, they just set the speeds at that moment based on the parameters passed.
I tried inverting the motors, and I tried changing the sign. Neither one worked.
I didn’t think that the use of arcade vs. tank would matter, but I wanted to make sure.
Do you have any other suggestions?
If you are changing each of these things (only one at a time, I hope, since changing both would double negate and wind back up where you started), then perhaps we need to consider that you are changing the code in the wrong place. Can you post the code you’re using and note where you and making these changes?
-Joe