
Bluetooth Stalling Motors.
Hey everyone!
I'm currently working on a robot with Omni-directional wheels, and I've had it working fine by just writing in the program to go at a certain power in a certain direction, and it will do that with no problems.
Just recently, I made a Philo-style joystick that calculates the direction to travel and speed depending on the angle and amount I move the joystick. I figured out how to send this via bluetooth. (The bluetooth is a 2nd task on each NXT brick, continuously sending over the data to global variables.)
When I first tilt the joystick, it works very nicely and moves in the desired direction, etc. But then if I move it back into a different direction, it will sort of stall. It jerks in the direction for a moment and then the motors stop, then jerks again, then stops; repeating. The weird thing is, is that the motors go perfectly if I lift it off the ground, then as soon as I add pressure to the wheels by replacing it on the ground, or holding the wheels with my hand, all power from them disappears, then returns about a second later.
I did some further testing, to try and target the source of the problem. First, I replaced the actual bluetooth coding in the bluetooth task with a simple while loop that changed the direction from Forwards to Backwards every 3 seconds; to see if it was an issue with double tasks. No problem there, it moved forward 3 seconds, then back 3 seconds. No stalling.
I then set up the bluetooth tasks again, and put the same while loop into the joystick NXT. So that it simply changed the direction forwards and back each 3 seconds as before. The robot starts off fine, but then continues to stall as soon as it first changes direction.
So, the last test I've done, is to put that looping program BACK into the bluetooth-read task on the main robot, but I kept the bluetooth code, so that the bluetooth functions were still running, but were not updating any of the important values. It stalled.
So all I conclude from this is that the act of send-receiving bluetooth messages is somehow causing the motors to stall if they are under enough resistance... It's also worth noting that when it's stalling, and push in the right direction will keep it going okay until it changes its direction again.
I know it's an awkward problem, but I hope someone might know the cause behind this.
Cheers!
-Kit
Bluetooth send-receive tasks:
The joyDirectionBT and joyPowerBT are variables I've just set up to store the receive values. The joyDirection and joyPower are the ones that affect the motors.