Last active
November 25, 2019 17:13
-
-
Save madhephaestus/e26c0d8ef7d5283ef44fb22441a603b8 to your computer and use it in GitHub Desktop.
Adding new file from BowlerStudio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GrabResolver(name='nr', root='https://oss.sonatype.org/content/repositories/staging/') | |
@Grab(group='com.neuronrobotics', module='SimplePacketComsJava', version='0.10.1') | |
import edu.wpi.SimplePacketComs.*; | |
import edu.wpi.SimplePacketComs.phy.*; | |
import com.neuronrobotics.sdk.addons.kinematics.imu.*; | |
import edu.wpi.SimplePacketComs.BytePacketType; | |
import edu.wpi.SimplePacketComs.FloatPacketType; | |
import edu.wpi.SimplePacketComs.*; | |
import edu.wpi.SimplePacketComs.phy.UDPSimplePacketComs; | |
import edu.wpi.SimplePacketComs.device.gameController.*; | |
import edu.wpi.SimplePacketComs.device.* | |
boolean noreturn = false | |
if(args == null){ | |
args = ["Game*"] | |
noreturn=true | |
} | |
String name=args[0] | |
if(name.contains("*")) { | |
name = name.split("\\*")[0]; | |
} | |
def dev= DeviceManager.getSpecificDevice(name,{ | |
try{ | |
def control = GameController.get(args[0]).toArray()[0] | |
if(control==null) | |
return null | |
control.connect() | |
int i=0; | |
while(control.getName().getBytes().size()==0 && i++<10){ | |
println "Waiting for device name..." | |
Thread.sleep(500)// wait for the name packet to be sent | |
//String n = control.getName(); | |
} | |
String n = control.getName(); | |
println "Device named ="+n.getBytes()+" " + n | |
return control; | |
}catch(Throwable t){ | |
return null; | |
} | |
}) | |
return dev |
fixed, thats leftover from when i used to define GameController in line in the script. its in SImplePacketComsJava now
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Re: def control = new GameController(args[0])
There doesn't appear to exist a constructor which takes a string as a parameter.