We are using RobotC graphical and are trying to figure out code to add a 3rd motor to the drivetrain that operates only when both joysticks are pushed forward or both are pushed back. The motor needs to NOT be on when only 1 joystick is being used or when 1 is forward and 1 is back, so we can’t just add it to one side of the drivetrain. Motor2 operates a motor attached to a differential gear attached to both front sprockets, and if it is running while turning it jams things up. If it isn’t running (stop motor?) then it turns fine (so if using only tank control with no reference to motor2 all actions work - but we lose the benfit of an extra motor in fwd/rev!). Motor1 and motor6 are attached to back sprockets on a tank tread drivetrain.
We’ve tried lots of variations at this point but we keep having the same problem. Forward and reverse work well with the added motor, 1 joystick forward and 1 joystick backward turns decently (with motor2 not running), BUT if 1 joystick is forward (or backward) and the other untouched it jams. I assume that for some reason motor2 is remaining on and that’s what we’ve been trying to fix. It has similar symptoms to how it originally jammed during 2 joystick turns, which we were eventually able to get fixed by using the attached code (which is supposed to stop motor2 for all turns).
I’m attaching code in graphical and regular, but we don’t have a lot of experience writing in regular and no real access to someone who does coding for robots with it. Is it possible to fix in graphical? I know the other is more advanced, but I don’t have a lot of time for us all to learn it before Regionals next weekend!
For extra credit - is there any way to get a differential gear on the drivetrain to be running while doing turns (adding power to the side going forward in the turn without jamming the side going backwards)? We did lots of research and various experiments leading up to that change and really thought it could, so we were disappointed to determine in actual practice that we couldn’t get it to work as expected. It still helps with power on fwd/rev, but without turning power we can’t up our gear ratio for adding speed.
difftestc.pdf (199 KB)