You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.
My suggestion is that you convert Gamepad into an abstract class that will handle all of the Robocol conversion stuff, but leave the interactions with the physical gamepad up to subclasses.
Assuming that we're using a library that requires us to poll the gamepads (as opposed to the event driven model we have in the Android gamepad API), I think we'll need to have a loop in its own thread that's updating the gamepad continuously. Polling the gamepads every time we want to send data sounds OK if it's fast enough, but probably isn't a good option if we want to set the "User" via the usual button combo.
This is the current code to actually send the joystick data to the RC. It can be tweaked, ofc. It gets called every 40 ms.
// send gamepads if we have the info to do so (which will only be on the DS)
if(parameters.gamepadManager != null) {
long now = MyApp.Companion.getRuntime().msLong();
for (Gamepad gamepad : parameters.gamepadManager.getGamepadsForTransmission()) {
// don't send stale gamepads
if (now - gamepad.timestamp > GAMEPAD_UPDATE_THRESHOLD && gamepad.atRest()) {
continue;
}
gamepad.setSequenceNumber();
RobocolDatagram packetGamepad = new RobocolDatagram(gamepad);
send(packetGamepad);
}
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
You'll need to implement
RobotCoreGamepadManager
.My suggestion is that you convert
Gamepad
into an abstract class that will handle all of the Robocol conversion stuff, but leave the interactions with the physical gamepad up to subclasses.Assuming that we're using a library that requires us to poll the gamepads (as opposed to the event driven model we have in the Android gamepad API), I think we'll need to have a loop in its own thread that's updating the gamepad continuously. Polling the gamepads every time we want to send data sounds OK if it's fast enough, but probably isn't a good option if we want to set the "User" via the usual button combo.
This is the current code to actually send the joystick data to the RC. It can be tweaked, ofc. It gets called every 40 ms.
The text was updated successfully, but these errors were encountered: