Hello! I’m not sure whether I should post this here or in the RobotC section, but here I go
We have a robot that utilizes 5 motors on our lift and 4 for our base. The four base motors are 393 motors. These base motors are not configured for speed and are in high torque and have mecanum wheels on them . The motors are programmed for Tank controls (left and right joysticks individually moving each side) and pressing 7U and 7D allows the wheels to strafe right and left.
Our problems
-When we only include code for base controls (excluding the lift), the base moves forwards and backwards perfectly fine, but shows irregular movement when we press 7U and 7D (Strafing).
-When we include code for both base AND lift controls, the base motors don’t go smoothly forward/backward (with the joysticks) and they stutter a bit (the motor isn’t shaking but stuttering as in the movement of the wheel chokes up often) but they move perfectly when we strafe (with the buttons 7U and 7D)
It sounds as if you are setting some motors to multiple values in a single loop cycle (perhaps one of those values being 0). Could you post this entire portion of your code so that we can see exactly what you have, and hopefully find where exactly the problem lies?
Going along with what Jordan said try to ensure that the motors don’t receive more than one command per loop cycle. Like this pseudocode
{If(button7u or button7d)
Your strafing code
}else{
Your tank code}
That means. While strafing don’t accept tank commands. In particular this would interrupt you driving normally to strafe if both are being used at once.
When we were using tank control, the buttons would be 0; the motor was told to be 127 and 0 at the same time, you guys were both exactly correct. Again, thank you guys alot!
The way I see Jpearman usually code to avoid this issue is rather then setting the motors in your code set a place holder variable.
something like left_chassis or right_chassis
and then at the end of the loop update the motors to equal these variables. This way your robot will work its way through the entire loop before setting the motor power.
I either do it ^that way or code the logic in a way such that motors either are set by 1 bit of code OR another.