Skip to content

Instantly share code, notes, and snippets.

@madhephaestus
Last active November 25, 2019 17:13
Show Gist options
  • Save madhephaestus/e26c0d8ef7d5283ef44fb22441a603b8 to your computer and use it in GitHub Desktop.
Save madhephaestus/e26c0d8ef7d5283ef44fb22441a603b8 to your computer and use it in GitHub Desktop.
Adding new file from BowlerStudio
@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
@madhephaestus
Copy link
Author

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