Open dvpatel opened 4 years ago
I have never observed this to be the case. Both gamepads have always reacted with the same response time for me.
Are you sure that your code is not blocking (looping or delaying) for short periods when one control is being activated? eg: if you call sleep() when you see a button press, this will cause you program to stop responding to other inputs for the duration.
If you have several actions happening at the same time, you need to orgainze your code to ensure that they do not interfere with each other.
This does not require creating different threads, but can be done with starting and stopping actions based on watching a timer, or by creating a simple state machine.
Both of these solution are much safer and simpler than multi-threading.
Perhaps you could include some of your button code.
Folks,
I'm trying to understand how gamepad control buttons are handled when 2 controls are used. We have a scenario where we use 3 joysticks between 2 gamepad controllers to control the various aspects of the robot. What we've noticed is when one joystick is engaged (ie. to drive robot), the joystick on the 2nd gamepad controller becomes slow to respond.
Could this be a threading issue where a single thread is used to handle the various gamepad actions in sequence. In our code, within the runOpMode, it's just a bunch of if and then statements to check for gamepad 1/2 buttons and take appropriate actions. Very sequential. So if joystick1 is "hogging" up, the remaining controls become slow to respond.
Within runOpMode, would it make sense to use 2 threads to monitor and control the gamepad actions? I'm open to other options as well to make the controls much more responsive.
Thanks for your time. -Dipesh