diff --git a/build.gradle b/build.gradle index 0825cbf0..a49e271e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,9 @@ apply plugin: 'java' apply plugin: 'eclipse' -apply plugin: 'maven' +if (project == rootProject) { + apply plugin: 'maven' +} +apply plugin: 'java-library' apply plugin: 'signing' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' @@ -9,14 +12,14 @@ File buildDir = file("."); Properties props = new Properties() props.load(new FileInputStream(buildDir.getAbsolutePath()+"/src/main/resources/com/neuronrobotics/sdk/config/build.properties")) -//sourceSets { -// -// test { -// java { -// srcDirs = ["test/java/src" ] // Note @Peter's comment below -// } -// } -//} +sourceSets { + + test { + java { + srcDirs = ["test/java/src" ] + } + } +} manifest { attributes( @@ -31,7 +34,7 @@ manifest { ) } - +if (project == rootProject) jar.archiveName = "nrsdk-"+props."app.version"+"-jar-with-dependencies.jar" //apply from: 'http://gradle-plugins.mihosoft.eu/latest/vlicenseheader.gradle' @@ -40,27 +43,36 @@ jar.archiveName = "nrsdk-"+props."app.version"+"-jar-with-dependencies.jar" repositories { mavenCentral() +// maven { +// url "https://repository.ow2.org/nexus/content/repositories/public/" +// } } dependencies { //TODO change as many of these as possible to Maven repositories - compile fileTree (dir: 'libs', includes: ['*.jar']) - testCompile 'junit:junit:4.12' - compile 'gov.nist.math:jama:1.0.2' - compile 'com.miglayout:miglayout-swing:4.1' - compile 'org.igniterealtime.smack:smack:3.2.1' + api fileTree (dir: 'libs', includes: ['*.jar']) + testImplementation 'junit:junit:4.12' + implementation 'com.google.code.gson:gson:2.5' + + api 'gov.nist.math:jama:1.0.2' + implementation 'com.miglayout:miglayout-swing:4.1' + implementation 'org.igniterealtime.smack:smack:3.2.1' - compile 'org.igniterealtime.smack:smackx:3.2.1' - compile 'org.apache.commons:commons-lang3:3.2.1' - compile 'org.usb4java:usb4java:1.2.0' - compile 'org.usb4java:usb4java-javax:1.2.0' + implementation 'org.igniterealtime.smack:smackx:3.2.1' + implementation 'org.apache.commons:commons-lang3:3.2.1' + api 'org.usb4java:usb4java:1.2.0' + api 'org.usb4java:usb4java-javax:1.2.0' //compile fileTree (dir: '../doychinNRJAVASERISL/nrjavaserial/build/libs', includes: ['*.jar']) - compile "com.neuronrobotics:nrjavaserial:5.1.1" + api "com.neuronrobotics:nrjavaserial:5.1.1" // https://mvnrepository.com/artifact/org.apache.commons/commons-math3 - compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' - - + api group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' + // https://mvnrepository.com/artifact/net.sf.bluecove/bluecove-gpl + api group: 'net.sf.bluecove', name: 'bluecove-gpl', version: '2.1.0' + api group: 'io.ultreia', name: 'bluecove', version: '2.1.1' + // https://mvnrepository.com/artifact/motej/motej + //api group: 'motej', name: 'motej', version: '0.9-2008.02.05-patched', ext: 'pom' + } @@ -73,11 +85,13 @@ archivesBaseName = "java-bowler" version = props."app.version" task javadocJar(type: Jar) { + if (project == rootProject) classifier = 'javadoc' from javadoc } task sourcesJar(type: Jar) { + if (project == rootProject) classifier = 'sources' from sourceSets.main.allSource } diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/BluetoothConector.java b/examples/java/src/com/neuronrobotics/test/nrdk/BluetoothConector.java index f56e5479..d635c40b 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/BluetoothConector.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/BluetoothConector.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.wireless.bluetooth.BlueCoveManager; import com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BluetoothConector. */ @@ -19,16 +19,16 @@ public static void main(String[] args) { DyIO dyio; BlueCoveManager manager = new BlueCoveManager(); String devices[] = manager.getAvailableSerialDevices(true); - System.out.println("Devices: "); + com.neuronrobotics.sdk.common.Log.error("Devices: "); for (String d: devices) { - System.out.println(d); + com.neuronrobotics.sdk.common.Log.error(d); } if (devices.length > 0) { - System.out.println("Connecting to : "+devices[0]); + com.neuronrobotics.sdk.common.Log.error("Connecting to : "+devices[0]); dyio = new DyIO(new BluetoothSerialConnection(manager, devices[0])); dyio.connect(); if(dyio.ping() ) - System.out.println("All OK!"); + com.neuronrobotics.sdk.common.Log.error("All OK!"); } System.exit(0); diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/ByteListTest.java b/examples/java/src/com/neuronrobotics/test/nrdk/ByteListTest.java index 962aff83..3b6d9775 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/ByteListTest.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/ByteListTest.java @@ -2,7 +2,7 @@ import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ByteListTest. */ @@ -15,9 +15,9 @@ public class ByteListTest { */ public static void main(String [] args) { byte [] b = ByteList.convertTo16(526); - System.out.println(b[0] + " - " + b[1]); + com.neuronrobotics.sdk.common.Log.error(b[0] + " - " + b[1]); int i = ByteList.convertToInt(b); - System.out.println(i); + com.neuronrobotics.sdk.common.Log.error(i); } } diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/ConnectionDialogTest.java b/examples/java/src/com/neuronrobotics/test/nrdk/ConnectionDialogTest.java index 967fb8dd..d49ac8ad 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/ConnectionDialogTest.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/ConnectionDialogTest.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.dyio.DyIO; import com.neuronrobotics.sdk.ui.ConnectionDialog; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ConnectionDialogTest. */ @@ -16,16 +16,16 @@ public class ConnectionDialogTest { * @param args the arguments */ public static void main(String[] args) { - System.out.println("Starting"); + com.neuronrobotics.sdk.common.Log.error("Starting"); DyIO dyio=new DyIO(); if (!ConnectionDialog.getBowlerDevice(dyio)){ - System.err.println("Dialog failed"); + com.neuronrobotics.sdk.common.Log.error("Dialog failed"); System.exit(1); } Log.enableDebugPrint(); dyio.ping(); dyio.disconnect(); - System.out.println("Connection OK!"); + com.neuronrobotics.sdk.common.Log.error("Connection OK!"); System.exit(0); //while(true); } diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/ExtendGenericPID.java b/examples/java/src/com/neuronrobotics/test/nrdk/ExtendGenericPID.java index db874d73..0656b5bc 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/ExtendGenericPID.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/ExtendGenericPID.java @@ -8,7 +8,7 @@ import com.neuronrobotics.sdk.pid.GenericPIDDevice; import com.neuronrobotics.sdk.ui.ConnectionDialog; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ExtendGenericPID. */ @@ -24,14 +24,14 @@ private ExtendGenericPID(){ System.exit(1); } try { - System.out.println("Extended get position: "+pid.getExtendedValue(0)); + com.neuronrobotics.sdk.common.Log.error("Extended get position: "+pid.getExtendedValue(0)); pid.GetAllPIDPosition(); pid.GetPIDPosition(2); pid.disconnect(); - System.out.println("All OK!"); + com.neuronrobotics.sdk.common.Log.error("All OK!"); System.exit(0); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); pid.disconnect(); System.exit(1); diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/GenericPIDTest.java b/examples/java/src/com/neuronrobotics/test/nrdk/GenericPIDTest.java index b1c169e8..0c1edef5 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/GenericPIDTest.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/GenericPIDTest.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.network.BowlerTCPClient; import com.neuronrobotics.sdk.pid.GenericPIDDevice; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class GenericPIDTest. */ @@ -25,17 +25,17 @@ public static void main(String[] args) { try { pid.setConnection(new BowlerTCPClient("cortex.wpi.edu", 1965)); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } //pid.setConnection(new BowlerTCPClient("192.168.0.134", 1965)); pid.GetAllPIDPosition(); pid.GetPIDPosition(2); pid.disconnect(); - System.out.println("All OK!"); + com.neuronrobotics.sdk.common.Log.error("All OK!"); System.exit(0); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); pid.disconnect(); System.exit(1); diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/PingSpeedTest.java b/examples/java/src/com/neuronrobotics/test/nrdk/PingSpeedTest.java index 8f2a076d..d71d4837 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/PingSpeedTest.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/PingSpeedTest.java @@ -9,7 +9,7 @@ import com.neuronrobotics.sdk.serial.SerialConnection; import com.neuronrobotics.sdk.ui.ConnectionDialog; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PingSpeedTest. */ @@ -30,13 +30,13 @@ public static void main(String[] args) { // //c = new BowlerTCPClient("192.168.1.10", 1866); // c = new UDPBowlerConnection(InetAddress.getByName("130.215.49.37"), 1865); // } catch (Exception e) { -// // TODO Auto-generated catch block +// // Auto-generated catch block // e.printStackTrace(); // System.exit(1); // } if(c==null) System.exit(1); - System.out.println("Starting test"); + com.neuronrobotics.sdk.common.Log.error("Starting test"); Log.enableInfoPrint(); GenericDevice dev = new GenericDevice(c); dev.connect(); @@ -51,10 +51,10 @@ public static void main(String[] args) { double ms=System.currentTimeMillis()-start; avg +=ms; - System.out.println("Average cycle time: "+(int)(avg/i)+"ms\t\t\t this loop was: "+ms); + com.neuronrobotics.sdk.common.Log.error("Average cycle time: "+(int)(avg/i)+"ms\t\t\t this loop was: "+ms); dev.getNamespaces(); } - System.out.println("Average cycle time for ping: "+(avg/i)+" ms"); + com.neuronrobotics.sdk.common.Log.error("Average cycle time for ping: "+(avg/i)+" ms"); dev.disconnect(); System.exit(0); } diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/SimpleConnection.java b/examples/java/src/com/neuronrobotics/test/nrdk/SimpleConnection.java index 393d8c80..f73714ea 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/SimpleConnection.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/SimpleConnection.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.genericdevice.GenericDevice; import com.neuronrobotics.sdk.serial.SerialConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class SimpleConnection. */ @@ -16,7 +16,7 @@ public class SimpleConnection { */ public static void main(String[] args) { SerialConnection s = null; - System.out.println("Connecting and disconnecting"); + com.neuronrobotics.sdk.common.Log.error("Connecting and disconnecting"); //Windows //s=new SerialConnection("COM5"); @@ -41,7 +41,7 @@ public static void main(String[] args) { avg +=ms; start = System.currentTimeMillis(); } - System.out.println("Average cycle time for ping: "+(avg/i)+" ms"); + com.neuronrobotics.sdk.common.Log.error("Average cycle time for ping: "+(avg/i)+" ms"); dyio.disconnect(); System.exit(0); //while(true); diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/network/NetworkServerTest.java b/examples/java/src/com/neuronrobotics/test/nrdk/network/NetworkServerTest.java index b8251eda..e232b997 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/network/NetworkServerTest.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/network/NetworkServerTest.java @@ -8,7 +8,7 @@ import com.neuronrobotics.sdk.network.BowlerUDPServer; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class NetworkServerTest. */ @@ -43,7 +43,7 @@ public static void main(String [] args){ new NetworkServerTest(); }catch (Exception e){ e.printStackTrace(); - System.err.println("###SERVER Failed out!"); + com.neuronrobotics.sdk.common.Log.error("###SERVER Failed out!"); System.exit(1); } } diff --git a/examples/java/src/com/neuronrobotics/test/nrdk/network/UDPClientTest.java b/examples/java/src/com/neuronrobotics/test/nrdk/network/UDPClientTest.java index 0a215ba4..9a51b67a 100644 --- a/examples/java/src/com/neuronrobotics/test/nrdk/network/UDPClientTest.java +++ b/examples/java/src/com/neuronrobotics/test/nrdk/network/UDPClientTest.java @@ -11,7 +11,7 @@ //import com.neuronrobotics.sdk.network.BowlerTCPServer; import com.neuronrobotics.sdk.network.UDPBowlerConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class UDPClientTest. */ @@ -28,29 +28,29 @@ public UDPClientTest(){ clnt=new UDPBowlerConnection(); // ArrayList addrs = clnt.getAllAddresses(); -// System.out.println("Availiable servers: "+addrs); +// com.neuronrobotics.sdk.common.Log.error("Availiable servers: "+addrs); // if (addrs.size()==0) // throw new RuntimeException(); // clnt.setAddress(addrs.get(0)); try { clnt.setAddress(InetAddress.getByName("192.168.1.10")); } catch (UnknownHostException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); System.exit(0); } setConnection(clnt); connect(); - System.out.println("Pinging"); + com.neuronrobotics.sdk.common.Log.error("Pinging"); long start = System.currentTimeMillis(); int numPings=10; for(int i=0;i> "+ message.getBody()); } try { String ret =onMessage(message.getBody(),chat, message.getFrom()); msg.setBody(ret); - System.out.println("Sending: "+msg.getBody()); + com.neuronrobotics.sdk.common.Log.error("Sending: "+msg.getBody()); if(log!=null){ log.onLogEvent(""+message.getFrom()+"<< "+ ret); } chat.sendMessage(msg); } catch (XMPPException ex) { ex.printStackTrace(); - System.out.println("Failed to send message"); + com.neuronrobotics.sdk.common.Log.error("Failed to send message"); } } else { - System.out.println("I got a message I didn't understand\n\n"+message.getType()); + com.neuronrobotics.sdk.common.Log.error("I got a message I didn't understand\n\n"+message.getType()); } } @@ -146,11 +146,11 @@ private ChatAsyncListener getListener(Chat c,String from){ for(ChatAsyncListener l:listeners ){ if(l.getFrom().equals(from) && l.getChat()==c){ back = l; - System.out.println("Found old listener"); + com.neuronrobotics.sdk.common.Log.error("Found old listener"); } } if(back == null){ - System.out.println("Adding new listener"); + com.neuronrobotics.sdk.common.Log.error("Adding new listener"); back = new ChatAsyncListener(c, from); listeners.add(back); } @@ -203,11 +203,11 @@ public void onChannelEvent(DyIOChannelEvent e) { Message msg = new Message(getFrom(), Message.Type.chat); String body = "asyncData "+e.getChannel().getChannelNumber()+" "+e.getValue(); msg.setBody(body); - System.err.println("async: "+msg.getBody()); + com.neuronrobotics.sdk.common.Log.error("async: "+msg.getBody()); try { chat.sendMessage(msg); } catch (XMPPException e1) { - // TODO Auto-generated catch block + // Auto-generated catch block e1.printStackTrace(); } } @@ -268,7 +268,7 @@ private String help(){ */ @Override public void onChannelEvent(DyIOChannelEvent e) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/application/xmpp/DyIOConversationFactory.java b/src/main/java/com/neuronrobotics/application/xmpp/DyIOConversationFactory.java index 5bea6a76..07cafb79 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/DyIOConversationFactory.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/DyIOConversationFactory.java @@ -3,7 +3,7 @@ import com.neuronrobotics.application.xmpp.GoogleChat.IChatLog; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A factory for creating DyIOConversation objects. */ @@ -26,7 +26,7 @@ public DyIOConversationFactory(IChatLog mine) { */ @Override public IConversation getConversation() { - System.out.println("Getting DyIO conversation"); + com.neuronrobotics.sdk.common.Log.error("Getting DyIO conversation"); return new DyIOConversation(log); } } diff --git a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChat.java b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChat.java index 7e163f07..f78504cc 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChat.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChat.java @@ -5,7 +5,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.packet.Message; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class GoogleChat. */ diff --git a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversation.java b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversation.java index fcb3efd0..55e6f515 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversation.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversation.java @@ -8,7 +8,7 @@ import com.neuronrobotics.application.xmpp.IConversation; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class GoogleChatConversation. */ @@ -42,17 +42,17 @@ public String onMessage(String input,Chat chat, String from) { public void processMessage(Chat chat, Message message) { Message msg = new Message(message.getFrom(), Message.Type.chat); if(message.getType().equals(Message.Type.chat) && message.getBody() != null) { - System.out.println("Received: " + message.getBody()); + com.neuronrobotics.sdk.common.Log.error("Received: " + message.getBody()); try { msg.setBody(onMessage(message.getBody(),chat, message.getFrom())); - System.out.println("Sending: "+msg.getBody()); + com.neuronrobotics.sdk.common.Log.error("Sending: "+msg.getBody()); chat.sendMessage(msg); } catch (XMPPException ex) { ex.printStackTrace(); - System.out.println("Failed to send message"); + com.neuronrobotics.sdk.common.Log.error("Failed to send message"); } } else { - System.out.println("I got a message I didn't understand\n\n"+message.getType()); + com.neuronrobotics.sdk.common.Log.error("I got a message I didn't understand\n\n"+message.getType()); } } diff --git a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversationFactory.java b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversationFactory.java index 3002553f..3e6dd13b 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversationFactory.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatConversationFactory.java @@ -4,7 +4,7 @@ import com.neuronrobotics.application.xmpp.IConversationFactory; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A factory for creating GoogleChatConversation objects. */ diff --git a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatEngine.java b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatEngine.java index a3df5e94..0b8965fc 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatEngine.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/GoogleChatEngine.java @@ -29,7 +29,7 @@ -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class GoogleChatEngine. */ @@ -136,10 +136,10 @@ private void setLoginInfo(InputStream config) { } catch (IOException e) { throw new RuntimeException(e); } - //System.out.println("Parsing File..."); + //com.neuronrobotics.sdk.common.Log.error("Parsing File..."); NodeList nList = doc.getElementsByTagName("login"); for (int temp = 0; temp < nList.getLength(); temp++) { - //System.out.println("Leg # "+temp); + //com.neuronrobotics.sdk.common.Log.error("Leg # "+temp); Element eElement = (Element)nList.item(temp); username = getTagValue("username",eElement); password = getTagValue("password",eElement); @@ -157,7 +157,7 @@ private void setLoginInfo(InputStream config) { public static String getTagValue(String sTag, Element eElement){ NodeList nlList= eElement.getElementsByTagName(sTag).item(0).getChildNodes(); Node nValue = (Node) nlList.item(0); - //System.out.println("\t\t"+sTag+" = "+nValue.getNodeValue()); + //com.neuronrobotics.sdk.common.Log.error("\t\t"+sTag+" = "+nValue.getNodeValue()); return nValue.getNodeValue(); } @@ -175,7 +175,7 @@ private MessageListener getNewMessageListener(){ */ @Override public void chatCreated(Chat arg0, boolean arg1) { - // TODO Auto-generated method stub + // Auto-generated method stub arg0.addMessageListener( getNewMessageListener()); googleChats.add(new GoogleChat(arg0)); } diff --git a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/IChatLog.java b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/IChatLog.java index e9899739..e1cb2cce 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/IChatLog.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/GoogleChat/IChatLog.java @@ -1,6 +1,6 @@ package com.neuronrobotics.application.xmpp.GoogleChat; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IChatLog. */ diff --git a/src/main/java/com/neuronrobotics/application/xmpp/IConversation.java b/src/main/java/com/neuronrobotics/application/xmpp/IConversation.java index 99deddf0..a71c210a 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/IConversation.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/IConversation.java @@ -2,7 +2,7 @@ import org.jivesoftware.smack.Chat; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IConversation. */ diff --git a/src/main/java/com/neuronrobotics/application/xmpp/IConversationFactory.java b/src/main/java/com/neuronrobotics/application/xmpp/IConversationFactory.java index 6d3502be..3397ef47 100644 --- a/src/main/java/com/neuronrobotics/application/xmpp/IConversationFactory.java +++ b/src/main/java/com/neuronrobotics/application/xmpp/IConversationFactory.java @@ -1,6 +1,6 @@ package com.neuronrobotics.application.xmpp; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A factory for creating IConversation objects. */ diff --git a/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaJointAngles.java b/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaJointAngles.java index 35704e7d..29788b18 100644 --- a/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaJointAngles.java +++ b/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaJointAngles.java @@ -1,6 +1,6 @@ package com.neuronrobotics.replicator.driver.delta; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DeltaJointAngles. */ diff --git a/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotConfig.java b/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotConfig.java index 2ad6f73f..6276a8fe 100644 --- a/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotConfig.java +++ b/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotConfig.java @@ -1,6 +1,6 @@ package com.neuronrobotics.replicator.driver.delta; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DeltaRobotConfig. */ diff --git a/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotKinematics.java b/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotKinematics.java index f9574549..b3e3cdca 100644 --- a/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotKinematics.java +++ b/src/main/java/com/neuronrobotics/replicator/driver/delta/DeltaRobotKinematics.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR; import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DeltaRobotKinematics. */ diff --git a/src/main/java/com/neuronrobotics/replicator/driver/interpreter/CodeHandler.java b/src/main/java/com/neuronrobotics/replicator/driver/interpreter/CodeHandler.java index 8426c290..74a5acce 100644 --- a/src/main/java/com/neuronrobotics/replicator/driver/interpreter/CodeHandler.java +++ b/src/main/java/com/neuronrobotics/replicator/driver/interpreter/CodeHandler.java @@ -2,7 +2,7 @@ import java.util.List; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * Encapsulates a handler for a particular G or M code. * diff --git a/src/main/java/com/neuronrobotics/replicator/driver/interpreter/EmptyCodeHandler.java b/src/main/java/com/neuronrobotics/replicator/driver/interpreter/EmptyCodeHandler.java index 4801f723..30ee42bb 100644 --- a/src/main/java/com/neuronrobotics/replicator/driver/interpreter/EmptyCodeHandler.java +++ b/src/main/java/com/neuronrobotics/replicator/driver/interpreter/EmptyCodeHandler.java @@ -1,6 +1,6 @@ package com.neuronrobotics.replicator.driver.interpreter; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * An empty code handler, for noting that "do nothing" is the correct action. * Presently used for absolute positioning and programming in mm, because those are the internal representations. diff --git a/src/main/java/com/neuronrobotics/replicator/driver/interpreter/GCodeInterpreter.java b/src/main/java/com/neuronrobotics/replicator/driver/interpreter/GCodeInterpreter.java index 0a2ed7dd..513f17fa 100644 --- a/src/main/java/com/neuronrobotics/replicator/driver/interpreter/GCodeInterpreter.java +++ b/src/main/java/com/neuronrobotics/replicator/driver/interpreter/GCodeInterpreter.java @@ -11,7 +11,7 @@ import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * An extensible G-code interpreter. Parses a stream containing G-code commands, * stores register values, and executes handlers. The default handler set @@ -143,7 +143,7 @@ public void processSingleGCODELine(String line) throws Exception{ nextLine.storeWord('G', 0); nextLine.storeWord('M', 0); nextLine.storeWord('P', lineNumber); - System.out.println("GCODE: "+line); + com.neuronrobotics.sdk.common.Log.error("GCODE: "+line); for(int i=0;i l1+l2) { - System.err.println("Hypotenus too long"+x+" "+y+"\r\n"); + com.neuronrobotics.sdk.common.Log.error("Hypotenus too long"+x+" "+y+"\r\n"); return; } double elbow = 0; diff --git a/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensorRequest.java b/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensorRequest.java index 2d0fd4eb..0fb6d8c6 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensorRequest.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensorRequest.java @@ -17,7 +17,7 @@ import java.util.HashMap; import java.util.Map; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum CreateSensorRequest. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensors.java b/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensors.java index 8582326e..262f4f5b 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensors.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/irobot/CreateSensors.java @@ -16,7 +16,7 @@ import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class CreateSensors. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/irobot/ICreateSensorListener.java b/src/main/java/com/neuronrobotics/sdk/addons/irobot/ICreateSensorListener.java index 035ce2f8..a7ed7660 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/irobot/ICreateSensorListener.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/irobot/ICreateSensorListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.addons.irobot; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving ICreateSensor events. * The class that is interested in processing a ICreateSensor diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractKinematicsNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractKinematicsNR.java index 05ab5000..2233dada 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractKinematicsNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractKinematicsNR.java @@ -16,6 +16,8 @@ import com.neuronrobotics.sdk.addons.kinematics.imu.IMU; import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR; import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory; import com.neuronrobotics.sdk.common.BowlerAbstractDevice; import com.neuronrobotics.sdk.common.BowlerDatagram; @@ -35,7 +37,7 @@ import com.neuronrobotics.sdk.pid.PIDEvent; import com.neuronrobotics.sdk.pid.PIDLimitEvent; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc //import javax.swing.JFrame; //import javax.swing.JOptionPane; @@ -168,7 +170,7 @@ public void setRootListener(Object listener) { */ @Override public ArrayList getNamespacesImp() { - // TODO Auto-generated method stub + // Auto-generated method stub ArrayList back = new ArrayList(); back.add("bcs.cartesian.*"); return back; @@ -255,16 +257,6 @@ public AbstractKinematicsNR(Element doc, LinkFactory f) { } - /** - * Gets the date. - * - * @return the date - */ - private String getDate() { - Timestamp t = new Timestamp(System.currentTimeMillis()); - return t.toString().split("\\ ")[0]; - } - /** * Load XML configuration file, then store in LinkConfiguration (ArrayList * type). @@ -286,7 +278,7 @@ protected ArrayList loadConfig(Element doc) { localConfigsFromXml.add(newLinkConf); NodeList dHParameters = linkNode.getChildNodes(); - // System.out.println("Link "+newLinkConf.getName()+" has "+dHParameters + // com.neuronrobotics.sdk.common.Log.error("Link "+newLinkConf.getName()+" has "+dHParameters // .getLength()+" children"); for (int x = 0; x < dHParameters.getLength(); x++) { Node nNode = dHParameters.item(x); @@ -317,9 +309,9 @@ public void onConnect(BowlerAbstractDevice source) { } else { if (nNode.getNodeType() == Node.ELEMENT_NODE && nNode.getNodeName().contentEquals("slaveLink")) { - // System.out.println("Slave link found: "); + // com.neuronrobotics.sdk.common.Log.error("Slave link found: "); LinkConfiguration jc = new LinkConfiguration((Element) nNode); - // System.out.println(jc); + // com.neuronrobotics.sdk.common.Log.error(jc); newLinkConf.getSlaveLinks().add(jc); } } @@ -334,14 +326,7 @@ public void onConnect(BowlerAbstractDevice source) { && linkNode.getNodeName().contentEquals("ZframeToRAS")) { Element eElement = (Element) linkNode; try { - setGlobalToFiducialTransform(new TransformNR( - Double.parseDouble(XmlFactory.getTagValue("x", eElement)), - Double.parseDouble(XmlFactory.getTagValue("y", eElement)), - Double.parseDouble(XmlFactory.getTagValue("z", eElement)), - new RotationNR(new double[] { Double.parseDouble(XmlFactory.getTagValue("rotw", eElement)), - Double.parseDouble(XmlFactory.getTagValue("rotx", eElement)), - Double.parseDouble(XmlFactory.getTagValue("roty", eElement)), - Double.parseDouble(XmlFactory.getTagValue("rotz", eElement)) }))); + setGlobalToFiducialTransform(XmlFactory.getTransform(eElement)); } catch (Exception ex) { ex.printStackTrace(); setGlobalToFiducialTransform(new TransformNR()); @@ -350,19 +335,13 @@ public void onConnect(BowlerAbstractDevice source) { && linkNode.getNodeName().contentEquals("baseToZframe")) { Element eElement = (Element) linkNode; try { - setRobotToFiducialTransform(new TransformNR(Double.parseDouble(XmlFactory.getTagValue("x", eElement)), - Double.parseDouble(XmlFactory.getTagValue("y", eElement)), - Double.parseDouble(XmlFactory.getTagValue("z", eElement)), - new RotationNR(new double[] { Double.parseDouble(XmlFactory.getTagValue("rotw", eElement)), - Double.parseDouble(XmlFactory.getTagValue("rotx", eElement)), - Double.parseDouble(XmlFactory.getTagValue("roty", eElement)), - Double.parseDouble(XmlFactory.getTagValue("rotz", eElement)) }))); + setRobotToFiducialTransform(XmlFactory.getTransform(eElement)); } catch (Exception ex) { ex.printStackTrace(); setRobotToFiducialTransform(new TransformNR()); } } else { - // System.err.println(linkNode.getNodeName()); + // com.neuronrobotics.sdk.common.Log.error(linkNode.getNodeName()); // Log.error("Node not known: "+linkNode.getNodeName()); } } @@ -750,7 +729,9 @@ private double[] _setDesiredJointSpaceVector(double[] jointSpaceVect, double se throw new IndexOutOfBoundsException("Vector must be " + getNumberOfLinks() + " links, actual number of links = " + jointSpaceVect.length); } - + double best = getBestTime(jointSpaceVect); + if(seconds getVitamins() { + return conf.getVitamins(); + } + public void addVitaminInternal(VitaminLocation location) { + conf.addVitamin(location); + } + public void removeVitamin(VitaminLocation loc) { + conf.removeVitamin(loc); + } + public ArrayListgetNonActuatorVitamins(){ + return conf.getNonActuatorVitamins(); + } + /** * Override this method to specify a larger range * @return the maximum value possible for a link @@ -102,7 +125,7 @@ public AbstractLink(LinkConfiguration conf){ this.conf=conf; slaveLinks = conf.getSlaveLinks(); if(slaveLinks.size()>0) - System.out.println(conf.getName()+" has slaves: "+slaveLinks.size()); + com.neuronrobotics.sdk.common.Log.error(conf.getName()+" has slaves: "+slaveLinks.size()); for(LinkConfiguration c:slaveLinks){ //generate the links getSlaveFactory().getLink(c); @@ -476,7 +499,7 @@ protected void setTargetValue(double val) { conf.getHardwareIndex(), targetValue , PIDLimitEventType.UPPERLIMIT, - System.currentTimeMillis() + currentTimeMillis() ) ); if(isUseLimits())throw new RuntimeException("Joint hit Upper software bound\n"+execpt); @@ -494,7 +517,7 @@ protected void setTargetValue(double val) { conf.getHardwareIndex(), targetValue , PIDLimitEventType.LOWERLIMIT, - System.currentTimeMillis() + currentTimeMillis() ) ); if(isUseLimits())throw new RuntimeException("Joint hit Lower software bound\n"+execpt); @@ -692,4 +715,13 @@ public void removeChangeListener(ILinkConfigurationChangeListener l) { public void clearChangeListener() { conf.clearChangeListener(); } + @Override + public void setTimeProvider(ITimeProvider t) { + super.setTimeProvider(t); + imu.setTimeProvider(getTimeProvider()); + } + @Override + public String toString() { + return "Bowler Link "+getLinkConfiguration().getDeviceScriptingName()+" "+getLinkConfiguration().getLinkIndex(); + } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractPrismaticLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractPrismaticLink.java index 15eae770..8471e71e 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractPrismaticLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractPrismaticLink.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.addons.kinematics; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AbstractPrismaticLink. */ @@ -13,7 +13,7 @@ public abstract class AbstractPrismaticLink extends AbstractLink { */ public AbstractPrismaticLink(LinkConfiguration conf) { super(conf); - // TODO Auto-generated constructor stub + // Auto-generated constructor stub } /** diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractRotoryLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractRotoryLink.java index 23af16c7..1c369b7a 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractRotoryLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractRotoryLink.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.addons.kinematics; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AbstractRotoryLink. */ @@ -13,7 +13,7 @@ public abstract class AbstractRotoryLink extends AbstractLink { */ public AbstractRotoryLink(LinkConfiguration conf) { super(conf); - // TODO Auto-generated constructor stub + // Auto-generated constructor stub } /** diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogPrismaticLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogPrismaticLink.java index f8726440..a959f737 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogPrismaticLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogPrismaticLink.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.dyio.peripherals.IAnalogInputListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AnalogPrismaticLink. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogRotoryLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogRotoryLink.java index d44b816a..cd262ac2 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogRotoryLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/AnalogRotoryLink.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.dyio.peripherals.IAnalogInputListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AnalogRotoryLink. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ComputedGeometricModel.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ComputedGeometricModel.java index 7e63289a..585a8713 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ComputedGeometricModel.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ComputedGeometricModel.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ComputedGeometricModel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHChain.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHChain.java index 08bb6bb6..8c9f0db5 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHChain.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHChain.java @@ -12,14 +12,16 @@ import Jama.Matrix; import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory; import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DHChain. */ -public class DHChain { +public class DHChain extends TimeKeeper{ /** The links. */ private ArrayList links = new ArrayList(); @@ -114,9 +116,7 @@ public double[] inverseKinematics(TransformNR target,double[] jointSpaceVector ) if(getLinks() == null) return null; - long start = System.currentTimeMillis(); - - + //is = new GradiantDecent(this,debug); //is = new SearchTreeSolver(this,debug); if(getInverseSolver() == null) @@ -282,7 +282,7 @@ public ArrayList getCachedChain() { * @return the upper limits */ public double[] getUpperLimits() { - // TODO Auto-generated method stub + // Auto-generated method stub return upperLimits; } @@ -292,7 +292,7 @@ public double[] getUpperLimits() { * @return the lower limits */ public double[] getlowerLimits() { - // TODO Auto-generated method stub + // Auto-generated method stub return lowerLimits; } @@ -483,5 +483,13 @@ public void setFactory(LinkFactory factory) { lowerLimits = factory.getLowerLimits(); this.factory = factory; } + @Override + public void setTimeProvider(ITimeProvider t) { + super.setTimeProvider(t); + for(DHLink l:getLinks()) { + if (l.getSlaveMobileBase()!=null) + l.getSlaveMobileBase().setTimeProvider(getTimeProvider()); + } + } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHLink.java index d0017543..36dc4e81 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHLink.java @@ -10,7 +10,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DHLink. */ @@ -221,15 +221,15 @@ public Matrix DhStepInverse(Matrix end, double jointValue) { /** * Dh step prismatic. * - * @param jointValue the joint value + * @param radians the joint value in radians * @return the matrix */ - public Matrix DhStep(double jointValue) { + public Matrix DhStep(double radians) { switch(type){ case PRISMATIC: - return DhStep(0,jointValue); + return DhStep(0,radians); case ROTORY: - return DhStep(jointValue,0); + return DhStep(radians,0); default: case TOOL: return DhStep(0,0); @@ -240,7 +240,7 @@ public Matrix DhStep(double jointValue) { /** * Dh step. * - * @param rotory the rotory + * @param rotory the rotory value in radians * @param prismatic the prismatic * @return the matrix */ @@ -336,7 +336,7 @@ public void setRotX(Matrix rotX) { /** * Sets the matrix. * - * @param rotory the rotory + * @param rotory the rotory value in radians * @param prismatic the prismatic */ private void setMatrix(double rotory,double prismatic){ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHParameterKinematics.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHParameterKinematics.java index ec60362c..12a91bfe 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHParameterKinematics.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DHParameterKinematics.java @@ -12,11 +12,12 @@ import javafx.scene.transform.Affine; import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory; import com.neuronrobotics.sdk.common.BowlerAbstractDevice; import com.neuronrobotics.sdk.common.IDeviceConnectionEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DHParameterKinematics. */ @@ -82,10 +83,11 @@ public void onDisconnect(BowlerAbstractDevice source) { @Override public void onConnect(BowlerAbstractDevice source) { - // TODO Auto-generated method stub + // Auto-generated method stub } }); + makeDefaultVitamins(); } /** @@ -104,6 +106,14 @@ public DHParameterKinematics(BowlerAbstractDevice bad, InputStream linkStream) { getFactory().getDyio(lf).addConnectionEventListener(l); return; } + makeDefaultVitamins(); + } + + private void makeDefaultVitamins() { + for(int i=0;i getVitamins(int index) { + return getVitaminHolder(index).getVitamins(); + } + public ArrayListgetNonActuatorVitamins(int index){ + return getLinkConfiguration(index).getNonActuatorVitamins(); + } + public void addVitamin(int index,VitaminLocation location) { + getVitaminHolder(index).addVitamin(location); + } + public void removeVitamin(int index,VitaminLocation loc) { + getVitaminHolder(index).removeVitamin(loc); + } + public IVitaminHolder getVitaminHolder(int index) { + return getLinkConfiguration(index); + } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DhInverseSolver.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DhInverseSolver.java index 577cb9d5..42f04944 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DhInverseSolver.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DhInverseSolver.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface DhInverseSolver. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DrivingType.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DrivingType.java index 5d5a516d..3f4eeef3 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DrivingType.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/DrivingType.java @@ -4,7 +4,7 @@ import java.util.Map; import java.util.NoSuchElementException; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum DrivingType. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GenericKinematicsModelNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GenericKinematicsModelNR.java index e3fb043a..6f39b076 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GenericKinematicsModelNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GenericKinematicsModelNR.java @@ -11,7 +11,7 @@ import com.neuronrobotics.sdk.namespace.bcs.pid.IExtendedPIDControl; import com.neuronrobotics.sdk.pid.GenericPIDDevice; import com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc //import com.neuronrobotics.sdk.pid.IPIDControl; /** @@ -92,7 +92,7 @@ public double[] inverseKinematics(TransformNR cartesianSpaceVector)throws Except */ @Override public void disconnectDevice() { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -101,7 +101,7 @@ public void disconnectDevice() { */ @Override public boolean connectDevice() { - // TODO Auto-generated method stub + // Auto-generated method stub return false; } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecent.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecent.java index 68c1e92a..c1fe49e9 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecent.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecent.java @@ -5,7 +5,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class GradiantDecent. */ @@ -25,7 +25,7 @@ public class GradiantDecent implements DhInverseSolver{ */ public GradiantDecent(DHChain dhChain, boolean debug) { this.dhChain = dhChain; - // TODO Auto-generated constructor stub + // Auto-generated constructor stub this.debug = debug; } @@ -83,7 +83,7 @@ public double[] inverseKinematics(TransformNR target,double[] jointSpaceVector, } }while(++iter<200 && notArrived && stopped == false);//preincrement and check if(debug){ - System.out.println("Numer of iterations #"+iter+" \n\tStalled = "+stopped+" \n\tArrived = "+!notArrived+" \n\tFinal offset= "+vect+" \n\tFinal orent= "+orent); + com.neuronrobotics.sdk.common.Log.error("Numer of iterations #"+iter+" \n\tStalled = "+stopped+" \n\tArrived = "+!notArrived+" \n\tFinal offset= "+vect+" \n\tFinal orent= "+orent); } return inv; } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecentNode.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecentNode.java index 85bc3378..9df51a52 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecentNode.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/GradiantDecentNode.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class GradiantDecentNode. */ @@ -228,7 +228,7 @@ public boolean step() { public void jitter(){ double jitterAmmount = 10; double jitter=(Math.random()*jitterAmmount)-(jitterAmmount /2) ; - System.out.println("Jittering Link #"+getIndex()+" jitter:"+jitter+" current offset:"+offset); + com.neuronrobotics.sdk.common.Log.error("Jittering Link #"+getIndex()+" jitter:"+jitter+" current offset:"+offset); offset += jitter; jointSpaceVector[getIndex()] = myStart+offset; } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IDhLinkPositionListener.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IDhLinkPositionListener.java index bd4bc925..c07b65ad 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IDhLinkPositionListener.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IDhLinkPositionListener.java @@ -2,7 +2,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDhLinkPosition events. * The class that is interested in processing a IDhLinkPosition diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IJointSpaceUpdateListenerNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IJointSpaceUpdateListenerNR.java index 9fa14c12..2799613e 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IJointSpaceUpdateListenerNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IJointSpaceUpdateListenerNR.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.addons.kinematics; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc //import com.neuronrobotics.sdk.pid.PIDLimitEvent; /** diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ILinkListener.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ILinkListener.java index 9245eb1d..5563d365 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ILinkListener.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ILinkListener.java @@ -2,7 +2,7 @@ import com.neuronrobotics.sdk.pid.PIDLimitEvent; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving ILink events. * The class that is interested in processing a ILink diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IRegistrationListenerNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IRegistrationListenerNR.java index 04f75aa5..b8bbc2ee 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IRegistrationListenerNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IRegistrationListenerNR.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IRegistrationListenerNR. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ITaskSpaceUpdateListenerNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ITaskSpaceUpdateListenerNR.java index 9360a478..2a01abc0 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ITaskSpaceUpdateListenerNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ITaskSpaceUpdateListenerNR.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface ITaskSpaceUpdateListenerNR. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IVitaminHolder.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IVitaminHolder.java new file mode 100644 index 00000000..483c9a52 --- /dev/null +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/IVitaminHolder.java @@ -0,0 +1,34 @@ +package com.neuronrobotics.sdk.addons.kinematics; + +import java.util.ArrayList; + +public interface IVitaminHolder { + ArrayList getVitamins() ; + default void addVitamin(VitaminLocation location) { + for(VitaminLocation v:getVitamins()) { + if(v.getName().contentEquals(location.getName())) { + new RuntimeException("Vitamin Name "+v.getName()+"already exists"); + } + } + addVitaminInternal( location); + } + void addVitaminInternal(VitaminLocation location); + void removeVitamin(VitaminLocation loc); + default ArrayList getVitamins(VitaminFrame frame){ + ArrayList copy = new ArrayList<>(); + for(VitaminLocation v:getVitamins()) { + if(v.getFrame()==frame) + copy.add(v); + } + return copy; + } + default ArrayList getOriginVitamins(){ + return getVitamins(VitaminFrame.LinkOrigin); + } + default ArrayList getDefaultVitamins(){ + return getVitamins(VitaminFrame.DefaultFrame); + } + default ArrayList getPreviousLinkVitamins(){ + return getVitamins(VitaminFrame.previousLinkTip); + } +} diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/JointLimit.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/JointLimit.java index 4abc7f9c..55ab2904 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/JointLimit.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/JointLimit.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.pid.PIDLimitEvent; import com.neuronrobotics.sdk.pid.PIDLimitEventType; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class JointLimit. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkConfiguration.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkConfiguration.java index 4050d6fc..7ad52272 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkConfiguration.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkConfiguration.java @@ -18,13 +18,13 @@ import com.neuronrobotics.sdk.namespace.bcs.pid.IPidControlNamespace; import com.neuronrobotics.sdk.pid.PIDConfiguration; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class LinkConfiguration. */ -public class LinkConfiguration implements ITransformNRChangeListener { +public class LinkConfiguration implements ITransformNRChangeListener, IVitaminHolder { private ArrayList listeners = null; - private boolean pauseEvents=false; + private boolean pauseEvents = false; /** The name. */ private String name = "newLink";// = getTagValue("name",eElement); @@ -96,10 +96,13 @@ public class LinkConfiguration implements ITransformNRChangeListener { */ private boolean invertLimitVelocityPolarity = false; - private HashMap vitamins = new HashMap(); + private ArrayList vitamins = new ArrayList(); private HashMap vitaminVariant = new HashMap(); private boolean passive = false; private boolean newAbs = false; + private Runnable changeListener = () -> { + fireChangeEvent(); + }; /** * Instantiates a new link configuration. @@ -247,7 +250,7 @@ public LinkConfiguration(Element eElement) { if (staticOffset > getUpperLimit() || staticOffset < getLowerLimit()) Log.error("PID group " + getHardwareIndex() + " staticOffset is " + staticOffset + " but needs to be between " + getUpperLimit() + " and " + getLowerLimit()); - // System.out.println("Interted"+ inverted); + // com.neuronrobotics.sdk.common.Log.error("Interted"+ inverted); } /** @@ -275,19 +278,7 @@ public LinkConfiguration(Object[] args) { protected void getVitamins(Element doc) { try { - NodeList nodListofLinks = doc.getChildNodes(); - for (int i = 0; i < nodListofLinks.getLength(); i++) { - Node linkNode = nodListofLinks.item(i); - if (linkNode.getNodeType() == Node.ELEMENT_NODE && linkNode.getNodeName().contentEquals("vitamin")) { - Element e = (Element) linkNode; - setVitamin(XmlFactory.getTagValue("name", e), XmlFactory.getTagValue("type", e), - XmlFactory.getTagValue("id", e)); - try { - setVitaminVariant(XmlFactory.getTagValue("name", e), XmlFactory.getTagValue("variant", e)); - } catch (Exception ex) { - } - } - } + vitamins = VitaminLocation.getVitamins(doc); return; } catch (Exception e) { e.printStackTrace(); @@ -303,12 +294,32 @@ protected void getVitamins(Element doc) { * @param type the vitamin type, this maps the the json filename * @param id the part ID, theis maps to the key in the json for the vitamin */ - public void setVitamin(String name, String type, String id) { - if (getVitamins().get(name) == null) { - getVitamins().put(name, new String[2]); - } - getVitamins().get(name)[0] = type; - getVitamins().get(name)[1] = id; + @Deprecated + public void setVitamin(VitaminLocation location) { + addVitamin(location); + + } + + /** + * Add a vitamin to this link + * + * @param name the name of this vitamin, if the name already exists, the data + * will be overwritten. + * @param type the vitamin type, this maps the the json filename + * @param id the part ID, theis maps to the key in the json for the vitamin + */ + public void addVitaminInternal(VitaminLocation location) { + if (vitamins.contains(location)) + return; + vitamins.add(location); + location.addChangeListener(changeListener); + fireChangeEvent(); + } + + public void removeVitamin(VitaminLocation loc) { + if (vitamins.contains(loc)) + vitamins.remove(loc); + loc.removeChangeListener(changeListener); fireChangeEvent(); } @@ -343,15 +354,13 @@ public LinkConfiguration() { public LinkConfiguration(LinkConfiguration from) { setDeviceScriptingName(from.getDeviceScriptingName()); - for(int i=0;i\n"; } - String allVitamins = ""; - for (String key : getVitamins().keySet()) { - String v = "\t\t\n"; - v += "\t\t\t" + key + "\n" + "\t\t\t" + getVitamins().get(key)[0] + "\n" - + "\t\t\t" + getVitamins().get(key)[1] + "\n"; - if (getVitaminVariant(key) != null) { - v += "\t\t\t" + getVitamins().get(key)[1] + "\n"; - } - v += "\t\t\n"; - allVitamins += v; - } + String vitamnsString = VitaminLocation.getAllXML(vitamins); return "\t" + getName() + "\n" + "\t" + DevStr + "\t" + getTypeString() + "\n" + "\t" + getHardwareIndex() + "\n" + "\t" + getScale() + "\n" + "\t" + getUpperLimit() + "\n" + "\t" + getLowerLimit() @@ -443,11 +442,10 @@ public String getXml() { + "\n" + "\t" + getDeviceTheoreticalMin() + "\n" + "\t" + isLatch() + "\n" + "\t" + getIndexLatch() + "\n" + "\t" + isStopOnLatch() + "\n" - + "\t" + getHomingTicksPerSecond() + "\n" + "\n\t\n" + allVitamins - + "\n\t\n" + "\t" + isPassive() + "\n" + "\t" + getMassKg() - + "\n" + "\t" + getCenterOfMassFromCentroid().getXml() - + "\n" + "\t" + getimuFromCentroid().getXml() - + "\n" + slaves; + + "\t" + getHomingTicksPerSecond() + "\n" + vitamnsString + "\t" + + isPassive() + "\n" + "\t" + getMassKg() + "\n" + "\t" + + getCenterOfMassFromCentroid().getXml() + "\n" + "\t" + + getimuFromCentroid().getXml() + "\n" + slaves; } /** @@ -945,58 +943,87 @@ public void setimuFromCentroid(TransformNR imu) { this.imuFromCentroid.addChangeListener(this); fireChangeEvent(); } + // private String electroMechanicalType = "hobbyServo"; // private String electroMechanicalSize = "standardMicro"; // private String shaftType = "hobbyServoHorn"; // private String shaftSize = "standardMicro1"; - - private String[] getCoreShaftPart() { - if (vitamins.get("shaft") == null) { - vitamins.put("shaft", new String[] { "hobbyServoHorn", "standardMicro1" }); + public ArrayList getNonActuatorVitamins() { + ArrayList back = new ArrayList<>(); + back.addAll(vitamins); + back.remove(getShaftVitamin()); + back.remove(getElectroMechanicalVitamin()); + return back; + } + + public VitaminLocation getShaftVitamin(boolean makeNew) { + for (VitaminLocation loc : vitamins) + if (loc.getName().contentEquals("shaft")) + return loc; + if (makeNew) { + VitaminLocation e = new VitaminLocation(false,"shaft", "hobbyServoHorn", "standardMicro1", new TransformNR()); + e.setFrame(VitaminFrame.LinkOrigin); + vitamins.add(e); + return e; + } + return null; + } + + public VitaminLocation getElectroMechanicalVitamin(boolean makeNew) { + for (VitaminLocation loc : vitamins) + if (loc.getName().contentEquals("electroMechanical")) + return loc; + if (makeNew) { + VitaminLocation e = new VitaminLocation(false,"electroMechanical", "hobbyServo", "mg92b", new TransformNR()); + e.setFrame(VitaminFrame.previousLinkTip); + vitamins.add(e); + return e; } - return vitamins.get("shaft"); + return null; } - private String[] getCoreEmPart() { - if (vitamins.get("electroMechanical") == null) { - vitamins.put("electroMechanical", new String[] { "hobbyServo", "standardMicro" }); - } - return vitamins.get("electroMechanical"); + public VitaminLocation getShaftVitamin() { + return getShaftVitamin(false); + } + + public VitaminLocation getElectroMechanicalVitamin() { + return getElectroMechanicalVitamin(false); } public String getElectroMechanicalType() { - return getCoreEmPart()[0]; + return getElectroMechanicalVitamin().getType(); } public void setElectroMechanicalType(String electroMechanicalType) { - getCoreEmPart()[0] = electroMechanicalType; + getElectroMechanicalVitamin().setType(electroMechanicalType); fireChangeEvent(); } public String getElectroMechanicalSize() { - return getCoreEmPart()[1]; + return getElectroMechanicalVitamin().getSize(); } public void setElectroMechanicalSize(String electroMechanicalSize) { - getCoreEmPart()[1] = electroMechanicalSize; + getElectroMechanicalVitamin().setSize(electroMechanicalSize); fireChangeEvent(); } public String getShaftType() { - return getCoreShaftPart()[0]; + return getShaftVitamin().getType(); } public void setShaftType(String shaftType) { - getCoreShaftPart()[0] = shaftType; + getShaftVitamin().setType(shaftType); + ; fireChangeEvent(); } public String getShaftSize() { - return getCoreShaftPart()[1]; + return getShaftVitamin().getSize(); } public void setShaftSize(String shaftSize) { - getCoreShaftPart()[1] = shaftSize; + getShaftVitamin().setSize(shaftSize); fireChangeEvent(); } @@ -1009,12 +1036,17 @@ public void setPassive(boolean passive) { fireChangeEvent(); } - public HashMap getVitamins() { + public ArrayList getVitamins() { return vitamins; } - public void setVitamins(HashMap vitamins) { - this.vitamins = vitamins; + public void setVitamins(ArrayList v) { + if (vitamins != null) + for (VitaminLocation l : vitamins) + l.removeChangeListener(changeListener); + this.vitamins = v; + for (VitaminLocation l : vitamins) + l.addChangeListener(changeListener); fireChangeEvent(); } @@ -1113,7 +1145,7 @@ public ArrayList getListeners() { } void fireChangeEvent() { - if(pauseEvents) + if (pauseEvents) return; if (listeners != null) { for (int i = 0; i < listeners.size(); i++) { diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkFactory.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkFactory.java index f9e67764..f5de8ca2 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkFactory.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkFactory.java @@ -20,7 +20,7 @@ import com.neuronrobotics.sdk.pid.ILinkFactoryProvider; import com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A factory for creating Link objects. */ @@ -302,7 +302,7 @@ public void flush(final double seconds) { // TickToc.tic("Done Checking "+name+" for flush "); } - // System.out.println("Flush Took "+(System.currentTimeMillis()-time)+"ms"); + // com.neuronrobotics.sdk.common.Log.error("Flush Took "+(System.currentTimeMillis()-time)+"ms"); } /** @@ -393,7 +393,7 @@ public ArrayList getLinkConfigurations() { * @param l the l */ public void removeLinkListener(AbstractKinematicsNR l) { - // TODO Auto-generated method stub + // Auto-generated method stub for (AbstractLink lin : links) { lin.removeLinkListener(l); } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkType.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkType.java index c4043ae1..cafe7641 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkType.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/LinkType.java @@ -5,7 +5,7 @@ import java.util.Map; import java.util.NoSuchElementException; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum LinkType. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MobileBase.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MobileBase.java index c8e889ad..1be362a3 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MobileBase.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MobileBase.java @@ -17,16 +17,17 @@ import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR; import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; import com.neuronrobotics.sdk.addons.kinematics.parallel.ParallelGroup; +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory; import com.neuronrobotics.sdk.common.DeviceManager; import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class MobileBase. */ public class MobileBase extends AbstractKinematicsNR implements ILinkConfigurationChangeListener, - IOnMobileBaseRenderChange, IJointSpaceUpdateListenerNR, IHardwareSyncPulseReciver, IHardwareSyncPulseProvider { + IOnMobileBaseRenderChange, IJointSpaceUpdateListenerNR, IHardwareSyncPulseReciver, IHardwareSyncPulseProvider,IVitaminHolder { /** The legs. */ private final ArrayList legs = new ArrayList(); @@ -50,7 +51,7 @@ public class MobileBase extends AbstractKinematicsNR implements ILinkConfigurati private String[] walkingEngine = new String[] { "https://github.com/madhephaestus/carl-the-hexapod.git", "WalkingDriveEngine.groovy" }; - private HashMap vitamins = new HashMap(); + private ArrayList vitamins = new ArrayList<>(); private HashMap vitaminVariant = new HashMap(); /** The self source. */ @@ -63,6 +64,7 @@ public class MobileBase extends AbstractKinematicsNR implements ILinkConfigurati private HashMap parallelGroups = new HashMap(); private ICalcLimbHomeProvider homeProvider = null; + private Runnable configurationUpdate = ()->{}; /** * Instantiates a new mobile base. @@ -70,6 +72,14 @@ public class MobileBase extends AbstractKinematicsNR implements ILinkConfigurati public MobileBase() { }// used for building new bases live + public void fireConfigurationUpdate() { + if(configurationUpdate!=null) + try { + configurationUpdate.run(); + }catch(Throwable t) { + t.printStackTrace(); + } + } /** * Calc home. * @@ -147,7 +157,7 @@ public MobileBase(InputStream configFile) { NodeList nodListofLinks = doc.getElementsByTagName("root"); if (nodListofLinks.getLength() != 1) { - // System.out.println("Found "+nodListofLinks.getLength()); + // com.neuronrobotics.sdk.common.Log.error("Found "+nodListofLinks.getLength()); throw new RuntimeException("one mobile base is needed per level"); } NodeList rootNode = nodListofLinks.item(0).getChildNodes(); @@ -211,6 +221,7 @@ public void addLimbToParallel(DHParameterKinematics limb, TransformNR tipOffset, removeLimFromParallel(limb); ParallelGroup g = getParallelGroup(name); g.addLimb(limb, tipOffset, relativeLimb, relativeIndex); + fireConfigurationUpdate(); } private void removeLimFromParallel(DHParameterKinematics limb) { @@ -221,6 +232,7 @@ private void removeLimFromParallel(DHParameterKinematics limb) { if (g.getConstituantLimbs().size() == 0) { getParallelGroups().remove(g.getNameOfParallelGroup()); } + fireConfigurationUpdate(); } /** @@ -332,6 +344,19 @@ private String getname(Element e) { private String getParallelGroup(Element e) { return getTag(e, "parallelGroup"); } + + private String findNameTag(Node e) { + NodeList firstLevelList = e.getChildNodes(); + for(int i=0;i if (linkNode.getNodeType() == Node.ELEMENT_NODE && linkNode.getNodeName().contentEquals(tag)) { Element e = (Element) linkNode; final String name = getname(e); - // System.out.println("Loading arm "+name); + // com.neuronrobotics.sdk.common.Log.error("Loading arm "+name); DHParameterKinematics kin = (DHParameterKinematics) DeviceManager .getSpecificDevice(DHParameterKinematics.class, name); if (kin == null) { @@ -385,9 +416,9 @@ private void loadLimb(Element doc, String tag, ArrayList } kin.setScriptingName(name); String parallel = getParallelGroup(e); - // System.out.println("paralell "+parallel); + // com.neuronrobotics.sdk.common.Log.error("paralell "+parallel); if (parallel != null) { - System.out.println("Loading Paralell group " + parallel + " limb " + name); + com.neuronrobotics.sdk.common.Log.error("Loading Paralell group " + parallel + " limb " + name); TransformNR paraOffset = loadTransform("parallelGroupTipOffset", e); String relativeName = getTag(e, "relativeTo"); int index = 0; @@ -449,7 +480,7 @@ public boolean connectDevice() { */ @Override public double[] inverseKinematics(TransformNR taskSpaceTransform) throws Exception { - // TODO Auto-generated method stub + // Auto-generated method stub return new double[getNumberOfLinks()]; } @@ -461,7 +492,7 @@ public double[] inverseKinematics(TransformNR taskSpaceTransform) throws Excepti */ @Override public TransformNR forwardKinematics(double[] jointSpaceVector) { - // TODO Auto-generated method stub + // Auto-generated method stub return new TransformNR(); } @@ -527,7 +558,7 @@ private void loadVitamins(Element doc) { } } - public HashMap getVitamins() { + public ArrayList getVitamins() { return vitamins; } @@ -539,18 +570,11 @@ public HashMap getVitamins() { private void getVitamins(Element doc) { try { - NodeList nodListofLinks = doc.getChildNodes(); - for (int i = 0; i < nodListofLinks.getLength(); i++) { - Node linkNode = nodListofLinks.item(i); - if (linkNode.getNodeType() == Node.ELEMENT_NODE && linkNode.getNodeName().contentEquals("vitamin")) { - Element e = (Element) linkNode; - setVitamin(XmlFactory.getTagValue("name", e), XmlFactory.getTagValue("type", e), - XmlFactory.getTagValue("id", e)); - try { - setVitaminVariant(XmlFactory.getTagValue("name", e), XmlFactory.getTagValue("variant", e)); - } catch (Exception ex) { - } - } + vitamins = VitaminLocation.getVitamins(doc); + for(VitaminLocation vl:vitamins) { + vl.addChangeListener(()->{ + fireConfigurationUpdate(); + }); } return; } catch (Exception e) { @@ -567,12 +591,32 @@ private void getVitamins(Element doc) { * @param type the vitamin type, this maps the the json filename * @param id the part ID, theis maps to the key in the json for the vitamin */ - public void setVitamin(String name, String type, String id) { - if (getVitamins().get(name) == null) { - getVitamins().put(name, new String[2]); - } - getVitamins().get(name)[0] = type; - getVitamins().get(name)[1] = id; + @Deprecated + public void setVitamin(VitaminLocation location) { + addVitamin(location); + + } + /** + * Add a vitamin to this link + * + * @param name the name of this vitamin, if the name already exists, the data + * will be overwritten. + * @param type the vitamin type, this maps the the json filename + * @param id the part ID, theis maps to the key in the json for the vitamin + */ + public void addVitaminInternal(VitaminLocation location) { + if(vitamins.contains(location)) + return; + vitamins.add(location); + location.addChangeListener(()->{ + fireConfigurationUpdate(); + }); + fireConfigurationUpdate(); + } + public void removeVitamin(VitaminLocation loc) { + if(vitamins.contains(loc)) + vitamins.remove(loc); + fireConfigurationUpdate();//fireChangeEvent(); } /** @@ -623,17 +667,17 @@ public String getXml() { public String getEmbedableXml() { TransformNR location = getFiducialToGlobalTransform(); - String allVitamins = ""; - for (String key : getVitamins().keySet()) { - String v = "\t\t\n"; - v += "\t\t\t" + key + "\n" + "\t\t\t" + getVitamins().get(key)[0] + "\n" - + "\t\t\t" + getVitamins().get(key)[1] + "\n"; - if (getVitaminVariant(key) != null) { - v += "\t\t\t" + getVitamins().get(key)[1] + "\n"; - } - v += "\t\t\n"; - allVitamins += v; - } +// String allVitamins = ""; +// for (String key : getVitamins().keySet()) { +// String v = "\t\t\n"; +// v += "\t\t\t" + key + "\n" + "\t\t\t" + getVitamins().get(key)[0] + "\n" +// + "\t\t\t" + getVitamins().get(key)[1] + "\n"; +// if (getVitaminVariant(key) != null) { +// v += "\t\t\t" + getVitamins().get(key)[1] + "\n"; +// } +// v += "\t\t\n"; +// allVitamins += v; +// } String xml = "\n"; xml += "\t\n"; @@ -683,7 +727,7 @@ public String getEmbedableXml() { } xml += "\n\n"; - xml += getFiducialToGlobalTransform().getXml(); + xml += new TransformNR().getXml(); xml += "\n\n"; xml += "\n\n"; @@ -691,7 +735,7 @@ public String getEmbedableXml() { xml += "\n\n" + "\t" + getMassKg() + "\n" + "\t" + getCenterOfMassFromCentroid().getXml() + "\n" + "\t" + getIMUFromCentroid().getXml() + "\n"; - xml += "\n\n" + allVitamins + "\n\n"; + xml += VitaminLocation.getAllXML(vitamins); xml += "\n\n"; setGlobalToFiducialTransform(location); return xml; @@ -716,6 +760,45 @@ private String makeLimbTag(String xml, DHParameterKinematics l) { xml += l.getEmbedableXml(); return xml; } + + public boolean isWheel(AbstractLink link) { + ArrayList possible= new ArrayList<>(); + possible.addAll(getSteerable()); + possible.addAll(getDrivable()); + for(DHParameterKinematics kin:possible) { + for(int i=0;i possible= new ArrayList<>(); + possible.addAll(legs); + for(DHParameterKinematics kin:possible) { + for(int i=0;i getParallelGroups() { @@ -952,7 +1046,7 @@ public static void main(String[] args) throws Exception { TransformNR TipOffset = group.getTipOffset().get(limb); TransformNR newTip = limb.getCurrentTaskSpaceTransform().times(TipOffset); - System.out.println("Expected tip to be " + Tip.getX() + " and got: " + newTip.getX()); + com.neuronrobotics.sdk.common.Log.error("Expected tip to be " + Tip.getX() + " and got: " + newTip.getX()); // assertTrue(!Double.isNaN(Tip.getX())); // assertEquals(Tip.getX(), newTip.getX(), .1); } @@ -962,7 +1056,8 @@ public static void main(String[] args) throws Exception { private void fireIOnMobileBaseRenderChange() { for (int i = 0; i < changeListeners.size(); i++) { IOnMobileBaseRenderChange l = changeListeners.get(i); - l.onIOnMobileBaseRenderChange(); + if(l!=null) + l.onIOnMobileBaseRenderChange(); } } @@ -988,31 +1083,32 @@ public void clearIOnMobileBaseRenderChange() { @Override public void event(LinkConfiguration newConf) { - // TODO Auto-generated method stub + // Auto-generated method stub fireIOnMobileBaseRenderChange(); + fireConfigurationUpdate(); } @Override public void onIOnMobileBaseRenderChange() { - // TODO Auto-generated method stub + // Auto-generated method stub fireIOnMobileBaseRenderChange(); } @Override public void onJointSpaceUpdate(AbstractKinematicsNR source, double[] joints) { - // TODO Auto-generated method stub + // Auto-generated method stub fireIOnMobileBaseRenderChange(); } @Override public void onJointSpaceTargetUpdate(AbstractKinematicsNR source, double[] joints) { - // TODO Auto-generated method stub + // Auto-generated method stub } @Override public void onJointSpaceLimit(AbstractKinematicsNR source, int axis, JointLimit event) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -1020,5 +1116,26 @@ public void onJointSpaceLimit(AbstractKinematicsNR source, int axis, JointLimit public void sync() { doSync(); } + @Override + public void setTimeProvider(ITimeProvider t) { + super.setTimeProvider(t); + for(DHParameterKinematics k:getAllDHChains()) { + k.setTimeProvider(getTimeProvider()); + } + } + + /** + * @return the configurationUpdate + */ + public Runnable getConfigurationUpdate() { + return configurationUpdate; + } + + /** + * @param configurationUpdate the configurationUpdate to set + */ + public void setConfigurationUpdate(Runnable configurationUpdate) { + this.configurationUpdate = configurationUpdate; + } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MockRotoryLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MockRotoryLink.java index 5e2fd4ea..f0bd4bea 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MockRotoryLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/MockRotoryLink.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.addons.kinematics; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class MockRotoryLink. */ @@ -33,7 +33,7 @@ public MockRotoryLink(LinkConfiguration conf) { @Override public void cacheTargetValueDevice() { val=getTargetValue(); - //System.out.println("Cacheing value="+val); + //com.neuronrobotics.sdk.common.Log.error("Cacheing value="+val); } /* (non-Javadoc) @@ -42,7 +42,7 @@ public void cacheTargetValueDevice() { @Override public void flushDevice(double time) { val=getTargetValue(); - //System.out.println("Flushing value="+val); + //com.neuronrobotics.sdk.common.Log.error("Flushing value="+val); } /* (non-Javadoc) @@ -50,7 +50,7 @@ public void flushDevice(double time) { */ @Override public double getCurrentPosition() { - // TODO Auto-generated method stub + // Auto-generated method stub return 35; } @@ -59,9 +59,9 @@ public double getCurrentPosition() { */ @Override public void flushAllDevice(double time) { - // TODO Auto-generated method stub + // Auto-generated method stub val=getTargetValue(); - //System.out.println("Flushing all Values"); + //com.neuronrobotics.sdk.common.Log.error("Flushing all Values"); } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidPrismaticLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidPrismaticLink.java index a6b980b3..cc4fea51 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidPrismaticLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidPrismaticLink.java @@ -5,7 +5,7 @@ import com.neuronrobotics.sdk.pid.PIDEvent; import com.neuronrobotics.sdk.pid.PIDLimitEvent; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PidPrismaticLink. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidRotoryLink.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidRotoryLink.java index 5befe574..54e2a99b 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidRotoryLink.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/PidRotoryLink.java @@ -5,7 +5,7 @@ import com.neuronrobotics.sdk.pid.PIDEvent; import com.neuronrobotics.sdk.pid.PIDLimitEvent; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PidRotoryLink. */ diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/SearchTreeSolver.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/SearchTreeSolver.java index 3fb6863a..0b367186 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/SearchTreeSolver.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/SearchTreeSolver.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class SearchTreeSolver. */ @@ -65,11 +65,11 @@ public double[] inverseKinematics(TransformNR target,double[] jointSpaceVector, if(vect<10 && orent< .05){ done = true; - System.out.println("SearchTreeSolver Success stats: \n\tIterations = "+i+" out of "+iter+"\n"+conf); + com.neuronrobotics.sdk.common.Log.error("SearchTreeSolver Success stats: \n\tIterations = "+i+" out of "+iter+"\n"+conf); } if(i++==iter){ done = true; - System.err.println("SearchTreeSolver FAILED stats: \n\tIterations = "+i+" out of "+iter+"\n"+conf); + com.neuronrobotics.sdk.common.Log.error("SearchTreeSolver FAILED stats: \n\tIterations = "+i+" out of "+iter+"\n"+conf); } }while(! done); @@ -213,7 +213,7 @@ public configuration getBest(double[] jointSpaceVector){ } i++; } - //System.out.println("Selecting "+best+" config"); + //com.neuronrobotics.sdk.common.Log.error("Selecting "+best+" config"); return configurations.get(best); } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/VitaminFrame.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/VitaminFrame.java new file mode 100644 index 00000000..374ce31b --- /dev/null +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/VitaminFrame.java @@ -0,0 +1,29 @@ +package com.neuronrobotics.sdk.addons.kinematics; + +public enum VitaminFrame { + // the MobilBase root, or the tip of the link + DefaultFrame("default"), + // the place on the link where the previous one ends, where the shaft for the motor that turns it should be + LinkOrigin("origin"), + // The tip of the previous link. the place where the motor that turns a link would be mounted. if the first link this would be the limbs root + previousLinkTip("lastlink"); + + private String text; + + VitaminFrame(String text) { + this.text = text; + } + + public String getText() { + return this.text; + } + + public static VitaminFrame fromString(String text) { + for (VitaminFrame b : VitaminFrame.values()) { + if (b.text.equalsIgnoreCase(text)) { + return b; + } + } + return null; + } +} diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/VitaminLocation.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/VitaminLocation.java new file mode 100644 index 00000000..534c4535 --- /dev/null +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/VitaminLocation.java @@ -0,0 +1,292 @@ +package com.neuronrobotics.sdk.addons.kinematics; + +import java.util.ArrayList; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.google.gson.annotations.Expose; +import com.neuronrobotics.sdk.addons.kinematics.math.ITransformNRChangeListener; +import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; +import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory; + +public class VitaminLocation implements ITransformNRChangeListener { + @Expose (serialize = false, deserialize = false) + ArrayList listeners=new ArrayList<>(); + @Expose(serialize = true, deserialize = true) + private String name; + @Expose(serialize = true, deserialize = true) + private String type; + @Expose(serialize = true, deserialize = true) + private String size; + @Expose(serialize = true, deserialize = true) + private TransformNR location=null; + @Expose(serialize = true, deserialize = true) + private boolean isScript =false; + + private VitaminFrame frame=VitaminFrame.DefaultFrame; +// public VitaminLocation() { +// this.setName("NO NAME"); +// this.setType("NO TYPE"); +// this.setSize("NO SIZE"); +// this.setLocation(new TransformNR()); +// } + @Deprecated + public VitaminLocation(String name, String type, String size, TransformNR location) { + this(false,name,type,size,location); + new RuntimeException("@Deprecated, please specifiy if this is a script, assuming it is not for now").printStackTrace(); + } + @Deprecated + public VitaminLocation(String name, String type, String size, TransformNR location,IVitaminHolder h) { + this(false,name,type,size,location,h); + new RuntimeException("@Deprecated, please specifiy if this is a script, assuming it is not for now").printStackTrace(); + } + public VitaminLocation(boolean isScript,String name, String type, String size, TransformNR location) { + this.setName(name); + this.setType(type); + this.setSize(size); + this.setLocation(location); + setScript(isScript); + } + public VitaminLocation(VitaminLocation loc, String name2) { + this.setName(name2); + this.setType(loc.type); + this.setSize(loc.size); + this.setLocation(loc.location); + setScript(loc.isScript); + } + public VitaminLocation(boolean isScript,String name, String type, String size, TransformNR location,IVitaminHolder h) { + this(isScript,name,type,size,location); + try { + h.addVitamin(this); + }catch(Throwable t){ + com.neuronrobotics.sdk.common.Log.error("Vitamin "+name+" exists in "+h); + } + } + public VitaminLocation(Element vitamins) { + setName(XmlFactory.getTagValue("name", vitamins)); + setType(XmlFactory.getTagValue("type", vitamins)); + setSize(XmlFactory.getTagValue("id", vitamins)); + String scriptyness=null; + try { + scriptyness=XmlFactory.getTagValue("script", vitamins); + }catch(Exception ex) {}//ignore + if(scriptyness==null) { + isScript=false; + }else{ + setScript(Boolean.parseBoolean(scriptyness)); + } + NodeList nodListofLinks = vitamins.getChildNodes(); + TransformNR tf=null; + for (int i = 0; i < nodListofLinks.getLength(); i++) { + Node linkNode = nodListofLinks.item(i); + if(linkNode.getNodeType() != Node.ELEMENT_NODE) + continue; + Element eElement = (Element) linkNode; + if(linkNode.getNodeName().contentEquals("pose")) { + tf=XmlFactory.getTransform(eElement); + } + } + if(tf==null) + tf=new TransformNR(); + setLocation(tf); + try { + setFrame(VitaminFrame.fromString( XmlFactory.getTagValue("frame", vitamins))); + }catch(NullPointerException ex) { + if(name.contentEquals("electroMechanical")) { + setFrame(VitaminFrame.previousLinkTip); + } + if(name.contentEquals("shaft")) { + setFrame(VitaminFrame.LinkOrigin); + } + } + } + + + public void addChangeListener(Runnable r) { + if(listeners.contains(r)) + return; + listeners.add(r); + } + public void removeChangeListener(Runnable r) { + if(listeners.contains(r)) + listeners.remove(r); + } + void fireChangeEvent() { + if (listeners != null) { + for (int i = 0; i < listeners.size(); i++) { + try { + listeners.get(i).run(); + } catch (Throwable t) { + t.printStackTrace(); + } + } + } + + } + public String getXML() { + + return "\n\t\t\n"+ + "\t\t\t"+name+"\n"+ + "\t\t\t"+type+"\n"+ + "\t\t\t"+size+"\n"+ + "\t\t\t"+location.getXml()+"\t\t\t\n"+ + "\t\t\t"+getFrame().getText()+"\n"+ + "\t\t\t\n"+ + "\t\t\n" + ; + } + public static ArrayList getVitamins(Element doc) { + ArrayList locations = new ArrayList<>(); + try { + NodeList nodListofLinks = doc.getChildNodes(); + for (int i = 0; i < nodListofLinks.getLength(); i++) { + Node linkNode = nodListofLinks.item(i); + if (linkNode.getNodeType() == Node.ELEMENT_NODE && linkNode.getNodeName().contentEquals("vitamin")) { + Element e = (Element) linkNode; + locations.add(new VitaminLocation(e)); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return locations; + } + + public static String getAllXML(ArrayList list) { + + String vitamins="\n\t\n"; + for(VitaminLocation loc:list) { + vitamins+=loc.getXML(); + } + return vitamins+"\n\t\n"; + + } + public String toString() { + return getXML(); + } + + /** + * @return the name + */ + public String getName() { + + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + if (name==null) + throw new RuntimeException("Name can not be null"); + this.name = name; + fireChangeEvent(); + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(String type) { + + if (type==null) + throw new RuntimeException("type can not be null"); + this.type = type; + fireChangeEvent(); + } + + /** + * @return the size + */ + public String getSize() { + return size; + } + + /** + * @param size the size to set + */ + public void setSize(String size) { + if (size==null) + throw new RuntimeException("size can not be null"); + this.size = size; + fireChangeEvent(); + } + + /** + * @return the location + */ + public TransformNR getLocation() { + return location; + } + + /** + * @param location the location to set + */ + public void setLocation(TransformNR l) { + if(l==location) { + fireChangeEvent(); + return; + } + if (l==null) + throw new RuntimeException("location can not be null"); + if(l!=null) + l.removeChangeListener(this); + this.location = l; + location.addChangeListener(this); + fireChangeEvent(); + } + + @Override + public void event(TransformNR changed) { + fireChangeEvent(); + } + + /** + * + // the MobilBase root, or the tip of the link + DefaultFrame("default"), + // the place on the link where the previous one ends, where the shaft for the motor that turns it should be + LinkOrigin("origin"), + // The tip of the previous link. the place where the motor that turns a link would be mounted. if the first link this would be the limbs root + LastLinkTip("lastlink"); + * @return the frame + */ + public VitaminFrame getFrame() { + if(frame==null) + return VitaminFrame.DefaultFrame; + return frame; + } + + /** + // the MobilBase root, or the tip of the link + DefaultFrame("default"), + // the place on the link where the previous one ends, where the shaft for the motor that turns it should be + LinkOrigin("origin"), + // The tip of the previous link. the place where the motor that turns a link would be mounted. if the first link this would be the limbs root + LastLinkTip("lastlink"); + * @param frame the frame to set + */ + public void setFrame(VitaminFrame frame) { + if(frame==null) + throw new NullPointerException("Frame can not be null"); + this.frame = frame; + fireChangeEvent(); + + } + public boolean isScript() { + return isScript; + } + public void setScript(boolean isScript) { + this.isScript = isScript; + fireChangeEvent(); + } + +} diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WalkingDriveEngine.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WalkingDriveEngine.java index 1831b444..38574917 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WalkingDriveEngine.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WalkingDriveEngine.java @@ -6,7 +6,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class WalkingDriveEngine. */ @@ -56,15 +56,15 @@ public void DriveArc(MobileBase source, TransformNR newPose, double seconds) { try { // lift leg above home legs.get(i).setDesiredTaskSpaceTransform(home[i], seconds/10); - ThreadUtil.wait((int) (seconds*100)); + source.wait((int) (seconds*100)); //step to new target legs.get(i).setDesiredTaskSpaceTransform(feetLocations[i], seconds/10); - ThreadUtil.wait((int) (seconds*100)); + source.wait((int) (seconds*100)); //set new target for the coordinated motion step at the end feetLocations[i].translateX(newPose.getX()); feetLocations[i].translateY(newPose.getY()); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } @@ -76,7 +76,7 @@ public void DriveArc(MobileBase source, TransformNR newPose, double seconds) { try { legs.get(i).setDesiredTaskSpaceTransform(feetLocations[i], seconds); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -89,7 +89,7 @@ public void DriveArc(MobileBase source, TransformNR newPose, double seconds) { */ @Override public void DriveVelocityStraight(MobileBase source, double cmPerSecond) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -99,7 +99,7 @@ public void DriveVelocityStraight(MobileBase source, double cmPerSecond) { @Override public void DriveVelocityArc(MobileBase source, double degreesPerSecond, double cmRadius) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WheeledDriveEngine.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WheeledDriveEngine.java index f949b221..49e5089f 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WheeledDriveEngine.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/WheeledDriveEngine.java @@ -2,7 +2,7 @@ import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class WheeledDriveEngine. */ @@ -13,7 +13,7 @@ public class WheeledDriveEngine implements IDriveEngine { */ @Override public void DriveArc(MobileBase source, TransformNR newPose, double seconds) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -22,7 +22,7 @@ public void DriveArc(MobileBase source, TransformNR newPose, double seconds) { */ @Override public void DriveVelocityStraight(MobileBase source, double cmPerSecond) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -32,7 +32,7 @@ public void DriveVelocityStraight(MobileBase source, double cmPerSecond) { @Override public void DriveVelocityArc(MobileBase source, double degreesPerSecond, double cmRadius) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GCodeHeater.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GCodeHeater.java index ffbb3bd1..8499a5ba 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GCodeHeater.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GCodeHeater.java @@ -10,14 +10,14 @@ public class GCodeHeater extends AbstractLink implements IGCodeChannel { private double value =0; public GCodeHeater(LinkConfiguration conf, String gcodeAxis,GcodeDevice device) { super(conf); - // TODO Auto-generated constructor stub + // Auto-generated constructor stub this.axis = gcodeAxis; this.device = device; } @Override public void cacheTargetValueDevice() { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -38,13 +38,13 @@ public void flushAllDevice(double time) { @Override public double getCurrentPosition() { - // TODO Auto-generated method stub + // Auto-generated method stub return value; } @Override public String getAxis() { - // TODO Auto-generated method stub + // Auto-generated method stub return axis; } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeDevice.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeDevice.java index 937188b5..3b74c239 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeDevice.java @@ -133,13 +133,13 @@ public void disconnectDeviceImp() { try { outs.flush(); } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } try { outs.close(); } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -147,7 +147,7 @@ public void disconnectDeviceImp() { try { ins.close(); } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } outs=null; @@ -170,7 +170,7 @@ public boolean connectDeviceImp() { @Override public ArrayList getNamespacesImp() { - // TODO Auto-generated method stub + // Auto-generated method stub return new ArrayList(); } @SuppressWarnings("resource") @@ -183,7 +183,7 @@ private String getLine(){ ret =s.hasNext() ? s.next() : ""; } } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } return ret; @@ -200,18 +200,18 @@ public String runLine(String line) { outs.flush(); //} } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } - long start = System.currentTimeMillis(); + long start = currentTimeMillis(); String ret= ""; while(ret.contentEquals("") && - (System.currentTimeMillis()-start)>"+line); @@ -221,7 +221,7 @@ public String runLine(String line) { @Override public void runFile(File gcode) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -262,13 +262,13 @@ public void flush(double seconds) { public void loadCurrent(){ String m114 =runLine("M114"); String[] currentPosStr = m114.split("Count")[0].split(" ");// get the current position - //System.out.println("Fush with current = "+m114); + //com.neuronrobotics.sdk.common.Log.error("Fush with current = "+m114); for(String s:currentPosStr){ for(LinkConfiguration l:links.keySet()){ IGCodeChannel thisLink = links.get(l); if(s.contains(thisLink.getAxis())){ String [] parts = s.split(":"); - ///System.out.println("Found axis = "+s); + ///com.neuronrobotics.sdk.common.Log.error("Found axis = "+s); thisLink.setValue(Double.parseDouble(parts[1])); } } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodePrismatic.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodePrismatic.java index 757c70ad..f510d489 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodePrismatic.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodePrismatic.java @@ -9,7 +9,7 @@ public class GcodePrismatic extends AbstractPrismaticLink implements IGCodeChann private double value =0; public GcodePrismatic(LinkConfiguration conf, GcodeDevice device, String linkAxis) { super(conf); - // TODO Auto-generated constructor stub + // Auto-generated constructor stub this.device = device; axis=linkAxis; //loadCurrent(); diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeRotory.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeRotory.java index d096536a..289dc70e 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeRotory.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/gcodebridge/GcodeRotory.java @@ -10,7 +10,7 @@ public class GcodeRotory extends AbstractRotoryLink implements IGCodeChannel { private double value =0; public GcodeRotory(LinkConfiguration conf, GcodeDevice device, String linkAxis) { super(conf); - // TODO Auto-generated constructor stub + // Auto-generated constructor stub this.device = device; axis=linkAxis; //loadCurrent(); diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ik/DeltaIKModel.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ik/DeltaIKModel.java index 823a6f3e..5c55a71f 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ik/DeltaIKModel.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/ik/DeltaIKModel.java @@ -49,13 +49,13 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec // Start by finding the IK to the wrist center if(linkNum>=6) { //offset for tool - //if(debug)System.out.println( "Offestting for tool" + //if(debug)com.neuronrobotics.sdk.common.Log.error( "Offestting for tool" TransformNR tool = new TransformNR(); if(linkNum==7) tool=linkOffset(links.get(6)); // compute the transform from tip to wrist center TransformNR wristCenterOffsetTransform = linkOffset(links.get(5)).times(tool); - //System.out.println( wristCenterOffsetTransform + //com.neuronrobotics.sdk.common.Log.error( wristCenterOffsetTransform // take off the tool from the target to get the center of the wrist newCenter = target.times(wristCenterOffsetTransform.inverse()); } @@ -68,17 +68,17 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec // Compute the xy plane projection of the tip // this is the angle of the tipto the base link if(x==0&&y==0) { - System.out.println( "Singularity! try something else"); + com.neuronrobotics.sdk.common.Log.error( "Singularity! try something else"); return inverseKinematics6dof(target.copy().translateX(0.01),jointSpaceVector,chain); } - if(debug)System.out.println( "Wrist center for IK "+x+","+y+","+z); + if(debug)com.neuronrobotics.sdk.common.Log.error( "Wrist center for IK "+x+","+y+","+z); double baseVectorAngle = Math.toDegrees(Math.atan2(y , x)); double elbowLink1CompositeLength = length(l1Offset); double elbowLink2CompositeLength=length(l3Offset); double wristVect = length(newCenter); - if(debug)System.out.println( "elbowLink1CompositeLength "+elbowLink1CompositeLength); - if(debug)System.out.println( "elbowLink2CompositeLength "+elbowLink2CompositeLength); - if(debug)System.out.println( "Elbo Hypotinuse "+wristVect); + if(debug)com.neuronrobotics.sdk.common.Log.error( "elbowLink1CompositeLength "+elbowLink1CompositeLength); + if(debug)com.neuronrobotics.sdk.common.Log.error( "elbowLink2CompositeLength "+elbowLink2CompositeLength); + if(debug)com.neuronrobotics.sdk.common.Log.error( "Elbo Hypotinuse "+wristVect); double elbowTiltAngle =-( Math.toDegrees( Math.acos( ( @@ -90,7 +90,7 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec (2*elbowLink2CompositeLength*elbowLink1CompositeLength) ) )); - if(debug)System.out.println( "Elbow angle "+elbowTiltAngle); + if(debug)com.neuronrobotics.sdk.common.Log.error( "Elbow angle "+elbowTiltAngle); jointSpaceVector[2]=elbowTiltAngle - Math.toDegrees(links.get(2).getTheta()); TransformNR local = new TransformNR(0,0,0,new RotationNR(0, -baseVectorAngle, 0)); @@ -100,7 +100,7 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec double L1 = length(l1Offset); double L2 = length(l3Offset); - if(debug)System.out.println( "L1 "+L1+" l2 "+L2+" z "+elZ+" x "+elX); + if(debug)com.neuronrobotics.sdk.common.Log.error( "L1 "+L1+" l2 "+L2+" z "+elZ+" x "+elX); /** * System of equasions * Theta2 = asin(z/wristVect) @@ -139,10 +139,10 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec ); } TransformNR sphericalElbowTartget = reorent.times(newCenter); - //System.out.println( newCenter - //System.out.println( sphericalElbowTartget + //com.neuronrobotics.sdk.common.Log.error( newCenter + //com.neuronrobotics.sdk.common.Log.error( sphericalElbowTartget sphericalElbowTartget = new TransformNR(0.0,-sphericalElbowTartget.getY(),0.0, new RotationNR()).times(sphericalElbowTartget); - //System.out.println( sphericalElbowTartget + //com.neuronrobotics.sdk.common.Log.error( sphericalElbowTartget double theta3 = Math.atan2(sphericalElbowTartget.getZ(), sphericalElbowTartget.getX()); jointSpaceVector[1]=-Math.toDegrees(theta3) ; @@ -167,10 +167,10 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec TransformNR wristMOvedToCenter0 =startOfWristSet .inverse()// move back from base ot wrist to world home .times(virtualcenter);// move forward to target, leaving the angle between the tip and the start of the rotation - //if(debug)System.out.println( wristMOvedToCenter0 + //if(debug)com.neuronrobotics.sdk.common.Log.error( wristMOvedToCenter0 RotationNR qWrist=wristMOvedToCenter0.getRotation(); if(wristMOvedToCenter0.getX()==0&&wristMOvedToCenter0.getY()==0) { - System.out.println( "Singularity! try something else"); + com.neuronrobotics.sdk.common.Log.error( "Singularity! try something else"); return inverseKinematics6dof(target.copy().translateX(0.01),jointSpaceVector,chain); } double closest= (Math.toDegrees(Math.atan2(wristMOvedToCenter0.getY(), wristMOvedToCenter0.getX()))-Math.toDegrees(links.get(3).getTheta())); @@ -192,10 +192,10 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec TransformNR wristMOvedToCenter1 =startOfWristSet2 .inverse()// move back from base ot wrist to world home .times(virtualcenter);// move forward to target, leaving the angle between the tip and the start of the rotation - //if(debug)System.out.println( " Middle link =" +wristMOvedToCenter1 + //if(debug)com.neuronrobotics.sdk.common.Log.error( " Middle link =" +wristMOvedToCenter1 RotationNR qWrist2=wristMOvedToCenter1.getRotation(); if(wristMOvedToCenter1.getX()==0&&wristMOvedToCenter1.getY()==0) { - System.out.println( "Singularity! try something else"); + com.neuronrobotics.sdk.common.Log.error( "Singularity! try something else"); return inverseKinematics6dof(target.copy().translateX(0.01),jointSpaceVector,chain); } jointSpaceVector[4]=(Math.toDegrees(Math.atan2(wristMOvedToCenter1.getY(), wristMOvedToCenter1.getX()))- @@ -217,7 +217,7 @@ public double[] inverseKinematics6dof(TransformNR target, double[] jointSpaceVec TransformNR wristMOvedToCenter2 =startOfWristSet3 .inverse()// move back from base ot wrist to world home .times(target.times(tool.inverse()));// move forward to target, leaving the angle between the tip and the start of the rotation - //if(debug)System.out.println( "\n\nLastLink " +wristMOvedToCenter2 + //if(debug)com.neuronrobotics.sdk.common.Log.error( "\n\nLastLink " +wristMOvedToCenter2 RotationNR qWrist3=wristMOvedToCenter2.getRotation(); jointSpaceVector[5]=(Math.toDegrees(qWrist3.getRotationAzimuth())-Math.toDegrees(links.get(5).getTheta())); diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMU.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMU.java index 19fd5d02..e8686940 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMU.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMU.java @@ -2,12 +2,14 @@ import java.util.ArrayList; -public class IMU { +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; + +public class IMU extends TimeKeeper{ private ArrayList virtualListeneras = new ArrayList(); private ArrayList hardwareListeneras = new ArrayList(); - private IMUUpdate virtualState=new IMUUpdate(0.0,0.0,0.0,0.0,0.0,0.0); - private IMUUpdate hardwareState=new IMUUpdate(null,null,null,null,null,null); + private IMUUpdate virtualState=new IMUUpdate(0.0,0.0,0.0,0.0,0.0,0.0,currentTimeMillis()); + private IMUUpdate hardwareState=new IMUUpdate(null,null,null,null,null,null,currentTimeMillis()); public void addhardwareListeners(IMUUpdateListener l){ if(!hardwareListeneras.contains(l)) diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMUUpdate.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMUUpdate.java index 459fd911..539a9d46 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMUUpdate.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/imu/IMUUpdate.java @@ -1,4 +1,7 @@ package com.neuronrobotics.sdk.addons.kinematics.imu; + +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; + /** * This is a state object for the IMU * any function that returns null has no new data availible. @@ -6,6 +9,7 @@ * */ public class IMUUpdate { + private static boolean notice=true; private final Double xAcceleration; private final Double yAcceleration; private final Double zAcceleration; @@ -13,7 +17,28 @@ public class IMUUpdate { private final Double rotyAcceleration; private final Double rotzAcceleration; private long timestamp; - + /** + * Values represent current state of accelerations + * Null values means there is no update for this value + * @param xAcceleration (meters / second^2) + * @param yAcceleration (meters / second^2) + * @param zAcceleration (meters / second^2) + * @param rotxAcceleration (radian / second^2) + * @param rotyAcceleration (radian / second^2) + * @param rotzAcceleration (radian / second^2) + */ + public IMUUpdate(Double xAcceleration,Double yAcceleration,Double zAcceleration, + Double rotxAcceleration,Double rotyAcceleration,Double rotzAcceleration , long timestamp + ){ + this.xAcceleration = xAcceleration; + this.yAcceleration = yAcceleration; + this.zAcceleration = zAcceleration; + this.rotxAcceleration = rotxAcceleration; + this.rotyAcceleration = rotyAcceleration; + this.rotzAcceleration = rotzAcceleration; + this.setTimestamp(timestamp); + + } /** * Values represent current state of accelerations @@ -25,6 +50,7 @@ public class IMUUpdate { * @param rotyAcceleration (radian / second^2) * @param rotzAcceleration (radian / second^2) */ + @Deprecated public IMUUpdate(Double xAcceleration,Double yAcceleration,Double zAcceleration, Double rotxAcceleration,Double rotyAcceleration,Double rotzAcceleration ){ @@ -34,7 +60,11 @@ public IMUUpdate(Double xAcceleration,Double yAcceleration,Double zAcceleration, this.rotxAcceleration = rotxAcceleration; this.rotyAcceleration = rotyAcceleration; this.rotzAcceleration = rotzAcceleration; - this.setTimestamp(System.currentTimeMillis()); + if(notice) { + notice=false; + new RuntimeException("This constructor is depricated, please provide a timestamp").printStackTrace(System.out); + } + this.setTimestamp(TimeKeeper.getMostRecent().currentTimeMillis()); } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/EulerAxis.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/EulerAxis.java new file mode 100644 index 00000000..4bea9e3a --- /dev/null +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/EulerAxis.java @@ -0,0 +1,7 @@ +package com.neuronrobotics.sdk.addons.kinematics.math; + +public enum EulerAxis { + tilt, + azimuth, + elevation; +} diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNR.java index 8de27039..4c1cd562 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNR.java @@ -7,9 +7,10 @@ import org.apache.commons.math3.geometry.euclidean.threed.RotationConvention; import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder; +import com.google.gson.annotations.Expose; import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class is to represent a 3x3 rotation sub-matrix This class also contains * static methods for dealing with 3x3 rotations. @@ -22,8 +23,19 @@ public class RotationNR { /** The rotation matrix. */ // double[][] rotationMatrix = ; - private Rotation storage = new Rotation(1, 0, 0, 0, false); + +@Expose (serialize = true, deserialize = true) + double w=1; +@Expose (serialize = true, deserialize = true) + double x=0; +@Expose (serialize = true, deserialize = true) + double y=0; +@Expose (serialize = true, deserialize = true) + double z=0; + //private Rotation storage = new Rotation(1, 0, 0, 0, false); +@Expose (serialize = false, deserialize = false) private static RotationOrder order = RotationOrder.ZYX; +@Expose (serialize = false, deserialize = false) private static RotationConvention convention = RotationConvention.VECTOR_OPERATOR; @@ -42,39 +54,42 @@ public RotationNR() { * instance */ public RotationNR(Rotation store) { - storage = store; + setStorage(store); } /** * Instantiates a new rotation nr. * ** @param tilt - * the tilt - * @param azumeth - * the azumeth + * the tilt in Degrees + * @param azimuth + * the azimuth in Degrees * @param elevation - * the elevation + * the elevation in Degrees */ // create a new object with the given simplified rotations - public RotationNR(double tilt, double azumeth, double elevation) { - if (Double.isNaN(tilt)) - throw new RuntimeException("Value can not be NaN"); - if (Double.isNaN(azumeth)) - throw new RuntimeException("Value can not be NaN"); - if (Double.isNaN(elevation)) - throw new RuntimeException("Value can not be NaN"); + public RotationNR(double tilt, double azimuth, double elevation) { + if (!Double.isFinite(tilt)) + throw new RuntimeException("Value can not be "+tilt); + if (!Double.isFinite(azimuth)) + throw new RuntimeException("Value can not be "+azimuth); + if (!Double.isFinite(elevation)) + throw new RuntimeException("Value can not be "+elevation); if (elevation > 90 || elevation < -90) { throw new RuntimeException("Elevation can not be greater than 90 nor less than -90"); } - loadFromAngles(tilt, azumeth, elevation); + loadFromAngles(tilt, azimuth, elevation); if (Double.isNaN(getRotationMatrix2QuaturnionW()) || Double.isNaN(getRotationMatrix2QuaturnionX()) || Double.isNaN(getRotationMatrix2QuaturnionY()) || Double.isNaN(getRotationMatrix2QuaturnionZ())) { Log.error("Failing to set proper angle, jittering"); - loadFromAngles(tilt + Math.random() * .02 + .001, azumeth + Math.random() * .02 + .001, + loadFromAngles(tilt + Math.random() * .02 + .001, azimuth + Math.random() * .02 + .001, elevation + Math.random() * .02 + .001); } } + public RotationNR(EulerAxis axis, double rot) { + this(axis==EulerAxis.tilt?rot:0,axis==EulerAxis.azimuth?rot:0,axis==EulerAxis.elevation?rot:0); + } /** * Instantiates a new rotation nr. @@ -297,7 +312,10 @@ protected void quaternion2RotationMatrix(double w, double x, double y, double z) throw new RuntimeException("Value can not be NaN"); if (Double.isNaN(z)) throw new RuntimeException("Value can not be NaN"); - setStorage(new Rotation(w,- x, -y, -z, true)); + this.w=w; + this.x= -x; + this.y= -y; + this.z= -z; } /** @@ -315,37 +333,95 @@ public static boolean bound(double low, double high, double n) { return n >= low && n <= high; } - private void loadFromAngles(double tilt, double azumeth, double elevation) { - setStorage(new Rotation(getOrder(), getConvention(), Math.toRadians(azumeth), Math.toRadians(elevation), + private void loadFromAngles(double tilt, double azimuth, double elevation) { + setStorage(new Rotation(getOrder(), getConvention(), Math.toRadians(azimuth), Math.toRadians(elevation), Math.toRadians(tilt))); } + /** + * Gets the rotation tilt. + * + * @return the rotation tilt in radians + */ + public double getRotationTiltRadians() { + return getAngle(2); + } + + /** + * Gets the rotation elevation. + * + * @return the rotation elevation in radians + */ + public double getRotationElevationRadians() { + return getAngle(1); + + } + + /** + * Gets the rotation azimuth. + * + * @return the rotation azimuth in radians + */ + + public double getRotationAzimuthRadians() { + return getAngle(0); + } + /** + * Gets the rotation tilt. + * + * @return the rotation tilt in degrees + */ + public double getRotationTiltDegrees() { + return Math.toDegrees(getRotationTiltRadians()); + } + + /** + * Gets the rotation elevation. + * + * @return the rotation elevation in degrees + */ + public double getRotationElevationDegrees() { + return Math.toDegrees(getRotationElevationRadians()); + + } + /** + * Gets the rotation azimuth. + * + * @return the rotation azimuth in degrees + */ + + public double getRotationAzimuthDegrees() { + return Math.toDegrees( getRotationAzimuthRadians()); + } /** * Gets the rotation tilt. * - * @return the rotation tilt + * @return the rotation tilt in radians */ + @Deprecated public double getRotationTilt() { - return getAngle(2); + return getRotationTiltRadians(); } /** * Gets the rotation elevation. * - * @return the rotation elevation + * @return the rotation elevation in radians */ + @Deprecated public double getRotationElevation() { - return getAngle(1); + return getRotationElevationRadians(); } /** * Gets the rotation azimuth. * - * @return the rotation azimuth + * @return the rotation azimuth in radians */ + @Deprecated public double getRotationAzimuth() { - return getAngle(0); + return getRotationAzimuthRadians(); } private void simpilfyAngles(double [] angles){ double epsilon=1.0E-7; @@ -372,9 +448,9 @@ private double getAngle(int index){ return getStorage().getAngles(getOrder(), getConvention())[index]; } catch (CardanEulerSingularityException e) { try { - return eulerFix( Math.toRadians(5), index); + return eulerFix( Math.toRadians(0.001), index); } catch (CardanEulerSingularityException ex) { - return eulerFix( Math.toRadians(-5), index); + return eulerFix( Math.toRadians(-0.001), index); } } @@ -387,7 +463,7 @@ private double getAngle(int index){ * @return the rotation matrix2 quaturnion w */ public double getRotationMatrix2QuaturnionW() { - return getStorage().getQ0(); + return w; } /** @@ -396,7 +472,7 @@ public double getRotationMatrix2QuaturnionW() { * @return the rotation matrix2 quaturnion x */ public double getRotationMatrix2QuaturnionX() { - return -getStorage().getQ1(); + return -x; } /** @@ -405,7 +481,7 @@ public double getRotationMatrix2QuaturnionX() { * @return the rotation matrix2 quaturnion y */ public double getRotationMatrix2QuaturnionY() { - return -getStorage().getQ2(); + return -y; } /** @@ -414,7 +490,7 @@ public double getRotationMatrix2QuaturnionY() { * @return the rotation matrix2 quaturnion z */ public double getRotationMatrix2QuaturnionZ() { - return -getStorage().getQ3(); + return -z; } public static RotationOrder getOrder() { @@ -433,12 +509,15 @@ public static void setConvention(RotationConvention convention) { RotationNR.convention = convention; } - public Rotation getStorage() { - return storage; + private Rotation getStorage() { + return new Rotation(w,x,y,z,false); } - public void setStorage(Rotation storage) { - this.storage = storage; + private void setStorage(Rotation storage) { + w=storage.getQ0(); + x=storage.getQ1(); + y=storage.getQ2(); + z=storage.getQ3(); } public void set(double[][] poseRot) { diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNRLegacy.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNRLegacy.java index d4f15caf..c159a582 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNRLegacy.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/RotationNRLegacy.java @@ -4,7 +4,7 @@ import Jama.Matrix; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class is to represent a 3x3 rotation sub-matrix This class also contains * static methods for dealing with 3x3 rotations. @@ -47,7 +47,7 @@ public RotationNRLegacy(double tilt, double elevation, double azumeth) { loadFromAngles(tilt, azumeth, elevation); if (Double.isNaN(getRotationMatrix2QuaturnionW()) || Double.isNaN(getRotationMatrix2QuaturnionX()) || Double.isNaN(getRotationMatrix2QuaturnionY()) || Double.isNaN(getRotationMatrix2QuaturnionZ())) { - // System.err.println("Failing to set proper angle, jittering"); + // com.neuronrobotics.sdk.common.Log.error("Failing to set proper angle, jittering"); loadFromAngles(tilt + Math.random() * .02 + .001, azumeth + Math.random() * .02 + .001, elevation + Math.random() * .02 + .001); } @@ -70,13 +70,13 @@ private void loadFromAngles(double tilt, double azumeth, double elevation) { double s3 = Math.sin(bank / 2); double c1c2 = c1 * c2; double s1s2 = s1 * s2; - // System.out.println("C1 ="+c1+" S1 ="+s1+" |C2 ="+c2+" S2 ="+s2+" |C3 + // com.neuronrobotics.sdk.common.Log.error("C1 ="+c1+" S1 ="+s1+" |C2 ="+c2+" S2 ="+s2+" |C3 // ="+c3+" S3 ="+s3); w = c1c2 * c3 - s1s2 * s3; x = c1c2 * s3 + s1s2 * c3; y = s1 * c2 * c3 + c1 * s2 * s3; z = c1 * s2 * c3 - s1 * c2 * s3; - // System.out.println("W ="+w+" x ="+x+" y ="+y+" z ="+z); + // com.neuronrobotics.sdk.common.Log.error("W ="+w+" x ="+x+" y ="+y+" z ="+z); quaternion2RotationMatrix(w, x, y, z); } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/TransformNR.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/TransformNR.java index b65be370..8406eecf 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/TransformNR.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/math/TransformNR.java @@ -3,25 +3,33 @@ import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.ArrayList; + +import com.google.gson.annotations.Expose; import com.neuronrobotics.sdk.common.Log; import Jama.Matrix; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class TransformNR. */ public class TransformNR { +@Expose (serialize = false, deserialize = false) private ArrayList listeners=null; /** The x. */ +@Expose (serialize = true, deserialize = true) private double x; /** The y. */ +@Expose (serialize = true, deserialize = true) private double y; /** The z. */ +@Expose (serialize = true, deserialize = true) private double z; /** The rotation. */ + +@Expose (serialize = true, deserialize = true) private RotationNR rotation; @@ -37,6 +45,14 @@ public TransformNR(Matrix m) { this.setZ(m.get(2, 3)); this.setRotation(new RotationNR(m)); } + /** + * Instantiates a new transform nr. + * + * @param m the m + */ + public TransformNR(TransformNR in) { + this(in.getMatrixTransform()); + } /** * Instantiates a new transform nr. @@ -97,7 +113,31 @@ public TransformNR(double x, double y, double z, RotationNR q) { this.setZ(z); this.setRotation(q); } - + /** + * Instantiates a new transform nr. + * + * @param x the x + * @param y the y + * @param z the z + * @param q the q + */ + public TransformNR(double x, double y, double z) { + this.setX(x); + this.setY(y); + this.setZ(z); + this.setRotation(new RotationNR()); + } + /** + * Instantiates a new transform nr. + * + * @param rot A pure rotation + */ + public TransformNR(RotationNR rot) { + this.setX(0); + this.setY(0); + this.setZ(0); + this.setRotation(rot); + } /** * Instantiates a new transform nr. * @@ -210,6 +250,23 @@ public String toString() { return "Transform error" + ex.getLocalizedMessage(); } } + public String toSimpleString() { + return toPositionString()+" "+toAngleString(); + } + public String toPositionString() { + DecimalFormat decimalFormat = new DecimalFormat("000.00"); + + return "x="+decimalFormat.format(x)+" "+ + "y="+decimalFormat.format(y)+" "+ + "z="+decimalFormat.format(z); + } + public String toAngleString() { + DecimalFormat decimalFormat = new DecimalFormat("000.00"); + + return "az="+decimalFormat.format(Math.toDegrees(getRotation().getRotationAzimuth()))+" "+ + "el="+decimalFormat.format(Math.toDegrees(getRotation().getRotationElevation()))+" "+ + "tl="+decimalFormat.format(Math.toDegrees(getRotation().getRotationTilt())); + } /** * Gets the matrix string. @@ -392,13 +449,13 @@ public TransformNR translateZ(double translation) { } public TransformNR set(double tx, double ty, double tz, double[][] poseRot) { - if (Double.isNaN(tx)) + if (!Double.isFinite(tx)) throw new RuntimeException("Value can not be NaN"); x = tx; - if (Double.isNaN(ty)) + if (!Double.isFinite(ty)) throw new RuntimeException("Value can not be NaN"); y = ty; - if (Double.isNaN(tz)) + if (!Double.isFinite(tz)) throw new RuntimeException("Value can not be NaN"); z = tz; getRotation().set(poseRot); @@ -412,7 +469,7 @@ public TransformNR set(double tx, double ty, double tz, double[][] poseRot) { * @param tx the new x */ public TransformNR setX(double tx) { - if (Double.isNaN(tx)) + if (!Double.isFinite(tx)) throw new RuntimeException("Value can not be NaN"); x = tx; fireChangeEvent(); @@ -425,7 +482,7 @@ public TransformNR setX(double tx) { * @param ty the new y */ public TransformNR setY(double ty) { - if (Double.isNaN(ty)) + if (!Double.isFinite(ty)) throw new RuntimeException("Value can not be NaN"); y = ty; fireChangeEvent(); @@ -438,7 +495,7 @@ public TransformNR setY(double ty) { * @param tz the new z */ public TransformNR setZ(double tz) { - if (Double.isNaN(tz)) + if (!Double.isFinite(tz)) throw new RuntimeException("Value can not be NaN"); z = tz; fireChangeEvent(); @@ -456,18 +513,18 @@ public TransformNR setZ(double tz) { */ public String getXml() { String xml = - "\t" + getX() + "\n" + "\t" + getY() + "\n" + "\t" + getZ() + "\n"; - if (Double.isNaN(getRotation().getRotationMatrix2QuaturnionW()) - || Double.isNaN(getRotation().getRotationMatrix2QuaturnionX()) - || Double.isNaN(getRotation().getRotationMatrix2QuaturnionY()) - || Double.isNaN(getRotation().getRotationMatrix2QuaturnionZ())) { + "\n\t" + getX() + "\n" + "\t" + getY() + "\n" + "\t" + getZ() + "\n"; + if (!Double.isFinite(getRotation().getRotationMatrix2QuaturnionW()) + || !Double.isFinite(getRotation().getRotationMatrix2QuaturnionX()) + || !Double.isFinite(getRotation().getRotationMatrix2QuaturnionY()) + || !Double.isFinite(getRotation().getRotationMatrix2QuaturnionZ())) { xml += "\n\t\n"; setRotation(new RotationNR()); } xml += "\t" + getRotation().getRotationMatrix2QuaturnionW() + "\n" + "\t" + getRotation().getRotationMatrix2QuaturnionX() + "\n" + "\t" + getRotation().getRotationMatrix2QuaturnionY() + "\n" + "\t" - + getRotation().getRotationMatrix2QuaturnionZ() + ""; + + getRotation().getRotationMatrix2QuaturnionZ() + "\n"; return xml; } diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/parallel/ParallelGroup.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/parallel/ParallelGroup.java index 2db1dda4..8a54f3b0 100644 --- a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/parallel/ParallelGroup.java +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/parallel/ParallelGroup.java @@ -90,7 +90,7 @@ public void setupReferencedLimbStartup(DHParameterKinematics limb, TransformNR t tipOffsetRelativeToName.put(limb, name); tipOffsetRelativeIndex.put(limb, index); getTipOffset().put(limb, tip); - System.out.println("Limb "+limb.getScriptingName()+" set relative to "+name); + com.neuronrobotics.sdk.common.Log.error("Limb "+limb.getScriptingName()+" set relative to "+name); } else { clearReferencedLimb(limb); DHParameterKinematics fk=getFKLimb(); @@ -106,13 +106,13 @@ public void setupReferencedLimbStartup(DHParameterKinematics limb, TransformNR t // for (DHParameterKinematics d : getConstituantLimbs()) { // if (getTipOffset(d) != null) { // try { -// //System.out.println("Setting Kinematics for follower "+d.getScriptingName()); +// //com.neuronrobotics.sdk.common.Log.error("Setting Kinematics for follower "+d.getScriptingName()); // double[] jointSpaceVect = compute(d, IKvalues, pose); -// //System.out.println(fk.getScriptingName()+" is Setting sublimb target "+d.getScriptingName()); +// //com.neuronrobotics.sdk.common.Log.error(fk.getScriptingName()+" is Setting sublimb target "+d.getScriptingName()); // d.throwExceptionOnJointLimit(false); // d.setDesiredJointSpaceVector(jointSpaceVect, 0); // } catch (Exception e) { -// // TODO Auto-generated catch block +// // Auto-generated catch block // e.printStackTrace(); // } // } @@ -131,7 +131,7 @@ public void clearReferencedLimb(DHParameterKinematics limb) { @Override public void disconnectDevice() { - // TODO Auto-generated method stub + // Auto-generated method stub for (DHParameterKinematics l : getConstituantLimbs()) { l.disconnect(); } @@ -141,7 +141,7 @@ public void disconnectDevice() { @Override public boolean connectDevice() { - // TODO Auto-generated method stub + // Auto-generated method stub return true; } @@ -149,7 +149,7 @@ private double[] compute(DHParameterKinematics ldh, HashMap IK TransformNR taskSpaceTransform) throws Exception { String scriptingName = ldh.getScriptingName(); if (IKvalues.get(scriptingName) == null) { - //System.out.println("Perform IK "+ldh.getScriptingName()); + //com.neuronrobotics.sdk.common.Log.error("Perform IK "+ldh.getScriptingName()); if (getTipOffset().get(ldh) == null) { // no offset, compute as normal double[] jointSpaceVect = ldh.inverseKinematics(ldh.inverseOffset(taskSpaceTransform)); @@ -180,7 +180,7 @@ private DHParameterKinematics findReferencedLimb(String refLimbName) { // FOund the referenced limb referencedLimb = lm; }else { - //System.out.println("Searching for "+refLimbName+" no match with "+lm.getScriptingName()); + //com.neuronrobotics.sdk.common.Log.error("Searching for "+refLimbName+" no match with "+lm.getScriptingName()); } } return referencedLimb; @@ -195,11 +195,11 @@ private DHParameterKinematics findReferencedLimb(String refLimbName) { public void setCurrentPoseTarget(TransformNR currentPoseTarget) { if (checkTaskSpaceTransform(currentPoseTarget)) { super.setCurrentPoseTarget(currentPoseTarget); - //System.out.println("Paralell set to " + currentPoseTarget); + //com.neuronrobotics.sdk.common.Log.error("Paralell set to " + currentPoseTarget); } } public double[] getCurrentJointSpaceVector(DHParameterKinematics k) { - // TODO Auto-generated method stub + // Auto-generated method stub return null; } @Override @@ -227,7 +227,7 @@ public double[] inverseKinematics(TransformNR taskSpaceTransform) throws Excepti } public void printError(TransformNR taskSpaceTransform) throws Exception { printError(taskSpaceTransform,t -> { - System.out.println(t); + com.neuronrobotics.sdk.common.Log.error(t); }); } public void printError(TransformNR taskSpaceTransform, Consumer printer) throws Exception { diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/time/ITimeProvider.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/time/ITimeProvider.java new file mode 100644 index 00000000..f3ae9a22 --- /dev/null +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/time/ITimeProvider.java @@ -0,0 +1,14 @@ +package com.neuronrobotics.sdk.addons.kinematics.time; + +public interface ITimeProvider { + //default public final long timestamp = System.currentTimeMillis(); + default long currentTimeMillis() { + return System.currentTimeMillis(); + } + default void sleep(long time) throws InterruptedException { + Thread.sleep(time); + } + default void sleep(long ms,int ns) throws InterruptedException { + Thread.sleep(ms,ns); + } +} diff --git a/src/main/java/com/neuronrobotics/sdk/addons/kinematics/time/TimeKeeper.java b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/time/TimeKeeper.java new file mode 100644 index 00000000..d527edc5 --- /dev/null +++ b/src/main/java/com/neuronrobotics/sdk/addons/kinematics/time/TimeKeeper.java @@ -0,0 +1,87 @@ +package com.neuronrobotics.sdk.addons.kinematics.time; + +import java.util.ArrayList; + + +public class TimeKeeper { + private static ITimeProvider mostRecent; + private ArrayList timebaseChangeListener =new ArrayList<>(); + + private ITimeProvider clock = new ITimeProvider() {}; + public void setTimeProvider(ITimeProvider t) { + if(t==null) + t= new ITimeProvider() {}; + clock = t; + setMostRecent(clock); + for(int i=0;i lines, NRBootCoreType type) throws IOEx if (l.getRecordType()==4){ byte[] haddr=l.getDataBytes(); highAddress = ByteList.convertToInt(haddr, false)*65536; - ////System.out.println("High Address :" + highAddress); + ////com.neuronrobotics.sdk.common.Log.error("High Address :" + highAddress); } if (l.getRecordType()==0){ l.setHighAddress(highAddress); - ////System.out.println(l); + ////com.neuronrobotics.sdk.common.Log.error(l); currentAddress=l.getStartAddress(); checkAddressValidity(currentAddress,type); diff --git a/src/main/java/com/neuronrobotics/sdk/bootloader/NRBoot.java b/src/main/java/com/neuronrobotics/sdk/bootloader/NRBoot.java index e3d4569b..6bbe8fec 100644 --- a/src/main/java/com/neuronrobotics/sdk/bootloader/NRBoot.java +++ b/src/main/java/com/neuronrobotics/sdk/bootloader/NRBoot.java @@ -10,7 +10,7 @@ import com.neuronrobotics.sdk.common.BowlerAbstractDevice; import com.neuronrobotics.sdk.serial.SerialConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class NRBoot. */ @@ -42,7 +42,7 @@ public NRBoot(BowlerAbstractDevice pm){ //JOptionPane.showMessageDialog(null, message, message, JOptionPane.ERROR_MESSAGE); throw e; } - //System.out.println("Connection to bowler device ready"); + //com.neuronrobotics.sdk.common.Log.error("Connection to bowler device ready"); } /** @@ -54,10 +54,10 @@ public NRBoot(String serialPort){ this.boot=new NRBootLoader(new SerialConnection(serialPort)); boot.connect(); if (boot.ping()){ - //System.out.println("Connection to bowler device ready"); + //com.neuronrobotics.sdk.common.Log.error("Connection to bowler device ready"); return; } - //System.out.println("Not a Bowler Device"); + //com.neuronrobotics.sdk.common.Log.error("Not a Bowler Device"); boot.disconnect(); boot=null; } @@ -72,12 +72,12 @@ public boolean load(Core core) { String id = getDevice().getBootloaderID(); if (id==null){ - System.err.println("Device is not a bootloader"); + com.neuronrobotics.sdk.common.Log.error("Device is not a bootloader"); return false; }else if (id.contains(core.getType().getReadableName())) { - //System.out.println("Bootloader ID:"+core.getType().getReadableName()); + //com.neuronrobotics.sdk.common.Log.error("Bootloader ID:"+core.getType().getReadableName()); }else{ - System.err.println("##core is Invalid##\nExpected:"+core.getType().getReadableName()+" got: "+id); + com.neuronrobotics.sdk.common.Log.error("##core is Invalid##\nExpected:"+core.getType().getReadableName()+" got: "+id); return false; } @@ -110,13 +110,13 @@ private IntelHexParser getParser(Core core) { */ private void send(IntelHexParser parse,int core){ boot.erase(core); - //System.out.println("Writing to flash"); + //com.neuronrobotics.sdk.common.Log.error("Writing to flash"); int printLine=0; ByteData line = parse.getNext(); while (line != null){ if(!boot.write(core, line)){ - //System.out.println("Failed to write, is the device in bootloader mode?"); + //com.neuronrobotics.sdk.common.Log.error("Failed to write, is the device in bootloader mode?"); return; } @@ -225,7 +225,7 @@ public void run() { * @return the progress max */ public int getProgressMax() { - // TODO Auto-generated method stub + // Auto-generated method stub return progressMax; } diff --git a/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootCoreType.java b/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootCoreType.java index 5389fcab..5a83839b 100644 --- a/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootCoreType.java +++ b/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootCoreType.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.bootloader; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum NRBootCoreType. */ diff --git a/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootLoader.java b/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootLoader.java index ba868781..15912f3a 100644 --- a/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootLoader.java +++ b/src/main/java/com/neuronrobotics/sdk/bootloader/NRBootLoader.java @@ -15,7 +15,7 @@ import com.neuronrobotics.sdk.common.BowlerDatagramFactory; import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class NRBootLoader. * @@ -44,11 +44,11 @@ public NRBootLoader(BowlerAbstractConnection serialConnection) { @Override public boolean connect() { if(super.connect()) { - //System.out.println("Connect OK"); + //com.neuronrobotics.sdk.common.Log.error("Connect OK"); try { getBootloaderID(); }catch (Exception e) { - //System.out.println("Failed bootloader test"); + //com.neuronrobotics.sdk.common.Log.error("Failed bootloader test"); disconnect(); } } @@ -95,7 +95,7 @@ public boolean write(int core, ByteData flashData){ return true; } } - System.err.println("\nFailed to send 10 times!\n"); + com.neuronrobotics.sdk.common.Log.error("\nFailed to send 10 times!\n"); return false; } @@ -121,7 +121,7 @@ public void reset(){ getConnection().sendAsync(bd); getConnection().getDataOuts().flush(); } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } disconnect(); @@ -131,15 +131,15 @@ public void reset(){ * @see com.neuronrobotics.sdk.common.IBowlerDatagramListener#onAllResponse(com.neuronrobotics.sdk.common.BowlerDatagram) */ public void onAllResponse(BowlerDatagram data) { - // TODO Auto-generated method stub - ////System.out.println(data); + // Auto-generated method stub + ////com.neuronrobotics.sdk.common.Log.error(data); } /* (non-Javadoc) * @see com.neuronrobotics.sdk.common.IBowlerDatagramListener#onAsyncResponse(com.neuronrobotics.sdk.common.BowlerDatagram) */ public void onAsyncResponse(BowlerDatagram data) { - // TODO Auto-generated method stub + // Auto-generated method stub } } diff --git a/src/main/java/com/neuronrobotics/sdk/bootloader/hexLine.java b/src/main/java/com/neuronrobotics/sdk/bootloader/hexLine.java index 68df3bf7..80ca8289 100644 --- a/src/main/java/com/neuronrobotics/sdk/bootloader/hexLine.java +++ b/src/main/java/com/neuronrobotics/sdk/bootloader/hexLine.java @@ -3,7 +3,7 @@ //import java.util.Queue; import java.util.ArrayList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class hexLine. */ diff --git a/src/main/java/com/neuronrobotics/sdk/bowlercam/device/BowlerCamDevice.java b/src/main/java/com/neuronrobotics/sdk/bowlercam/device/BowlerCamDevice.java index 4c50a85a..f80338ed 100644 --- a/src/main/java/com/neuronrobotics/sdk/bowlercam/device/BowlerCamDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/bowlercam/device/BowlerCamDevice.java @@ -21,7 +21,7 @@ import com.neuronrobotics.sdk.common.Log; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerCamDevice. */ @@ -76,7 +76,7 @@ private void fireIWebcamImageListenerEvent(int camera,BufferedImage im){ * @see com.neuronrobotics.sdk.common.BowlerAbstractDevice#onAllResponse(com.neuronrobotics.sdk.common.BowlerDatagram) */ public void onAllResponse(BowlerDatagram data) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -89,7 +89,7 @@ public void onAllResponse(BowlerDatagram data) { * @throws IOException Signals that an I/O exception has occurred. */ public BufferedImage getHighSpeedImage(int cam) throws MalformedURLException, IOException { - //System.out.println("Getting HighSpeedImage"); + //com.neuronrobotics.sdk.common.Log.error("Getting HighSpeedImage"); while(urls.size()<(cam+1) && isAvailable()){ Log.info("Adding dummy url: "+urls.size()); urls.add(null); @@ -99,16 +99,16 @@ public BufferedImage getHighSpeedImage(int cam) throws MalformedURLException, IO images.add(null); } if(urls.get(cam) == null){ - //System.out.println("URL List element is empty: "+urls); + //com.neuronrobotics.sdk.common.Log.error("URL List element is empty: "+urls); urls.set(cam,getImageServerURL(cam)); } try { - //System.out.println("Reading: "+urls.get(cam) ); + //com.neuronrobotics.sdk.common.Log.error("Reading: "+urls.get(cam) ); ImageReader ir = new ImageReader(cam); ir.start(); - long start = System.currentTimeMillis(); - while(((System.currentTimeMillis()-start)<200) && ir.isDone()==false){ - ThreadUtil.wait(5); + long start = currentTimeMillis(); + while(((currentTimeMillis()-start)<200) && ir.isDone()==false){ + wait(5); } if(!ir.isDone()) Log.error("Image read timed out"); @@ -175,14 +175,14 @@ public void onAsyncResponse(BowlerDatagram data) { tmp.add(imgData); } if(index == (total)){ - ////System.out.println("Making image"); + ////com.neuronrobotics.sdk.common.Log.error("Making image"); BufferedImage image=null; try { synchronized(tmp) { image = ByteArrayToImage(tmp.getBytes()); } } catch (IOException e1) { - // TODO Auto-generated catch block + // Auto-generated catch block e1.printStackTrace(); image=null; } @@ -191,7 +191,7 @@ public void onAsyncResponse(BowlerDatagram data) { } images.set(camera, image); fireIWebcamImageListenerEvent(camera,images.get(camera)); - //System.out.println("Image OK"); + //com.neuronrobotics.sdk.common.Log.error("Image OK"); } } @@ -304,9 +304,9 @@ public ArrayList getBlobs(){ send(new BlobCommand()); while(gotLastMark == false && isAvailable()){ try { - Thread.sleep(10); + sleep(10); } catch (InterruptedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -345,41 +345,41 @@ public highSpeedAutoCapture(int cam,double scale,int fps){ return; } mspf = (int)(1000.0/((double)fps)); - //System.out.println("MS/frame: "+mspf); + //com.neuronrobotics.sdk.common.Log.error("MS/frame: "+mspf); } /* (non-Javadoc) * @see java.lang.Thread#run() */ public void run() { - //System.out.println("Starting auto capture on: "+getImageServerURL(cam)); - long st = System.currentTimeMillis(); + //com.neuronrobotics.sdk.common.Log.error("Starting auto capture on: "+getImageServerURL(cam)); + long st = currentTimeMillis(); while(running && isAvailable()) { - //System.out.println("Getting image from: "+getImageServerURL(cam)); + //com.neuronrobotics.sdk.common.Log.error("Getting image from: "+getImageServerURL(cam)); try { - //System.out.println("Capturing"); + //com.neuronrobotics.sdk.common.Log.error("Capturing"); BufferedImage im =getHighSpeedImage(cam); if(scale>1.01||scale<.99) im = resize(im, scale); if(im!=null){ - //System.out.println("Fireing"); + //com.neuronrobotics.sdk.common.Log.error("Fireing"); fireIWebcamImageListenerEvent(cam,im); } - //System.out.println("ok"); + //com.neuronrobotics.sdk.common.Log.error("ok"); } catch (Exception e) { e.printStackTrace(); } if(mspf != 0) { - long diff = System.currentTimeMillis() - st; + long diff = currentTimeMillis() - st; ////System.out.print("\nMS diff: "+diff); if(diff getNamespaces(MACAddress addr){ if(tmpNs.length() == namespacePacket.getData().size()){ //Done with the packet BowlerDatagramFactory.freePacket(namespacePacket); - //System.out.println("Ns = "+tmpNs+" len = "+tmpNs.length()+" data = "+b.getData().size()); + //com.neuronrobotics.sdk.common.Log.error("Ns = "+tmpNs+" len = "+tmpNs.length()+" data = "+b.getData().size()); namespacePacket = send(new NamespaceCommand(),addr,5); num= namespacePacket.getData().getByte(0); @@ -995,7 +995,7 @@ public ArrayList getRpcList(String namespace,MACAddress addr) BowlerDatagram b = send(new RpcCommand(namespaceIndex),addr,5); if(!b.getRPC().contains("_rpc")){ - System.err.println(b); + com.neuronrobotics.sdk.common.Log.error(b); throw new RuntimeException("This RPC index request has failed"); } //int ns = b.getData().getByte(0);// gets the index of the namespace @@ -1017,7 +1017,7 @@ public ArrayList getRpcList(String namespace,MACAddress addr) for (int i=0;i getRpcList(String namespace,MACAddress addr) BowlerDatagramFactory.freePacket(b); b = send(new RpcArgumentsCommand(namespaceIndex,i),addr,5); if(!b.getRPC().contains("args")){ - System.err.println(b); + com.neuronrobotics.sdk.common.Log.error(b); throw new RuntimeException("This RPC section failed"); } byte []data = b.getData().getBytes(2); @@ -1096,7 +1096,7 @@ public BowlerDatagram send(BowlerAbstractCommand command,MACAddress addr, int re BowlerDatagram ret; try{ ret = send( command,addr,switchParser); - //System.out.println(ret); + //com.neuronrobotics.sdk.common.Log.error(ret); if(ret != null){ addr.setValues(ret.getAddress()); //if(!ret.getRPC().contains("_err")) @@ -1249,7 +1249,7 @@ public void stopHeartBeat(){ */ private void runHeartBeat(){ if((msSinceLastSend())>heartBeatTime){ - //System.out.println("Heartbeat"); + //com.neuronrobotics.sdk.common.Log.error("Heartbeat"); try{ if(!ping(new MACAddress())){ Log.debug("Ping failed, disconnecting"); @@ -1549,7 +1549,7 @@ public void write(byte[] data) throws IOException { while(outgoing.size()>0){ byte[] b =outgoing.popList(getChunkSize()); - //System.out.println("Writing "+new ByteList(data)); + //com.neuronrobotics.sdk.common.Log.error("Writing "+new ByteList(data)); getDataOuts().write( b ); getDataOuts().flush(); } diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerAbstractDevice.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerAbstractDevice.java index 9bc6452b..b3a0af35 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerAbstractDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerAbstractDevice.java @@ -33,10 +33,11 @@ import java.util.ArrayList; +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; import com.neuronrobotics.sdk.commands.bcs.core.PingCommand; import com.neuronrobotics.sdk.commands.neuronrobotics.dyio.InfoFirmwareRevisionCommand; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * AbstractDevices are used to model devices that are connected to the Bowler network. AbstractDevice * implementations should encapsulate command generation and provide higher-level actions to users. @@ -44,7 +45,7 @@ * @author rbreznak * */ -public abstract class BowlerAbstractDevice implements IBowlerDatagramListener { +public abstract class BowlerAbstractDevice extends TimeKeeper implements IBowlerDatagramListener { /** The keep alive. */ private boolean keepAlive = true; @@ -109,7 +110,7 @@ public void addConnectionEventListener(final IDeviceConnectionEventListener l ) if(!getDisconnectListeners().contains(l)) { getDisconnectListeners().add(l); } -// System.err.println(getScriptingName()+" Adding listener "+l.getClass()); +// com.neuronrobotics.sdk.common.Log.error(getScriptingName()+" Adding listener "+l.getClass()); // l.trace.printStackTrace(); // new Exception().printStackTrace(); BowlerAbstractDevice bad = this; @@ -124,7 +125,7 @@ public void onDisconnect(BowlerAbstractConnection source) { @Override public void onConnect(BowlerAbstractConnection source) { - // TODO Auto-generated method stub + // Auto-generated method stub l.onConnect(bad); } }); @@ -166,7 +167,7 @@ public void onDisconnect(BowlerAbstractConnection source) { @Override public void onConnect(BowlerAbstractConnection source) { - // TODO Auto-generated method stub + // Auto-generated method stub getDisconnectListeners().get(index).onConnect(bad); } }); @@ -238,7 +239,7 @@ public void setAddress(MACAddress address) { * @return the device's address */ public MACAddress getAddress() { - //System.out.println(); + //com.neuronrobotics.sdk.common.Log.error(); return address; } @@ -426,7 +427,7 @@ public void loadRpcList() { ArrayList names = getNamespaces(); for (String s:names){ - System.out.println(getRpcList(s)); + com.neuronrobotics.sdk.common.Log.error(getRpcList(s)); } } diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerDataType.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerDataType.java index 649166bf..97e1f065 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerDataType.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerDataType.java @@ -18,7 +18,7 @@ import java.util.HashMap; import java.util.Map; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum BowlerMethod. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagram.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagram.java index eddc8927..7dbb53e7 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagram.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagram.java @@ -31,7 +31,7 @@ */ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * Formats data into a Bowler packet. * @@ -244,7 +244,7 @@ public void parse(ByteList raw) { setMethod(BowlerMethod.get(raw.getByte(7))); if(getMethod() == null){ setMethod(BowlerMethod.STATUS); - System.err.println("Method was invalid!! Value="+raw.getUnsigned(7)); + com.neuronrobotics.sdk.common.Log.error("Method was invalid!! Value="+raw.getUnsigned(7)); Log.error("Method was invalid!! Value="+raw.getUnsigned(7)); } @@ -677,7 +677,7 @@ public void calcCRC() { * @param opCode the new rpc */ public void setRpc(String opCode) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagramFactory.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagramFactory.java index ec5ec6e5..197c27af 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagramFactory.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerDatagramFactory.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This DatagramFactory Builds a datagram. * diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerDocumentationFactory.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerDocumentationFactory.java index 0279a96f..7972f0f4 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerDocumentationFactory.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerDocumentationFactory.java @@ -13,7 +13,7 @@ import com.neuronrobotics.sdk.dyio.peripherals.ServoChannel; import com.neuronrobotics.sdk.dyio.peripherals.UARTChannel; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * Factory used to centralize references to web pages (specifically * documentation). Any documentation for an object type defined in the NRSDK diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerMethod.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerMethod.java index 003cdf29..05235ccf 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerMethod.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerMethod.java @@ -18,7 +18,7 @@ import java.util.HashMap; import java.util.Map; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum BowlerMethod. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/BowlerRuntimeException.java b/src/main/java/com/neuronrobotics/sdk/common/BowlerRuntimeException.java index 39c8255e..cd5233e5 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/BowlerRuntimeException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/BowlerRuntimeException.java @@ -15,7 +15,7 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerRuntimeException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/ByteList.java b/src/main/java/com/neuronrobotics/sdk/common/ByteList.java index 568e7928..6c02e26e 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ByteList.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ByteList.java @@ -25,7 +25,7 @@ import com.neuronrobotics.sdk.config.SDKBuildInfo; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ByteList. */ @@ -360,7 +360,7 @@ public boolean addAll(Collection c) { * @return true, if successful */ public boolean addAll(int index, Collection c) { - // TODO Auto-generated method stub + // Auto-generated method stub return false; } @@ -696,7 +696,7 @@ public boolean hasNext() { @Override public Byte next() { - // TODO Auto-generated method stub + // Auto-generated method stub return data[readIndex++]; } diff --git a/src/main/java/com/neuronrobotics/sdk/common/ConfigManager.java b/src/main/java/com/neuronrobotics/sdk/common/ConfigManager.java index 573ad910..7d3a2fc5 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ConfigManager.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ConfigManager.java @@ -14,7 +14,7 @@ import com.neuronrobotics.sdk.network.UDPBowlerConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ConfigManager. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/ConnectionUnavailableException.java b/src/main/java/com/neuronrobotics/sdk/common/ConnectionUnavailableException.java index 60bf11af..239211e4 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ConnectionUnavailableException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ConnectionUnavailableException.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * An exception that gets thrown when a connection is unavaliable. * @author robert diff --git a/src/main/java/com/neuronrobotics/sdk/common/DMDevice.java b/src/main/java/com/neuronrobotics/sdk/common/DMDevice.java index c1300770..27a5d412 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/DMDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/common/DMDevice.java @@ -50,7 +50,7 @@ public String getScriptingName() { @Override public ArrayList getNamespacesImp() { - // TODO Auto-generated method stub + // Auto-generated method stub return new ArrayList(); } @@ -59,7 +59,7 @@ public void disconnectDeviceImp() { try { methodDisconnect.invoke(getWrapped(), null); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -99,7 +99,7 @@ public boolean connectDeviceImp() { } return true; } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } return false; diff --git a/src/main/java/com/neuronrobotics/sdk/common/DeviceConnectionException.java b/src/main/java/com/neuronrobotics/sdk/common/DeviceConnectionException.java index 100a31dc..6da6ecec 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/DeviceConnectionException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/DeviceConnectionException.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DeviceConnectionException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/DeviceManager.java b/src/main/java/com/neuronrobotics/sdk/common/DeviceManager.java index 06a1dab1..5723d2bc 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/DeviceManager.java +++ b/src/main/java/com/neuronrobotics/sdk/common/DeviceManager.java @@ -13,7 +13,7 @@ import com.neuronrobotics.sdk.ui.ConnectionDialog; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DeviceManager. */ @@ -58,7 +58,7 @@ public static void addConnection(final Object newDevice, String name) { */ private static void addConnectionBAD(final BowlerAbstractDevice newDevice, String name) { if (DeviceManager.getSpecificDevice(name) == newDevice) { - System.out.println("Device " + name + " is already in the manager"); + com.neuronrobotics.sdk.common.Log.error("Device " + name + " is already in the manager"); return; } if ( DMDevice.class.isInstance(newDevice)) { @@ -68,7 +68,7 @@ private static void addConnectionBAD(final BowlerAbstractDevice newDevice, Strin if(DMDevice.class.isInstance(sDev)) { DMDevice inside = (DMDevice) sDev; if (inside.getWrapped() == incoming.getWrapped()) { - System.out.println("Wrapped Device " + name + " is already in the manager"); + com.neuronrobotics.sdk.common.Log.error("Wrapped Device " + name + " is already in the manager"); return; } } diff --git a/src/main/java/com/neuronrobotics/sdk/common/IBowlerDatagramListener.java b/src/main/java/com/neuronrobotics/sdk/common/IBowlerDatagramListener.java index afa7bad7..86841b4d 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/IBowlerDatagramListener.java +++ b/src/main/java/com/neuronrobotics/sdk/common/IBowlerDatagramListener.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * Interface for classes to implement when they wich to be notified of a response datagram. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/IConnectionEventListener.java b/src/main/java/com/neuronrobotics/sdk/common/IConnectionEventListener.java index 175f4d5a..91367997 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/IConnectionEventListener.java +++ b/src/main/java/com/neuronrobotics/sdk/common/IConnectionEventListener.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IConnectionEvent events. * The class that is interested in processing a IConnectionEvent diff --git a/src/main/java/com/neuronrobotics/sdk/common/IDeviceAddedListener.java b/src/main/java/com/neuronrobotics/sdk/common/IDeviceAddedListener.java index 7467d758..13c85b73 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/IDeviceAddedListener.java +++ b/src/main/java/com/neuronrobotics/sdk/common/IDeviceAddedListener.java @@ -1,7 +1,7 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDeviceAdded events. * The class that is interested in processing a IDeviceAdded diff --git a/src/main/java/com/neuronrobotics/sdk/common/IDeviceConnectionEventListener.java b/src/main/java/com/neuronrobotics/sdk/common/IDeviceConnectionEventListener.java index b3c60dd1..3eb54160 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/IDeviceConnectionEventListener.java +++ b/src/main/java/com/neuronrobotics/sdk/common/IDeviceConnectionEventListener.java @@ -3,7 +3,7 @@ import java.io.PrintWriter; import java.io.StringWriter; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDeviceConnectionEvent events. * The class that is interested in processing a IDeviceConnectionEvent diff --git a/src/main/java/com/neuronrobotics/sdk/common/ISendable.java b/src/main/java/com/neuronrobotics/sdk/common/ISendable.java index 61e7626a..9eac73de 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ISendable.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ISendable.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This interface is implemented by objects that can serialise themselves into a byte array. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/ISynchronousDatagramListener.java b/src/main/java/com/neuronrobotics/sdk/common/ISynchronousDatagramListener.java index 22c11f4a..94eacc7c 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ISynchronousDatagramListener.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ISynchronousDatagramListener.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving ISynchronousDatagram events. * The class that is interested in processing a ISynchronousDatagram diff --git a/src/main/java/com/neuronrobotics/sdk/common/InvalidConnectionException.java b/src/main/java/com/neuronrobotics/sdk/common/InvalidConnectionException.java index 481237b9..5400365a 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/InvalidConnectionException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/InvalidConnectionException.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This connection is thrown in the case of an invalid connection. * diff --git a/src/main/java/com/neuronrobotics/sdk/common/InvalidDataLengthException.java b/src/main/java/com/neuronrobotics/sdk/common/InvalidDataLengthException.java index 5777bf5e..18806611 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/InvalidDataLengthException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/InvalidDataLengthException.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This exception is thrown in the case of an invalid data length. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/InvalidMACAddressException.java b/src/main/java/com/neuronrobotics/sdk/common/InvalidMACAddressException.java index 5cb3a4b1..801ec1fb 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/InvalidMACAddressException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/InvalidMACAddressException.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This exception is thrown in the case of an invalid MAC address. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/InvalidResponseException.java b/src/main/java/com/neuronrobotics/sdk/common/InvalidResponseException.java index 54378ecb..6311b7ac 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/InvalidResponseException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/InvalidResponseException.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This exception is thrown when an invalid response is recieved from a device. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/IthreadedTimoutListener.java b/src/main/java/com/neuronrobotics/sdk/common/IthreadedTimoutListener.java index 148b0cb7..523bb818 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/IthreadedTimoutListener.java +++ b/src/main/java/com/neuronrobotics/sdk/common/IthreadedTimoutListener.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving ithreadedTimout events. * The class that is interested in processing a ithreadedTimout diff --git a/src/main/java/com/neuronrobotics/sdk/common/Log.java b/src/main/java/com/neuronrobotics/sdk/common/Log.java index 51f3cc9b..bc9dd234 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/Log.java +++ b/src/main/java/com/neuronrobotics/sdk/common/Log.java @@ -22,7 +22,7 @@ import java.util.Date; import com.neuronrobotics.sdk.config.SDKBuildInfo; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class is the Logging Class for the NRsdk. * @author rbreznak @@ -89,8 +89,8 @@ private Log() { * * @param message the message to log as an error */ - public static void error(String message) { - instance().add(message, ERROR); + public static void error(Object message) { + instance().add(message.toString(), ERROR); } /** @@ -165,7 +165,7 @@ private void add(String message, int importance) { if(debugprint&& systemprint) { outStream.println("# " + message); if(outStream != System.out) - System.out.println(m); + System.err.println(m); } @@ -434,7 +434,7 @@ public static void setUseColoredPrints(boolean useColoredPrints) { * @return true, if is printing */ public static boolean isPrinting() { - // TODO Auto-generated method stub + // Auto-generated method stub return instance().systemprint; } diff --git a/src/main/java/com/neuronrobotics/sdk/common/MACAddress.java b/src/main/java/com/neuronrobotics/sdk/common/MACAddress.java index 949553bf..e3c4c581 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/MACAddress.java +++ b/src/main/java/com/neuronrobotics/sdk/common/MACAddress.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A mac address object. This object represents a MAC Address. * @author rbreznak @@ -162,7 +162,7 @@ public void increment(){ * @param address2 the new values */ public void setValues(MACAddress address2) { - //System.out.println("Setting new values: "+address2); + //com.neuronrobotics.sdk.common.Log.error("Setting new values: "+address2); for(int i=0; i<6; i++) { address[i] = address2.address[i]; } diff --git a/src/main/java/com/neuronrobotics/sdk/common/MalformattedDatagram.java b/src/main/java/com/neuronrobotics/sdk/common/MalformattedDatagram.java index 959714ac..f18b0c47 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/MalformattedDatagram.java +++ b/src/main/java/com/neuronrobotics/sdk/common/MalformattedDatagram.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * his exception is thrown in the case of the reception of a malformed datagram. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/MissingNativeLibraryException.java b/src/main/java/com/neuronrobotics/sdk/common/MissingNativeLibraryException.java index b5d5d15e..ff9b8b09 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/MissingNativeLibraryException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/MissingNativeLibraryException.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class MissingNativeLibraryException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/NamespaceEncapsulation.java b/src/main/java/com/neuronrobotics/sdk/common/NamespaceEncapsulation.java index 11f6c2d0..1cb80a90 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/NamespaceEncapsulation.java +++ b/src/main/java/com/neuronrobotics/sdk/common/NamespaceEncapsulation.java @@ -2,7 +2,7 @@ import java.util.ArrayList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class NamespaceEncapsulation. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/NoConnectionAvailableException.java b/src/main/java/com/neuronrobotics/sdk/common/NoConnectionAvailableException.java index d014a723..aabfc5ee 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/NoConnectionAvailableException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/NoConnectionAvailableException.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This exception si thrown when there is no avaliable connection. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/NonBowlerDevice.java b/src/main/java/com/neuronrobotics/sdk/common/NonBowlerDevice.java index 1f82ac31..5bbb41f3 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/NonBowlerDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/common/NonBowlerDevice.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.namespace.bcs.pid.IPidControlNamespace; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class NonBowlerDevice. */ @@ -66,7 +66,7 @@ public void disconnect(){ */ @Override public void onAsyncResponse(BowlerDatagram data) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/common/ResponseTimeoutException.java b/src/main/java/com/neuronrobotics/sdk/common/ResponseTimeoutException.java index 75f68437..49bb0c6f 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ResponseTimeoutException.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ResponseTimeoutException.java @@ -13,7 +13,7 @@ * limitations under the License. ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This excepion is thrown when a device fails to respond to an asynchronous packet in time. * @author rvreznak diff --git a/src/main/java/com/neuronrobotics/sdk/common/RpcEncapsulation.java b/src/main/java/com/neuronrobotics/sdk/common/RpcEncapsulation.java index e64c09aa..40254ac9 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/RpcEncapsulation.java +++ b/src/main/java/com/neuronrobotics/sdk/common/RpcEncapsulation.java @@ -2,7 +2,7 @@ import com.neuronrobotics.sdk.common.device.server.IBowlerCommandProcessor; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class RpcEncapsulation. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/SDKInfo.java b/src/main/java/com/neuronrobotics/sdk/common/SDKInfo.java index eb5e1ff8..7b4a56bb 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/SDKInfo.java +++ b/src/main/java/com/neuronrobotics/sdk/common/SDKInfo.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class has been replaced by SDKBuildInfo. diff --git a/src/main/java/com/neuronrobotics/sdk/common/ThreadedTimeout.java b/src/main/java/com/neuronrobotics/sdk/common/ThreadedTimeout.java index 25550375..2a34214e 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/ThreadedTimeout.java +++ b/src/main/java/com/neuronrobotics/sdk/common/ThreadedTimeout.java @@ -18,7 +18,7 @@ import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ThreadedTimeout. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/TickToc.java b/src/main/java/com/neuronrobotics/sdk/common/TickToc.java index 9ce2198d..cef0e325 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/TickToc.java +++ b/src/main/java/com/neuronrobotics/sdk/common/TickToc.java @@ -23,7 +23,7 @@ public void print(Pair start,Pair previous) { m=m+" from last event "+df.format(diffms/1000.0)+" seconds "; } m=m+" "+message; - System.out.println(m); + com.neuronrobotics.sdk.common.Log.error(m); } } @@ -45,7 +45,7 @@ public static void toc() { events.add(new Pair(System.currentTimeMillis(), "Toc end event")); Pair start = events.remove(0); Pair previous=null; - System.out.println("\n\n"); + com.neuronrobotics.sdk.common.Log.error("\n\n"); for (int i = 0; i < events.size(); i++) { Pair p = events.get(i); p.print(start,previous); @@ -65,7 +65,7 @@ public static void setEnabled(boolean enabled) { if(!enabled) clear(); else { - System.out.println("Start TickToc"); + com.neuronrobotics.sdk.common.Log.error("Start TickToc"); tic("Tick Tock start"); } } diff --git a/src/main/java/com/neuronrobotics/sdk/common/Tracer.java b/src/main/java/com/neuronrobotics/sdk/common/Tracer.java index c49261e0..68a34721 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/Tracer.java +++ b/src/main/java/com/neuronrobotics/sdk/common/Tracer.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.common; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class Tracer. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServer.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServer.java index b3ce12a2..8731769b 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServer.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServer.java @@ -12,7 +12,7 @@ import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerAbstractDeviceServer. */ @@ -85,7 +85,7 @@ public void onAllResponse(BowlerDatagram data) { * @see com.neuronrobotics.sdk.common.IBowlerDatagramListener#onAsyncResponse(com.neuronrobotics.sdk.common.BowlerDatagram) */ public void onAsyncResponse(BowlerDatagram data) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServerNamespace.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServerNamespace.java index 297868dd..1e8c21c8 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServerNamespace.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractDeviceServerNamespace.java @@ -9,7 +9,7 @@ import com.neuronrobotics.sdk.common.MACAddress; import com.neuronrobotics.sdk.common.RpcEncapsulation; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerAbstractDeviceServerNamespace. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractServer.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractServer.java index 4e54abab..5801b72c 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractServer.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerAbstractServer.java @@ -30,7 +30,7 @@ import com.neuronrobotics.sdk.network.BowlerUDPServer; import com.neuronrobotics.sdk.network.UDPBowlerConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerAbstractServer. */ @@ -129,7 +129,7 @@ private BowlerDatagram processLocal(BowlerDatagram data) { throw new RuntimeException("No namespaces defined"); } for (BowlerAbstractDeviceServerNamespace n : getNamespaces()) { - // System.out.println("Checking "+n.getNamespaces().get(0)); + // com.neuronrobotics.sdk.common.Log.error("Checking "+n.getNamespaces().get(0)); if (n.checkRpc(data)) { BowlerDatagram d = n.process(data); if (d != null) { @@ -177,7 +177,7 @@ public void run() { addServer(new BowlerTCPServer(s)); Log.warning("Got a connection!"); } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -260,7 +260,7 @@ private void removeServer(BowlerAbstractConnection b) { try { udpServer.reconnect(); } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } return; @@ -329,7 +329,7 @@ public synchronized void pushAsyncPacket(BowlerDatagram data) { run = true; } if (localServers.get(i).getClass() != BowlerUDPServer.class) { - // System.out.println("Sending packet to "+getServers().get(i).getClass()); + // com.neuronrobotics.sdk.common.Log.error("Sending packet to "+getServers().get(i).getClass()); if (run && localServers.get(i).isConnected()) { // Log.warning("ASYNC<<\r\n"+data ); String classString = localServers.get(i).getClass() diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerDeviceReServerNamespace.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerDeviceReServerNamespace.java index 2bc0c34b..be2db1c0 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerDeviceReServerNamespace.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/BowlerDeviceReServerNamespace.java @@ -10,7 +10,7 @@ import com.neuronrobotics.sdk.common.RpcEncapsulation; import com.neuronrobotics.sdk.genericdevice.GenericDevice; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerDeviceReServerNamespace. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/IBowlerCommandProcessor.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/IBowlerCommandProcessor.java index 896a6c51..d23237e6 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/IBowlerCommandProcessor.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/IBowlerCommandProcessor.java @@ -2,7 +2,7 @@ import com.neuronrobotics.sdk.common.BowlerMethod; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IBowlerCommandProcessor. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/core/BcsCoreNamespaceImp.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/core/BcsCoreNamespaceImp.java index e429ae22..a6091fb6 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/core/BcsCoreNamespaceImp.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/core/BcsCoreNamespaceImp.java @@ -8,7 +8,7 @@ import com.neuronrobotics.sdk.common.device.server.BowlerAbstractServer; import com.neuronrobotics.sdk.common.device.server.IBowlerCommandProcessor; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BcsCoreNamespaceImp. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcArgsCommand.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcArgsCommand.java index e37a31f1..fd45c118 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcArgsCommand.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcArgsCommand.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.common.BowlerDataType; import com.neuronrobotics.sdk.common.BowlerMethod; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BcsRpcArgsCommand. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcCommand.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcCommand.java index c601fc2e..4e1ba7fc 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcCommand.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcCommand.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.common.BowlerAbstractCommand; import com.neuronrobotics.sdk.common.BowlerMethod; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BcsRpcCommand. */ diff --git a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcNamespaceImp.java b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcNamespaceImp.java index 13e259da..070142e6 100644 --- a/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcNamespaceImp.java +++ b/src/main/java/com/neuronrobotics/sdk/common/device/server/bcs/rpc/BcsRpcNamespaceImp.java @@ -9,7 +9,7 @@ import com.neuronrobotics.sdk.common.device.server.BowlerAbstractServer; import com.neuronrobotics.sdk.common.device.server.IBowlerCommandProcessor; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BcsRpcNamespaceImp. */ diff --git a/src/main/java/com/neuronrobotics/sdk/config/SDKBuildInfo.java b/src/main/java/com/neuronrobotics/sdk/config/SDKBuildInfo.java index 8c36eaab..a33210dd 100644 --- a/src/main/java/com/neuronrobotics/sdk/config/SDKBuildInfo.java +++ b/src/main/java/com/neuronrobotics/sdk/config/SDKBuildInfo.java @@ -5,7 +5,7 @@ import java.io.InputStream; import java.io.InputStreamReader; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class SDKBuildInfo. */ @@ -117,7 +117,7 @@ public static String getBuildDate() { } } catch (IOException e) { } - // System.out.println("Manifest:\n"+s); + // com.neuronrobotics.sdk.common.Log.error("Manifest:\n"+s); return ""; } diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/DyIO.java b/src/main/java/com/neuronrobotics/sdk/dyio/DyIO.java index dd2cf441..eed0a3f1 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/DyIO.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/DyIO.java @@ -51,7 +51,7 @@ import com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The DyIO class is an encapsulation of all of the functionality of the DyIO module into one object. This * object has one connection to one DyIO module and wraps all of the commands in an accessible API. @@ -311,7 +311,7 @@ public String getFirmwareRevString(){ public ArrayList getChannels() { ArrayList c = new ArrayList(); for(DyIOChannel chan:getInternalChannels() ) { - //System.out.println(this.getClass()+" Adding channel: "+chan.getChannelNumber()+" as mode: "+chan.getMode()); + //com.neuronrobotics.sdk.common.Log.error(this.getClass()+" Adding channel: "+chan.getChannelNumber()+" as mode: "+chan.getMode()); c.add(chan); } return c; @@ -501,7 +501,7 @@ public boolean resync() { Log.info("\n\nUpdating channel: "+i); getInternalChannels().get(i).update(this, i, cm, editable); }catch(IndexOutOfBoundsException e){ - //System.out.println("New channel "+i); + //com.neuronrobotics.sdk.common.Log.error("New channel "+i); getInternalChannels().add(new DyIOChannel(this, i, cm, editable)); DyIOChannel dc =getInternalChannels().get(i); dc.fireModeChangeEvent(dc.getCurrentMode()); @@ -576,7 +576,7 @@ public void removeAllDyIOEventListeners() { * - the event to fire to all listeners */ public void fireDyIOEvent(IDyIOEvent e) { - //System.out.println("DyIO Event: "+e); + //com.neuronrobotics.sdk.common.Log.error("DyIO Event: "+e); for(IDyIOEventListener l : listeners) { l.onDyIOEvent(e); } @@ -646,12 +646,12 @@ public void setCachedMode(boolean mode) { * @param seconds the seconds */ public void flushCache(double seconds) { - //System.out.println("Updating all channels"); + //com.neuronrobotics.sdk.common.Log.error("Updating all channels"); Integer [] values = new Integer[getInternalChannels().size()]; int i=0; for(DyIOChannel d:getInternalChannels()) { values[i++]=d.getCachedValue(); - //System.out.println("Flushing chan "+d+" to "+d.getCachedValue()); + //com.neuronrobotics.sdk.common.Log.error("Flushing chan "+d+" to "+d.getCachedValue()); } if(isLegacyParser()){ for(int j=0;j<5;j++) { @@ -659,7 +659,7 @@ public void flushCache(double seconds) { send(new SetAllChannelValuesCommand(seconds,values)); return; }catch (InvalidResponseException e1) { - System.err.println("Failed to update all, retrying"); + com.neuronrobotics.sdk.common.Log.error("Failed to update all, retrying"); } } }else{ @@ -1096,7 +1096,7 @@ public void startHeartBeat(long msHeartBeatTime){ if(b== null) checkFirmwareRev(); }catch(Exception e){ - System.err.println("DyIO is out of date"); + com.neuronrobotics.sdk.common.Log.error("DyIO is out of date"); checkFirmwareRev(); } } @@ -1124,7 +1124,7 @@ public void stopHeartBeat(){ if(b== null) checkFirmwareRev(); }catch(Exception e){ - System.err.println("DyIO is out of date"); + com.neuronrobotics.sdk.common.Log.error("DyIO is out of date"); checkFirmwareRev(); } } @@ -1310,7 +1310,7 @@ public int[] getAllChannelValues() { */ @Override public boolean ConfigurePDVelovityController(PDVelocityConfiguration config) { - // TODO Auto-generated method stub + // Auto-generated method stub return getPid().ConfigurePDVelovityController(config); } @@ -1319,7 +1319,7 @@ public boolean ConfigurePDVelovityController(PDVelocityConfiguration config) { */ @Override public PDVelocityConfiguration getPDVelocityConfiguration(int group) { - // TODO Auto-generated method stub + // Auto-generated method stub return getPid().getPDVelocityConfiguration(group); } @@ -1328,7 +1328,7 @@ public PDVelocityConfiguration getPDVelocityConfiguration(int group) { */ @Override public int getPIDChannelCount() { - // TODO Auto-generated method stub + // Auto-generated method stub return getPid().getPIDChannelCount(); } diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOAsyncEvent.java b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOAsyncEvent.java index 09211c52..79305164 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOAsyncEvent.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOAsyncEvent.java @@ -15,7 +15,7 @@ package com.neuronrobotics.sdk.dyio; import com.neuronrobotics.sdk.common.BowlerDatagram; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * An asyncrono event. * @author rbreznak diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOChannel.java index d3a193f8..79b439de 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOChannel.java @@ -30,7 +30,7 @@ import com.neuronrobotics.sdk.common.Log; import com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A DyIO channel. This represents a single DyIO pchannel. * @author Kevin Harrington, Robert Breznak @@ -262,7 +262,7 @@ public void resync(boolean all) { return; } BowlerDatagram bd = getDevice().send(new GetChannelModeCommand(number)); - //System.out.println(bd); + //com.neuronrobotics.sdk.common.Log.error(bd); fireModeChangeEvent(DyIOChannelMode.get(bd.getData().getByte(1))); throw new RuntimeException(); } @@ -526,11 +526,11 @@ public boolean setMode(DyIOChannelMode mode, boolean async) { "schm", new Object[]{getChannelNumber(),mode.getValue(),async?1:0}); ByteList currentModes = (ByteList) args[0]; - //System.out.println("Setting # "+getChannelNumber()+" to "+mode); + //com.neuronrobotics.sdk.common.Log.error("Setting # "+getChannelNumber()+" to "+mode); for (int j=0;j0){ ByteList b; if(bl.size()>20){ @@ -60,7 +60,7 @@ public void write(ByteList bl) throws IOException { }else{ b = new ByteList(bl.popList(bl.size())); } - //System.out.println("Sending ByteList: "+b.asString()); + //com.neuronrobotics.sdk.common.Log.error("Sending ByteList: "+b.asString()); chan.setValue(b); } } diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerEvent.java b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerEvent.java index 52785aee..85f1401b 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerEvent.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerEvent.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DyIOPowerEvent. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerState.java b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerState.java index 643da189..3655278c 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerState.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/DyIOPowerState.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum DyIOPowerState. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/IChannelEventListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/IChannelEventListener.java index 9f7e407c..284c704d 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/IChannelEventListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/IChannelEventListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IChannelEvent events. * The class that is interested in processing a IChannelEvent diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannel.java index b0c69554..1e54529f 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannel.java @@ -16,7 +16,7 @@ import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IDyIOChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannelModeChangeListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannelModeChangeListener.java index b0a94567..128c90d8 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannelModeChangeListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOChannelModeChangeListener.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDyIOChannelModeChange events. * The class that is interested in processing a IDyIOChannelModeChange diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOEventListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOEventListener.java index fdab5273..4bcde54a 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOEventListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOEventListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDyIOEvent events. * The class that is interested in processing a IDyIOEvent diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOStateChangeListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOStateChangeListener.java index 18c0f9c6..598c1808 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOStateChangeListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/IDyIOStateChangeListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDyIOStateChange events. * The class that is interested in processing a IDyIOStateChange diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelException.java b/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelException.java index e904b376..98975433 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelException.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelException.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class InvalidChannelException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelOperationException.java b/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelOperationException.java index b6cf373d..3649e118 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelOperationException.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/InvalidChannelOperationException.java @@ -16,7 +16,7 @@ import com.neuronrobotics.sdk.common.BowlerRuntimeException; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class InvalidChannelOperationException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/dypid/DyPIDConfiguration.java b/src/main/java/com/neuronrobotics/sdk/dyio/dypid/DyPIDConfiguration.java index 88bec4b2..dd8a92e0 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/dypid/DyPIDConfiguration.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/dypid/DyPIDConfiguration.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.common.BowlerDatagram; import com.neuronrobotics.sdk.dyio.DyIOChannelMode; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DyPIDConfiguration. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/AnalogInputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/AnalogInputChannel.java index d71cdb98..1337b83a 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/AnalogInputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/AnalogInputChannel.java @@ -23,7 +23,7 @@ import com.neuronrobotics.sdk.dyio.DyIOChannelMode; import com.neuronrobotics.sdk.dyio.IChannelEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AnalogInputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterInputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterInputChannel.java index 834d59fd..c0596fee 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterInputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterInputChannel.java @@ -24,7 +24,7 @@ import com.neuronrobotics.sdk.dyio.DyIOChannelMode; import com.neuronrobotics.sdk.dyio.IChannelEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class CounterInputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterOutputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterOutputChannel.java index bfb5e105..27cbad34 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterOutputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/CounterOutputChannel.java @@ -27,7 +27,7 @@ import com.neuronrobotics.sdk.dyio.IChannelEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class CounterOutputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DCMotorOutputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DCMotorOutputChannel.java index 2e8d9d31..2b825ab3 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DCMotorOutputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DCMotorOutputChannel.java @@ -20,7 +20,7 @@ import com.neuronrobotics.sdk.common.DeviceManager; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DCMotorOutputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalInputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalInputChannel.java index 2f0559a6..2be92bf2 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalInputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalInputChannel.java @@ -23,7 +23,7 @@ import com.neuronrobotics.sdk.common.DeviceManager; import com.neuronrobotics.sdk.dyio.IChannelEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DigitalInputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalOutputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalOutputChannel.java index 3380cc69..12a3200e 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalOutputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DigitalOutputChannel.java @@ -19,7 +19,7 @@ import com.neuronrobotics.sdk.dyio.DyIOChannelMode; import com.neuronrobotics.sdk.common.DeviceManager; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DigitalOutputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOAbstractPeripheral.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOAbstractPeripheral.java index d1a1ce74..369f7ea2 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOAbstractPeripheral.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOAbstractPeripheral.java @@ -24,7 +24,7 @@ import com.neuronrobotics.sdk.dyio.DyIOChannelMode; import com.neuronrobotics.sdk.dyio.IDyIOChannel; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DyIOAbstractPeripheral. */ @@ -218,7 +218,7 @@ public boolean SavePosition(int pos){ try { Thread.sleep(30); } catch (InterruptedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOPeripheralException.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOPeripheralException.java index cc9ee89e..561843ea 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOPeripheralException.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/DyIOPeripheralException.java @@ -16,7 +16,7 @@ import com.neuronrobotics.sdk.common.BowlerRuntimeException; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class DyIOPeripheralException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IAnalogInputListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IAnalogInputListener.java index 60287afd..ea5e9973 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IAnalogInputListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IAnalogInputListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio.peripherals; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IAnalogInput events. * The class that is interested in processing a IAnalogInput diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterInputListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterInputListener.java index 4cd1325e..37a228bb 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterInputListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterInputListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio.peripherals; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving ICounterInput events. * The class that is interested in processing a ICounterInput diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterOutputListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterOutputListener.java index 6e148f7b..2f6b4e76 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterOutputListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ICounterOutputListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio.peripherals; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving ICounterOutput events. * The class that is interested in processing a ICounterOutput diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IDigitalInputListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IDigitalInputListener.java index e4c08cc5..1169d90c 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IDigitalInputListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IDigitalInputListener.java @@ -14,7 +14,7 @@ ******************************************************************************/ package com.neuronrobotics.sdk.dyio.peripherals; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IDigitalInput events. * The class that is interested in processing a IDigitalInput diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IPPMReaderListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IPPMReaderListener.java index 040bd2a2..25a2714c 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IPPMReaderListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IPPMReaderListener.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.dyio.peripherals; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc //import com.neuronrobotics.sdk.dyio.IChannelEventListener; /** diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IServoPositionUpdateListener.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IServoPositionUpdateListener.java index 80adb0fd..34614a25 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IServoPositionUpdateListener.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/IServoPositionUpdateListener.java @@ -1,7 +1,7 @@ package com.neuronrobotics.sdk.dyio.peripherals; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IServoPositionUpdate events. * The class that is interested in processing a IServoPositionUpdate diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PPMReaderChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PPMReaderChannel.java index e572c773..c92d3a67 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PPMReaderChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PPMReaderChannel.java @@ -15,7 +15,7 @@ import com.neuronrobotics.sdk.common.DeviceManager; import com.neuronrobotics.sdk.dyio.IChannelEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class is a wrapper for the DyIO PPM signal reader. * This manages taking Channel 23 and using it to read values from the VEX rc controller (others might be supported as well) @@ -133,7 +133,7 @@ public void setCrossLink(int [] links){ private void updateValues() { if(getChannel().getDevice().isLegacyParser()){ BowlerDatagram b=null; - //System.out.println("Updating value map"); + //com.neuronrobotics.sdk.common.Log.error("Updating value map"); try { b= getChannel().getDevice().send(new GetValueCommand(23)); }catch (Exception e) { diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PWMOutputChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PWMOutputChannel.java index b67ccad3..e0ed6864 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PWMOutputChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/PWMOutputChannel.java @@ -20,7 +20,7 @@ import com.neuronrobotics.sdk.common.DeviceManager; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PWMOutputChannel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/SPIChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/SPIChannel.java index 430ab57b..0f593356 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/SPIChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/SPIChannel.java @@ -11,7 +11,7 @@ import com.neuronrobotics.sdk.common.DeviceManager; import com.neuronrobotics.sdk.dyio.IChannelEventListener; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class wraps ports 0,1, and 2 as an SPI interface. diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ServoChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ServoChannel.java index b1b36efd..56eb5862 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ServoChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/ServoChannel.java @@ -25,7 +25,7 @@ import com.neuronrobotics.sdk.common.DeviceManager; import com.neuronrobotics.sdk.dyio.IChannelEventListener; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ServoChannel. */ @@ -204,7 +204,7 @@ public powerOverridePacket(boolean ovr){ */ @Override public void onChannelEvent(DyIOChannelEvent e) { - firePositionUpdate(e.getUnsignedValue(), System.currentTimeMillis()); + firePositionUpdate(e.getUnsignedValue(), e.getChannel().getDevice().currentTimeMillis()); } } diff --git a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/UARTChannel.java b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/UARTChannel.java index 81e91645..e88d0ab3 100644 --- a/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/UARTChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/dyio/peripherals/UARTChannel.java @@ -33,7 +33,7 @@ import com.neuronrobotics.sdk.dyio.InvalidChannelOperationException; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class UARTChannel. */ @@ -272,7 +272,7 @@ public DyIOOutputStream getOutStream(){ * @see com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral#hasAsync() */ public boolean hasAsync() { - // TODO Auto-generated method stub + // Auto-generated method stub return true; } @@ -354,7 +354,7 @@ public DyIOInputStream getInputStream(){ * @see com.neuronrobotics.sdk.dyio.peripherals.DyIOAbstractPeripheral#hasAsync() */ public boolean hasAsync() { - // TODO Auto-generated method stub + // Auto-generated method stub return true; } diff --git a/src/main/java/com/neuronrobotics/sdk/genericdevice/GenericDevice.java b/src/main/java/com/neuronrobotics/sdk/genericdevice/GenericDevice.java index 09e3fff7..aa6ae489 100644 --- a/src/main/java/com/neuronrobotics/sdk/genericdevice/GenericDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/genericdevice/GenericDevice.java @@ -7,7 +7,7 @@ import com.neuronrobotics.sdk.common.InvalidConnectionException; import com.neuronrobotics.sdk.common.MACAddress; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This is a basic device with only bcs.core * @author hephaestus @@ -38,7 +38,7 @@ public boolean isAvailable() throws InvalidConnectionException { * @see com.neuronrobotics.sdk.common.BowlerAbstractDevice#onAllResponse(com.neuronrobotics.sdk.common.BowlerDatagram) */ public void onAllResponse(BowlerDatagram data) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -47,7 +47,7 @@ public void onAllResponse(BowlerDatagram data) { * @see com.neuronrobotics.sdk.common.IBowlerDatagramListener#onAsyncResponse(com.neuronrobotics.sdk.common.BowlerDatagram) */ public void onAsyncResponse(BowlerDatagram data) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/javaxusb/IUsbDeviceEventListener.java b/src/main/java/com/neuronrobotics/sdk/javaxusb/IUsbDeviceEventListener.java index 1d8ad444..a70b8966 100644 --- a/src/main/java/com/neuronrobotics/sdk/javaxusb/IUsbDeviceEventListener.java +++ b/src/main/java/com/neuronrobotics/sdk/javaxusb/IUsbDeviceEventListener.java @@ -2,7 +2,7 @@ import javax.usb.UsbDevice; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IUsbDeviceEvent events. * The class that is interested in processing a IUsbDeviceEvent diff --git a/src/main/java/com/neuronrobotics/sdk/javaxusb/UsbCDCSerialConnection.java b/src/main/java/com/neuronrobotics/sdk/javaxusb/UsbCDCSerialConnection.java index 57555527..eb23a048 100644 --- a/src/main/java/com/neuronrobotics/sdk/javaxusb/UsbCDCSerialConnection.java +++ b/src/main/java/com/neuronrobotics/sdk/javaxusb/UsbCDCSerialConnection.java @@ -49,7 +49,7 @@ //import com.neuronrobotics.sdk.util.OsInfoUtil; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class UsbCDCSerialConnection. */ @@ -131,13 +131,13 @@ public UsbCDCSerialConnection(UsbDevice device) { MyDeviceString=getUniqueID(device); } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } setup(); @@ -227,10 +227,10 @@ public int processEvent(Context arg0, Device arg1, } } } catch (SecurityException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } if(thread!=null) @@ -283,16 +283,16 @@ public static UsbDevice mapLibUsbDevicetoJavaxDevice(Device device) { } } } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } return null; @@ -321,14 +321,14 @@ private static void dumpDevice(final UsbDevice device, // robotics // devices // Dump information about the device itself - // System.out.println("Device: "+device.getProductString()); + // com.neuronrobotics.sdk.common.Log.error("Device: "+device.getProductString()); addrs.add(device); // Dump device descriptor - // System.out.println(device.getUsbDeviceDescriptor()); + // com.neuronrobotics.sdk.common.Log.error(device.getUsbDeviceDescriptor()); } - // System.out.println(); + // com.neuronrobotics.sdk.common.Log.error(); // Dump child devices if device is a hub if (device.isUsbHub()) { @@ -398,16 +398,16 @@ private void setup(){ } } } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } @@ -434,9 +434,9 @@ public boolean connect() { e.printStackTrace(); } - // System.out.println(mDevice); + // com.neuronrobotics.sdk.common.Log.error(mDevice); // Dump device descriptor - // System.out.println(mDevice.getUsbDeviceDescriptor()); + // com.neuronrobotics.sdk.common.Log.error(mDevice.getUsbDeviceDescriptor()); // Process all configurations for (UsbConfiguration configuration : (List) mDevice @@ -445,7 +445,7 @@ public boolean connect() { for (UsbInterface iface : (List) configuration .getUsbInterfaces()) { // Dump the interface descriptor - // System.out.println(iface.getUsbInterfaceDescriptor()); + // com.neuronrobotics.sdk.common.Log.error(iface.getUsbInterfaceDescriptor()); if (iface.getUsbInterfaceDescriptor().bInterfaceClass() == 2) { // controlInterface = iface; @@ -458,7 +458,7 @@ public boolean connect() { kernelDetatch(mDevice); } catch (Exception e1) { - // TODO Auto-generated catch block + // Auto-generated catch block e1.printStackTrace(); return false; } @@ -470,25 +470,25 @@ public boolean connect() { .getUsbEndpoints()) { if (endpoint.getUsbEndpointDescriptor() .bEndpointAddress() == 0x03) { - // System.out.println("Data out Endpipe"); + // com.neuronrobotics.sdk.common.Log.error("Data out Endpipe"); dataOutEndpoint = endpoint; } else { - // System.out.println("Data in Endpipe"); + // com.neuronrobotics.sdk.common.Log.error("Data in Endpipe"); dataInEndpoint = endpoint; } } } catch (UsbClaimException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbNotActiveException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } else { @@ -566,13 +566,13 @@ private void kernelDetatch(UsbDevice mDevice){ try { kDev = findDevice(mDevice.getSerialNumberString()); } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } if (kDev == null) @@ -590,7 +590,7 @@ private void kernelDetatch(UsbDevice mDevice){ if (r != LibUsb.SUCCESS && r != LibUsb.ERROR_NOT_SUPPORTED && r != LibUsb.ERROR_NOT_FOUND) throw new LibUsbException("Unable to detach kernel driver", r); - // System.out.println("Kernel detatched for device "+mDevice); + // com.neuronrobotics.sdk.common.Log.error("Kernel detatched for device "+mDevice); //} } @@ -607,10 +607,10 @@ private void localDisconnect(){ camOutpipe.close(); camOutpipe=null; } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } if(dataInterface!=null){ @@ -619,10 +619,10 @@ private void localDisconnect(){ dataInterface.release(); dataInterface=null; } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -699,7 +699,7 @@ public void write(byte[] src) throws IOException { ThreadUtil.wait(1); } - } catch (Exception e) {// TODO Auto-generated catch block + } catch (Exception e) {// Auto-generated catch block //e.printStackTrace(); disconnect(); throw new BowlerRuntimeException( @@ -766,16 +766,16 @@ public BowlerDatagram loadPacketFromPhy(ByteList bytesToPacketBuffer) disconnect(); return null; } catch (UsbNotActiveException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbNotOpenException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } break; @@ -816,7 +816,7 @@ public BowlerDatagram loadPacketFromPhy(ByteList bytesToPacketBuffer) */ @Override public boolean waitingForConnection() { - // TODO Auto-generated method stub + // Auto-generated method stub return false; } @@ -825,7 +825,7 @@ public boolean waitingForConnection() { */ @Override public void dataEventOccurred(UsbDeviceDataEvent arg0) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -859,7 +859,7 @@ public void usbDeviceDetached(UsbDeviceEvent arg0) { */ @Override public void onDeviceEvent(UsbDevice device) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/AbstractPidNamespaceImp.java b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/AbstractPidNamespaceImp.java index f779f598..58d097ca 100644 --- a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/AbstractPidNamespaceImp.java +++ b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/AbstractPidNamespaceImp.java @@ -11,7 +11,7 @@ import com.neuronrobotics.sdk.pid.PIDEvent; import com.neuronrobotics.sdk.pid.PIDLimitEvent; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AbstractPidNamespaceImp. */ diff --git a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IExtendedPIDControl.java b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IExtendedPIDControl.java index f3439cab..3e813ad9 100644 --- a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IExtendedPIDControl.java +++ b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IExtendedPIDControl.java @@ -1,7 +1,7 @@ package com.neuronrobotics.sdk.namespace.bcs.pid; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IExtendedPIDControl. */ diff --git a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IPidControlNamespace.java b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IPidControlNamespace.java index dc238753..e1953ec8 100644 --- a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IPidControlNamespace.java +++ b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/IPidControlNamespace.java @@ -6,7 +6,7 @@ import com.neuronrobotics.sdk.pid.PIDCommandException; import com.neuronrobotics.sdk.pid.PIDConfiguration; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface IPidControlNamespace. */ diff --git a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/LegacyPidNamespaceImp.java b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/LegacyPidNamespaceImp.java index 7d72dc62..2978cabd 100644 --- a/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/LegacyPidNamespaceImp.java +++ b/src/main/java/com/neuronrobotics/sdk/namespace/bcs/pid/LegacyPidNamespaceImp.java @@ -19,7 +19,7 @@ import com.neuronrobotics.sdk.pid.PIDEvent; import com.neuronrobotics.sdk.pid.PIDLimitEvent; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class LegacyPidNamespaceImp. */ @@ -42,7 +42,7 @@ public void onAsyncResponse(BowlerDatagram data) { //Log.debug("\nPID ASYNC<<"+data); if(data.getRPC().contains("_pid")){ - PIDEvent e =new PIDEvent(data); + PIDEvent e =new PIDEvent(data,getDevice().currentTimeMillis()); firePIDEvent(e); } @@ -50,7 +50,7 @@ public void onAsyncResponse(BowlerDatagram data) { int [] pos = new int[getNumberOfChannels()]; for(int i=0;i getAvailableSockets() { available= udp.getAllAddresses(); udp.disconnect(); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } return available; @@ -228,7 +228,7 @@ public boolean reconnect() { return true; } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } disconnect(); @@ -243,7 +243,7 @@ public boolean reconnect() { */ @Override public boolean waitingForConnection() { - // TODO Auto-generated method stub + // Auto-generated method stub return false; } diff --git a/src/main/java/com/neuronrobotics/sdk/network/BowlerTCPServer.java b/src/main/java/com/neuronrobotics/sdk/network/BowlerTCPServer.java index e897fd6e..3fce924c 100644 --- a/src/main/java/com/neuronrobotics/sdk/network/BowlerTCPServer.java +++ b/src/main/java/com/neuronrobotics/sdk/network/BowlerTCPServer.java @@ -27,7 +27,7 @@ -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerTCPServer. */ @@ -55,7 +55,7 @@ public BowlerTCPServer(Socket socket) throws IOException{ socket.setSoTimeout(1000); } catch (SocketException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } setSynchronusPacketTimeoutTime(sleepTime); @@ -109,7 +109,7 @@ public void disconnect() { } } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } diff --git a/src/main/java/com/neuronrobotics/sdk/network/BowlerUDPServer.java b/src/main/java/com/neuronrobotics/sdk/network/BowlerUDPServer.java index b11e0cbc..70e3b312 100644 --- a/src/main/java/com/neuronrobotics/sdk/network/BowlerUDPServer.java +++ b/src/main/java/com/neuronrobotics/sdk/network/BowlerUDPServer.java @@ -30,7 +30,7 @@ import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerUDPServer. */ @@ -97,7 +97,7 @@ public boolean connect() { setConnected(true); } catch (SocketException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } return isConnected(); diff --git a/src/main/java/com/neuronrobotics/sdk/network/UDPBowlerConnection.java b/src/main/java/com/neuronrobotics/sdk/network/UDPBowlerConnection.java index 78e4a1af..2478ef35 100644 --- a/src/main/java/com/neuronrobotics/sdk/network/UDPBowlerConnection.java +++ b/src/main/java/com/neuronrobotics/sdk/network/UDPBowlerConnection.java @@ -33,7 +33,7 @@ import com.neuronrobotics.sdk.common.Log; import com.neuronrobotics.sdk.common.MACAddress; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class UDPBowlerConnection. */ @@ -161,7 +161,7 @@ public BowlerDatagram loadPacketFromPhy(ByteList bytesToPacketBuffer) throws Nul long start = System.currentTimeMillis(); //Log.info("Waiting for UDP packet"); udpSock.setSoTimeout(1);// Timeout the socket after 1 ms - //System.err.println("Timeout set "+(System.currentTimeMillis()-start)); + //com.neuronrobotics.sdk.common.Log.error("Timeout set "+(System.currentTimeMillis()-start)); start = System.currentTimeMillis(); try{ udpSock.receive(receivePacket); @@ -174,7 +174,7 @@ public BowlerDatagram loadPacketFromPhy(ByteList bytesToPacketBuffer) throws Nul ex.printStackTrace(); return null; } - //System.err.println("Recv "+(System.currentTimeMillis()-start)); + //com.neuronrobotics.sdk.common.Log.error("Recv "+(System.currentTimeMillis()-start)); start = System.currentTimeMillis(); Log.info("Got UDP packet"); if(addrs== null) @@ -186,10 +186,10 @@ public BowlerDatagram loadPacketFromPhy(ByteList bytesToPacketBuffer) throws Nul for (int i=0;i getAllAddresses(){ //wait for all devices to report back try {Thread.sleep(3000);} catch (InterruptedException e) {} } catch (IOException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } diff --git a/src/main/java/com/neuronrobotics/sdk/pid/GenericPIDDevice.java b/src/main/java/com/neuronrobotics/sdk/pid/GenericPIDDevice.java index 149d3ca7..23a7969e 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/GenericPIDDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/GenericPIDDevice.java @@ -13,7 +13,7 @@ import com.neuronrobotics.sdk.namespace.bcs.pid.LegacyPidNamespaceImp; import com.neuronrobotics.sdk.namespace.bcs.pid.PidNamespaceImp; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * This class is a generic implementation of the PID system. This can be used as a template, superclass or internal object class for * use with and device that implements the IPIDControl interface. diff --git a/src/main/java/com/neuronrobotics/sdk/pid/ILinkFactoryProvider.java b/src/main/java/com/neuronrobotics/sdk/pid/ILinkFactoryProvider.java index 669acd6a..2d8073c5 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/ILinkFactoryProvider.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/ILinkFactoryProvider.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration; import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Interface ILinkFactoryProvider. */ diff --git a/src/main/java/com/neuronrobotics/sdk/pid/IPIDEventListener.java b/src/main/java/com/neuronrobotics/sdk/pid/IPIDEventListener.java index 2a387274..1402f463 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/IPIDEventListener.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/IPIDEventListener.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.pid; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The listener interface for receiving IPIDEvent events. * The class that is interested in processing a IPIDEvent diff --git a/src/main/java/com/neuronrobotics/sdk/pid/InterpolationEngine.java b/src/main/java/com/neuronrobotics/sdk/pid/InterpolationEngine.java index 08854216..61e27133 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/InterpolationEngine.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/InterpolationEngine.java @@ -1,10 +1,13 @@ package com.neuronrobotics.sdk.pid; -// TODO: Auto-generated Javadoc +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; + +// Auto-generated Javadoc /** * The Class LinearInterpolationEngine. */ -public class InterpolationEngine { +public class InterpolationEngine extends TimeKeeper{ private InterpolationType type = InterpolationType.LINEAR; /** The ticks. */ private double ticks=0; @@ -49,6 +52,10 @@ public class InterpolationEngine { private double setpointDiff; private double newSetpoint; + public InterpolationEngine(ITimeProvider t) { + setTimeProvider(t); + } + /** * Sets the velocity. @@ -162,7 +169,7 @@ public synchronized void ResetEncoder(double value) { lastTick=value; endSetpoint=value; duration=0; - startTime=System.currentTimeMillis(); + startTime=currentTimeMillis(); startSetpoint=value; //setPause(false); } diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PDVelocityConfiguration.java b/src/main/java/com/neuronrobotics/sdk/pid/PDVelocityConfiguration.java index 9f4b567c..c9ad56d6 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PDVelocityConfiguration.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PDVelocityConfiguration.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.common.BowlerDatagram; import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PDVelocityConfiguration. */ diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PIDChannel.java b/src/main/java/com/neuronrobotics/sdk/pid/PIDChannel.java index 046a27b1..ac472793 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PIDChannel.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PIDChannel.java @@ -5,7 +5,7 @@ import com.neuronrobotics.sdk.common.Log; import com.neuronrobotics.sdk.namespace.bcs.pid.IPidControlNamespace; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PIDChannel. */ @@ -281,7 +281,7 @@ public float getCurrentCachedPosition() { * @return true, if is available */ public boolean isAvailable() { - // TODO Auto-generated method stub + // Auto-generated method stub return pid.isAvailable(); } @@ -291,7 +291,7 @@ public boolean isAvailable() { * @return the group */ public int getGroup() { - // TODO Auto-generated method stub + // Auto-generated method stub return index; } diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PIDCommandException.java b/src/main/java/com/neuronrobotics/sdk/pid/PIDCommandException.java index 1b5191a1..b3ae5cc3 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PIDCommandException.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PIDCommandException.java @@ -1,6 +1,6 @@ package com.neuronrobotics.sdk.pid; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PIDCommandException. */ diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PIDConfiguration.java b/src/main/java/com/neuronrobotics/sdk/pid/PIDConfiguration.java index 1327c575..57e2d43c 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PIDConfiguration.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PIDConfiguration.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.common.BowlerDatagram; import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PIDConfiguration. */ @@ -146,7 +146,7 @@ public PIDConfiguration(BowlerDatagram conf) { setLowerHystersys(((double)ByteList.convertToInt(conf.getData().getBytes(30, 4),true))/1000); }catch(Exception e){ - System.err.println("No latch value sent"); + com.neuronrobotics.sdk.common.Log.error("No latch value sent"); } } diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PIDEvent.java b/src/main/java/com/neuronrobotics/sdk/pid/PIDEvent.java index 6d8400dd..19f0e858 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PIDEvent.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PIDEvent.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.common.BowlerDatagram; import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PIDEvent. */ @@ -58,12 +58,12 @@ public void set(int chan,float tick,long time,int velocity){ * * @param data the data */ - public PIDEvent(BowlerDatagram data){ + public PIDEvent(BowlerDatagram data, long timestamp){ if(!data.getRPC().contains("_pid")) throw new RuntimeException("Datagram is not a PID event"); setGroup(data.getData().getByte(0)); setValue(ByteList.convertToInt(data.getData().getBytes(1, 4),true)); - setTimeStamp(System.currentTimeMillis()); + setTimeStamp(timestamp); setVelocity(ByteList.convertToInt(data.getData().getBytes(9, 4),true)); } diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEvent.java b/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEvent.java index add0c5ca..3a14b842 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEvent.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEvent.java @@ -3,7 +3,7 @@ import com.neuronrobotics.sdk.common.BowlerDatagram; import com.neuronrobotics.sdk.common.ByteList; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PIDLimitEvent. */ diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEventType.java b/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEventType.java index 4d55860c..baa705e8 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEventType.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PIDLimitEventType.java @@ -20,7 +20,7 @@ import java.util.List; import java.util.Map; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Enum PIDLimitEventType. diff --git a/src/main/java/com/neuronrobotics/sdk/pid/PausableTime.java b/src/main/java/com/neuronrobotics/sdk/pid/PausableTime.java index 364106ac..09d06162 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/PausableTime.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/PausableTime.java @@ -2,23 +2,28 @@ import java.util.ArrayList; -public class PausableTime { +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; +import com.neuronrobotics.sdk.addons.kinematics.time.TimeKeeper; + +public class PausableTime extends TimeKeeper { private static long timePaused = 0; private static long durationPaused = 0; private static boolean paused =false; private static ArrayList listeners = new ArrayList(); - - public static long currentTimeMillis() { + public PausableTime(ITimeProvider t) { + setTimeProvider(t); + } + public long currentTimeMillis() { if(!paused) - return System.currentTimeMillis()-durationPaused; + return super.currentTimeMillis()-durationPaused; return timePaused; } - public static void pause(boolean val) { + public void pause(boolean val) { if(val) - timePaused=System.currentTimeMillis(); + timePaused=super.currentTimeMillis(); else - durationPaused+=(System.currentTimeMillis()-timePaused); + durationPaused+=(super.currentTimeMillis()-timePaused); paused=val; for(int i=0;i{ boolean start = paused; pause(false); @@ -35,27 +40,27 @@ public static void step(long ms) { }).start(); } - public static void sleep(long durationMS) { + public void sleep(long durationMS) { try { - Thread.sleep(durationMS); + super.sleep(durationMS); } catch (InterruptedException e) { throw new RuntimeException(e); } while(paused) { try { - Thread.sleep(1); + super.sleep(1); } catch (InterruptedException e) { throw new RuntimeException(e); } } } - public static void addIPauseTimeListener(IPauseTimeListener l) { + public void addIPauseTimeListener(IPauseTimeListener l) { if(listeners.contains(l)) return; listeners.add(l); } - public static void removeIPauseTimeListener(IPauseTimeListener l) { + public void removeIPauseTimeListener(IPauseTimeListener l) { if(listeners.contains(l)) listeners.remove(l); } diff --git a/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPIDDevice.java b/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPIDDevice.java index 20b77451..89c15b1b 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPIDDevice.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPIDDevice.java @@ -5,6 +5,7 @@ import com.neuronrobotics.sdk.addons.kinematics.IHardwareSyncPulseProvider; import com.neuronrobotics.sdk.addons.kinematics.IHardwareSyncPulseReciver; +import com.neuronrobotics.sdk.addons.kinematics.time.ITimeProvider; import com.neuronrobotics.sdk.common.BowlerAbstractCommand; import com.neuronrobotics.sdk.common.BowlerDatagram; import com.neuronrobotics.sdk.common.InvalidConnectionException; @@ -13,7 +14,7 @@ import com.neuronrobotics.sdk.common.NoConnectionAvailableException; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class VirtualGenericPIDDevice. */ @@ -189,7 +190,7 @@ public boolean ResetPIDChannel(int group, float valueToSetCurrentTo) { */ @Override public boolean SetPIDSetPoint(int group, float setpoint, double seconds) { - long currentTimeMillis = System.currentTimeMillis(); + long currentTimeMillis = currentTimeMillis(); sync.setPause(true); synchronized(interpolationEngines) { getDriveThread(group).StartLinearMotion(setpoint, seconds,currentTimeMillis); @@ -215,7 +216,7 @@ public boolean SetPDVelocity(int group, int unitsPerSecond, double seconds) thro + unitsPerSecond + ", when max is" + getMaxTicksPerSecond() + " set: " + getMaxTicksPerSecond() + " sec: " + seconds); if (seconds < 0.1 && seconds > -0.1) { - // System.out.println("Setting virtual velocity="+unitsPerSecond); + // com.neuronrobotics.sdk.common.Log.error("Setting virtual velocity="+unitsPerSecond); getDriveThread(group).SetVelocity(unitsPerSecond); } else { SetPIDInterpolatedVelocity(group, unitsPerSecond, seconds); @@ -247,7 +248,7 @@ public void flushPIDChannels(double time) { */ @Override public boolean SetAllPIDSetPoint(float[] setpoints, double seconds) { - long start = System.currentTimeMillis(); + long start = currentTimeMillis(); sync.setPause(true); synchronized(interpolationEngines) { for (int i = 0; i < setpoints.length; i++) { @@ -265,7 +266,7 @@ private InterpolationEngine getDriveThread(int i) { } } for (PIDConfiguration c : interpolationEngines.keySet()) { - System.err.println(c); + com.neuronrobotics.sdk.common.Log.error(c.toString()); } throw new RuntimeException("Device is missing, id " + i); @@ -278,7 +279,7 @@ private InterpolationEngine getDriveThread(int i) { */ @Override public float GetPIDPosition(int group) { - // TODO Auto-generated method stub + // Auto-generated method stub return (float) getDriveThread(group).getPosition(); } @@ -313,7 +314,7 @@ public float[] GetAllPIDPosition() { PIDConfiguration conf = new PIDConfiguration(); conf.setGroup(i); conf.setEnabled(true); - InterpolationEngine d = new InterpolationEngine(); + InterpolationEngine d = new InterpolationEngine(getTimeProvider()); interpolationEngines.put(conf, d); configs.put(i, conf); } @@ -325,6 +326,13 @@ public float[] GetAllPIDPosition() { } return backs; } + @Override + public void setTimeProvider(ITimeProvider t) { + super.setTimeProvider(t); + for(InterpolationEngine e:interpolationEngines.values()) { + e.setTimeProvider(getTimeProvider()); + } + } /** * Sets the max ticks per second. @@ -369,12 +377,13 @@ public void run() { long time; while (runSync) { try { - Thread.sleep(threadTime); + getTimeProvider().sleep(threadTime); } catch (InterruptedException ex) { + return; } if(!pause) { sync = false; - time = System.currentTimeMillis(); + time = currentTimeMillis(); synchronized(interpolationEngines) { for (PIDConfiguration key : interpolationEngines.keySet()) { InterpolationEngine dr = interpolationEngines.get(key); @@ -383,7 +392,7 @@ public void run() { toUpdate[updateIndex++]=key; } } else { - //System.err.println("Virtual Device " + key.getGroup() + " is disabled"); + //com.neuronrobotics.sdk.common.Log.error("Virtual Device " + key.getGroup() + " is disabled"); } } } @@ -405,10 +414,11 @@ public void run() { }else while (isPause()) try { - Thread.sleep(1); + getTimeProvider().sleep(1); } catch (InterruptedException e1) { - // TODO Auto-generated catch block + // Auto-generated catch block e1.printStackTrace(); + return; } if (sync) doSync(); diff --git a/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPidDeviceConnection.java b/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPidDeviceConnection.java index a4807872..05b92e5e 100644 --- a/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPidDeviceConnection.java +++ b/src/main/java/com/neuronrobotics/sdk/pid/VirtualGenericPidDeviceConnection.java @@ -4,7 +4,7 @@ import com.neuronrobotics.sdk.common.BowlerAbstractConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class VirtualGenericPidDeviceConnection. */ @@ -15,13 +15,13 @@ public class VirtualGenericPidDeviceConnection extends BowlerAbstractConnection */ @Override public boolean connect() { - // TODO Auto-generated method stub + // Auto-generated method stub return true; } // @Override // public boolean reconnect() throws IOException { -// // TODO Auto-generated method stub +// // Auto-generated method stub // return false; // } @@ -30,7 +30,7 @@ public boolean connect() { */ @Override public boolean waitingForConnection() { - // TODO Auto-generated method stub + // Auto-generated method stub return false; } diff --git a/src/main/java/com/neuronrobotics/sdk/serial/SerialConnection.java b/src/main/java/com/neuronrobotics/sdk/serial/SerialConnection.java index d2a5a043..54cc454d 100644 --- a/src/main/java/com/neuronrobotics/sdk/serial/SerialConnection.java +++ b/src/main/java/com/neuronrobotics/sdk/serial/SerialConnection.java @@ -28,7 +28,7 @@ import com.neuronrobotics.sdk.genericdevice.GenericDevice; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * SerialConnection manages a connection to a serial port on the host system. This class is responsible for * abstracting all of the aspects of a serial connection including: @@ -219,27 +219,27 @@ public static SerialConnection getConnectionByMacAddress(MACAddress mac){ List ports = SerialConnection.getAvailableSerialPorts(); //Start by searching through all available serial connections for DyIOs connected to the system for(String s: ports){ - System.out.println("Searching "+s); + com.neuronrobotics.sdk.common.Log.error("Searching "+s); } for(String s: ports){ try{ SerialConnection connection = new SerialConnection(s); GenericDevice d = new GenericDevice(connection); d.connect(); - System.out.println("Pinging port: "+connection+" "); + com.neuronrobotics.sdk.common.Log.error("Pinging port: "+connection+" "); if(d.ping()){ String addr = d.getAddress().toString(); if(addr.equalsIgnoreCase(mac.toString())){ connection.disconnect(); - System.out.println("Device FOUND on port: "+connection+" "+addr); + com.neuronrobotics.sdk.common.Log.error("Device FOUND on port: "+connection+" "+addr); return connection; } - System.err.println("Device not on port: "+connection+" "+addr); + com.neuronrobotics.sdk.common.Log.error("Device not on port: "+connection+" "+addr); } connection.disconnect(); }catch(Exception EX){ EX.printStackTrace(); - System.err.println("Serial port "+s+" is not a DyIO"); + com.neuronrobotics.sdk.common.Log.error("Serial port "+s+" is not a DyIO"); } } @@ -276,7 +276,7 @@ public static List getAvailableSerialPorts() { */ @Override public boolean waitingForConnection() { - // TODO Auto-generated method stub + // Auto-generated method stub return false; } diff --git a/src/main/java/com/neuronrobotics/sdk/ui/AbstractConnectionPanel.java b/src/main/java/com/neuronrobotics/sdk/ui/AbstractConnectionPanel.java index 071dd24c..4a75735b 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/AbstractConnectionPanel.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/AbstractConnectionPanel.java @@ -19,7 +19,7 @@ import com.neuronrobotics.sdk.common.BowlerAbstractConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class AbstractConnectionPanel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/ui/BluetoothConnectionPanel.java b/src/main/java/com/neuronrobotics/sdk/ui/BluetoothConnectionPanel.java index 65cce34b..139c6e25 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/BluetoothConnectionPanel.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/BluetoothConnectionPanel.java @@ -33,7 +33,7 @@ import com.neuronrobotics.sdk.wireless.bluetooth.BlueCoveManager; import com.neuronrobotics.sdk.wireless.bluetooth.BluetoothSerialConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BluetoothConnectionPanel. */ @@ -138,7 +138,7 @@ public void refresh() { public void onUpdate(double value) { - // TODO Auto-generated method stub + // Auto-generated method stub } diff --git a/src/main/java/com/neuronrobotics/sdk/ui/ConnectionDialog.java b/src/main/java/com/neuronrobotics/sdk/ui/ConnectionDialog.java index 2f9a9200..4309938e 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/ConnectionDialog.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/ConnectionDialog.java @@ -25,7 +25,7 @@ import com.neuronrobotics.sdk.serial.SerialConnection; import com.neuronrobotics.sdk.util.OsInfoUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ConnectionDialog. */ diff --git a/src/main/java/com/neuronrobotics/sdk/ui/ConnectionImageIconFactory.java b/src/main/java/com/neuronrobotics/sdk/ui/ConnectionImageIconFactory.java index 79ea8bbe..6df30487 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/ConnectionImageIconFactory.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/ConnectionImageIconFactory.java @@ -2,7 +2,7 @@ import javax.swing.ImageIcon; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * A factory for creating ConnectionImageIcon objects. */ diff --git a/src/main/java/com/neuronrobotics/sdk/ui/SerialConnectionPanel.java b/src/main/java/com/neuronrobotics/sdk/ui/SerialConnectionPanel.java index 7b58ec35..979344ac 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/SerialConnectionPanel.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/SerialConnectionPanel.java @@ -31,7 +31,7 @@ import com.neuronrobotics.sdk.common.MissingNativeLibraryException; import com.neuronrobotics.sdk.serial.SerialConnection; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class SerialConnectionPanel. */ diff --git a/src/main/java/com/neuronrobotics/sdk/ui/TCPConnectionPanel.java b/src/main/java/com/neuronrobotics/sdk/ui/TCPConnectionPanel.java index 65d66d6e..b5728151 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/TCPConnectionPanel.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/TCPConnectionPanel.java @@ -26,7 +26,7 @@ import com.neuronrobotics.sdk.network.BowlerTCPClient; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class TCPConnectionPanel. */ @@ -75,13 +75,13 @@ public TCPConnectionPanel(ConnectionDialog connectionDialog) { // try { // s = new Socket("google.com", 80); // connectionCbo.addItem(s.getLocalAddress().getHostAddress()); -// //System.out.println(s.getLocalAddress().getHostAddress()); +// //com.neuronrobotics.sdk.common.Log.error(s.getLocalAddress().getHostAddress()); // s.close(); // } catch (UnknownHostException e) { -// // TODO Auto-generated catch block +// // Auto-generated catch block // //e.printStackTrace(); // } catch (IOException e) { -// // TODO Auto-generated catch block +// // Auto-generated catch block // //e.printStackTrace(); // } diff --git a/src/main/java/com/neuronrobotics/sdk/ui/UDPConnectionPanel.java b/src/main/java/com/neuronrobotics/sdk/ui/UDPConnectionPanel.java index b23a7b06..df626429 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/UDPConnectionPanel.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/UDPConnectionPanel.java @@ -33,7 +33,7 @@ import com.neuronrobotics.sdk.util.IProgressMonitorListener; import com.neuronrobotics.sdk.util.ProcessMonitor; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class UDPConnectionPanel. */ @@ -138,7 +138,7 @@ public void refresh() { public void onUpdate(double value) { - // TODO Auto-generated method stub + // Auto-generated method stub } @@ -169,7 +169,7 @@ private class NetworkSearchProcess extends Thread implements IMonitorable { public void run() { setName("Bowler Platform UDP searcher"); isRunning = true; - //System.out.println("Searching for UDP devices, please wait..."); + //com.neuronrobotics.sdk.common.Log.error("Searching for UDP devices, please wait..."); int prt; try { prt=new Integer(port.getText()); @@ -180,7 +180,7 @@ public void run() { clnt=new UDPBowlerConnection(prt); ArrayList addrs = clnt.getAllAddresses(); // if (addrs.size()>0) -// System.out.println("Bowler servers: "+addrs); +// com.neuronrobotics.sdk.common.Log.error("Bowler servers: "+addrs); connectionCbo.removeAllItems(); for (InetAddress i:addrs) { connectionCbo.addItem(i.getHostAddress()); diff --git a/src/main/java/com/neuronrobotics/sdk/ui/UsbConnectionPanel.java b/src/main/java/com/neuronrobotics/sdk/ui/UsbConnectionPanel.java index a8fe9ed5..d44869bb 100644 --- a/src/main/java/com/neuronrobotics/sdk/ui/UsbConnectionPanel.java +++ b/src/main/java/com/neuronrobotics/sdk/ui/UsbConnectionPanel.java @@ -44,7 +44,7 @@ import com.neuronrobotics.sdk.javaxusb.UsbCDCSerialConnection; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class UsbConnectionPanel. */ @@ -121,7 +121,7 @@ public BowlerAbstractConnection getConnection() { * @see com.neuronrobotics.sdk.ui.AbstractConnectionPanel#refresh() */ public void refresh() { - //System.err.println("Refreshing USB"); + //com.neuronrobotics.sdk.common.Log.error("Refreshing USB"); connectionCbo.removeAllItems(); List prts=null; @@ -132,13 +132,13 @@ public void refresh() { e1.printStackTrace(); throw new RuntimeException(e1); } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (UsbDisconnectedException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } for(int i=0;i + + + https://github.com/NeuronRobotics/NASACurisoity.git + bodyCad.groovy + + + https://github.com/NeuronRobotics/NASACurisoity.git + DriveEngine.groovy + + +NASA_Curiosity + + +RobotArm + + https://github.com/NeuronRobotics/NASACurisoity.git + armCad.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + basePan + dyio + servo-rotory + 4 + 0.001 + 1000000.0 + -1000000.0 + 1.0E8 + -1.0E8 + 0.0 + 2.147483647E9 + -2.147483648E9 + true + 180.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 16.0 + 0.0 + 0.0 + -90.0 + + + + + baseTilt + dyio + servo-rotory + 5 + 0.001 + 1000000.0 + -1000000.0 + 1.0E8 + -1.0E8 + 0.0 + 2.147483647E9 + -2.147483648E9 + true + 128.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + -90.0 + 60.0 + 0.0 + + + + + elbow + dyio + servo-rotory + 6 + 0.001 + 100000.0 + -100000.0 + 1.0E8 + -1.0E8 + 0.0 + 2.147483647E9 + -2.147483648E9 + true + 121.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 90.0 + 50.0 + 0.0 + + + + + mahliApxs + dyio + servo-rotory + 7 + 0.001 + 120000.0 + -120000.0 + 1.0E8 + -1.0E8 + 0.0 + 2.147483647E9 + -2.147483648E9 + false + 0.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + -75.00000000000001 + -23.069999999999993 + 38.0952380952381 + 0.05455892332782112 + 0.017903047010183144 + 0.0077571528961058725 + 0.9983199043252653 + + + + + + +Front_Left + + https://github.com/NeuronRobotics/NASACurisoity.git + steer_wheel.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + fl_steer + dyio + servo-rotory + 0 + 2.0 + 255.0 + 0.0 + 178.0 + -178.0 + 128.0 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 0.0 + -90.0 + + + + + fl_wheel + pid + pid + 0 + 0.33 + 1000000.0 + -1000000.0 + 436.7392582541836 + -436.7392582541836 + 133.7089552238806 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.05 + + -18.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 18.0 + -90.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + -78.5 + -73.75 + 0.0 + 0.008725098943435386 + -0.9999619021083685 + 2.258102901239317E-6 + 2.587955605911594E-4 + + + + + + +Back_Left + + https://github.com/NeuronRobotics/NASACurisoity.git + steer_wheel.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + leftRocker + virtual + virtual + 1 + 1.0 + 147.0 + 88.2910447761194 + 233.7089552238806 + -233.7089552238806 + 128.0 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + true + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 24.0 + 0.0 + 45.0 + 90.0 + + + + https://github.com/madhephaestus/carl-the-hexapod.git + ThreeDPrintCad.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + WalkingDriveEngine.groovy + + +fixedWheelLeft + + +Center_Left + + https://github.com/NeuronRobotics/NASACurisoity.git + fixed_wheel.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + cl_wheel + pid + pid + 1 + 0.33 + 1000000.0 + -1000000.0 + 465.28403437358656 + -465.28403437358656 + 162.25373134328353 + 2.147483647E9 + -2.147483648E9 + true + 171.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.051 + + -18.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 18.0 + -90.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + -74.0 + 0.0 + 29.0 + 0.7071067811865476 + -0.7071067811865475 + -8.120692378444618E-12 + -8.120692378444618E-12 + + + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + + + + + + + + bl_steer + dyio + servo-rotory + 1 + 1.0 + 255.0 + 0.0 + 233.7089552238806 + -233.7089552238806 + 133.7089552238806 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 30.0 + 0.0 + 0.0 + -90.0 + + + + + bl_wheel + pid + pid + 2 + 0.33 + 1000000.0 + -1000000.0 + 447.8731410788662 + -447.8731410788662 + 144.84283804856315 + 2.147483647E9 + -2.147483648E9 + true + 124.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.05 + + -18.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 18.0 + -90.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + 28.0 + -51.5 + 29.000000000000032 + 0.7071067811864403 + 0.7071067811864402 + 3.895273510727024E-7 + -3.895273510727023E-7 + + + + + + +Back_Right + + https://github.com/NeuronRobotics/NASACurisoity.git + steer_wheel.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + rightRocker + virtual + virtual + 2 + 1.0 + 149.0 + 90.0 + 233.7089552238806 + -233.7089552238806 + 128.0 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + true + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + -25.0 + 0.0 + 45.0 + 90.0 + + + + https://github.com/madhephaestus/carl-the-hexapod.git + ThreeDPrintCad.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + WalkingDriveEngine.groovy + + +fixedWheelRight + + +Center_Right + + https://github.com/NeuronRobotics/NASACurisoity.git + fixed_wheel.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + cr_wheel + pid + pid + 4 + 0.33 + 1000000.0 + -1000000.0 + 425.3213478064224 + -425.3213478064224 + 122.2910447761194 + 2.147483647E9 + -2.147483648E9 + true + 128.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.05 + + -18.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 18.0 + -90.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + -73.0 + 0.0 + 29.0 + 0.7071067811637124 + -0.7071067811637123 + -5.682767991797112E-6 + -5.682767991797108E-6 + + + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + + + + + + + + br_steer + dyio + servo-rotory + 2 + 1.0 + 255.0 + 0.0 + 233.7089552238806 + -233.7089552238806 + 133.7089552238806 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 30.0 + 0.0 + 0.0 + -90.0 + + + + + br_wheel + pid + pid + 3 + 0.33 + 1000000.0 + -1000000.0 + 412.25607714480515 + -412.25607714480515 + 109.22577411450214 + 2.147483647E9 + -2.147483648E9 + true + 133.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.05 + + -18.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 18.0 + -90.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + 28.0 + 51.5 + 29.0 + 0.7071067811865444 + 0.7071067811865442 + 6.818941599633328E-8 + -6.818941599633326E-8 + + + + + + +Front_Right + + https://github.com/NeuronRobotics/NASACurisoity.git + steer_wheel.groovy + + + https://github.com/madhephaestus/carl-the-hexapod.git + DefaultDhSolver.groovy + + + fr_steer + dyio + servo-rotory + 3 + 1.0 + 255.0 + 0.0 + 233.7089552238806 + -233.7089552238806 + 133.7089552238806 + 2.147483647E9 + -2.147483648E9 + true + 105.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.001 + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 0.0 + -90.0 + + + + + fr_wheel + pid + pid + 5 + 0.33 + 1000000.0 + -1000000.0 + 423.4183627317955 + -423.4183627317955 + 120.38805970149252 + 2.147483647E9 + -2.147483648E9 + true + 135.0 + false + 10000000 + + + + + electroMechanical + hobbyServo + standardMicro + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + lastlink + + + + + shaft + hobbyServoHorn + standardMicro1 + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + origin + + + + + false + 0.05 + + -18.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + 0.0 + 0.0 + 18.0 + -90.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + -78.5 + 73.75 + 0.0 + 0.008725098943435386 + -0.9999619021083685 + 2.2581029012393413E-6 + 2.587955605911622E-4 + + + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + + + + 0.0 + 0.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + + 0.1 + + 0.0 + 0.0 + 40.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 0.0 + 0.0 + + + + + + script + https://github.com/madhephaestus/TestRepo.git + myFile.groovy + + 13.0 + -18.0 + 0.0 + 1.0 + -0.0 + -0.0 + -0.0 + + default + + + + + + + + \ No newline at end of file diff --git a/test/java/src/junit/test/neuronrobotics/utilities/ApacheCommonsRotationTest.java b/test/java/src/junit/test/neuronrobotics/utilities/ApacheCommonsRotationTest.java index 0fd781d4..16533ce8 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/ApacheCommonsRotationTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/ApacheCommonsRotationTest.java @@ -20,9 +20,9 @@ public void test() { }; RotationConvention[] conventions = { RotationConvention.FRAME_TRANSFORM, RotationConvention.VECTOR_OPERATOR }; for (RotationConvention convention : conventions) { - System.out.println("\n\nUsing convention " + convention.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing convention " + convention.toString()); for (RotationOrder order : list) { - System.out.println("\n\nUsing rotationOrder " + order.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing rotationOrder " + order.toString()); double tilt = Math.toRadians((Math.random() * 359) - 179.5); double elevation = Math.toRadians((Math.random() * 180) -90); diff --git a/test/java/src/junit/test/neuronrobotics/utilities/BowlerDatagramFactoryTests.java b/test/java/src/junit/test/neuronrobotics/utilities/BowlerDatagramFactoryTests.java index 567756b8..217135bb 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/BowlerDatagramFactoryTests.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/BowlerDatagramFactoryTests.java @@ -12,7 +12,7 @@ import com.neuronrobotics.sdk.common.MACAddress; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class BowlerDatagramFactoryTests. */ @@ -39,13 +39,13 @@ public void test() { if(b.isFree()){ fail();//if any packets not marked as allocated } - //System.out.println(b); + //com.neuronrobotics.sdk.common.Log.error(b); } ThreadUtil.wait((int) ((double)BowlerDatagramFactory.getPacketTimeout())*2);//wait for packets to timeout for(BowlerDatagram b:myList){ if(b.isFree()) fail();//if any packets not marked as free too soon - //System.out.println(b); + //com.neuronrobotics.sdk.common.Log.error(b); } ThreadUtil.wait((int) ((double)BowlerDatagramFactory.getPacketTimeout())*2);//wait for packets to timeout for(BowlerDatagram b:myList){ diff --git a/test/java/src/junit/test/neuronrobotics/utilities/ByteListTest.java b/test/java/src/junit/test/neuronrobotics/utilities/ByteListTest.java index 117608fb..188ed667 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/ByteListTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/ByteListTest.java @@ -7,7 +7,7 @@ import com.neuronrobotics.sdk.common.ByteList; import com.neuronrobotics.sdk.common.Log; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class ByteListTest. */ @@ -37,23 +37,23 @@ public void test() { for(int i= 0;i 0) - System.out.println("Gcode line run: " + response); + com.neuronrobotics.sdk.common.Log.error("Gcode line run: " + response); else { fail("No response"); } @@ -140,12 +140,12 @@ public double[] inverseKinematics(TransformNR target, double[] jointSpaceVector, // was // created } - System.out.println("Moving using the kinematics"); + com.neuronrobotics.sdk.common.Log.error("Moving using the kinematics"); try { arm.setDesiredTaskSpaceTransform(new TransformNR(10, 10, 0, new RotationNR()), 1); arm.setDesiredTaskSpaceTransform(new TransformNR(), 1); } catch (Exception e) { - // TODO Auto-generated catch block + // Auto-generated catch block e.printStackTrace(); } } @@ -266,19 +266,19 @@ public void G1() { GcodeDevice device = GCODECONTOLLER.cast(DeviceManager.getSpecificDevice(GCODECONTOLLER, GCODE)); String response = device.runLine("G90");// Absolute mode if (response.length() > 0) - System.out.println("Gcode line run: " + response); + com.neuronrobotics.sdk.common.Log.error("Gcode line run: " + response); else { fail("No response"); } response = device.runLine("G1 X100.2 Y100.2 Z0 E10 F6000"); if (response.length() > 0) - System.out.println("Gcode line run: " + response); + com.neuronrobotics.sdk.common.Log.error("Gcode line run: " + response); else { fail("No response"); } response = device.runLine("G1 X0 Y0 Z0 E0 F3000"); if (response.length() > 0) - System.out.println("Gcode line run: " + response); + com.neuronrobotics.sdk.common.Log.error("Gcode line run: " + response); else { fail("No response"); } diff --git a/test/java/src/junit/test/neuronrobotics/utilities/GsonVitaminLoad.java b/test/java/src/junit/test/neuronrobotics/utilities/GsonVitaminLoad.java new file mode 100644 index 00000000..49bf3d45 --- /dev/null +++ b/test/java/src/junit/test/neuronrobotics/utilities/GsonVitaminLoad.java @@ -0,0 +1,32 @@ +package junit.test.neuronrobotics.utilities; + +import static org.junit.Assert.*; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; + +import org.junit.Test; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.neuronrobotics.sdk.addons.kinematics.VitaminLocation; +import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; + +public class GsonVitaminLoad { + + @Test + public void test() { + Type type = new TypeToken() {}.getType(); + Gson gson = new GsonBuilder() + .excludeFieldsWithoutExposeAnnotation() + .disableHtmlEscaping() + .setPrettyPrinting() + .create(); + VitaminLocation src = new VitaminLocation(false,"Tester", "hobbyServo","mg92b",new TransformNR()); + String content = gson.toJson(src); + com.neuronrobotics.sdk.common.Log.error(content); + } + +} diff --git a/test/java/src/junit/test/neuronrobotics/utilities/LoadMassTest.java b/test/java/src/junit/test/neuronrobotics/utilities/LoadMassTest.java index c5fdefb0..a57a319c 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/LoadMassTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/LoadMassTest.java @@ -18,7 +18,7 @@ public void test() throws FileNotFoundException { File f = new File("carlRobot.xml"); if (f.exists()) { MobileBase pArm = new MobileBase(new FileInputStream(f)); - System.out.println("Mass = "+pArm.getMassKg()); + com.neuronrobotics.sdk.common.Log.error("Mass = "+pArm.getMassKg()); assertEquals(99, pArm.getMassKg(),0.1); assertEquals(pArm.getLegs().get(0).getScriptingName(),"Carl_One"); } diff --git a/test/java/src/junit/test/neuronrobotics/utilities/PacketValidationTest.java b/test/java/src/junit/test/neuronrobotics/utilities/PacketValidationTest.java index de5ff6f9..6ab11ba5 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/PacketValidationTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/PacketValidationTest.java @@ -11,7 +11,7 @@ import com.neuronrobotics.sdk.common.Log; import com.neuronrobotics.sdk.common.MACAddress; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class PacketValidationTest. */ @@ -24,15 +24,15 @@ public class PacketValidationTest { public void packetTest() { Log.enableInfoPrint(); BowlerDatagram bd = BowlerDatagramFactory.build(new MACAddress(), new PingCommand()); - System.out.println(bd); + com.neuronrobotics.sdk.common.Log.error(bd.toString()); ByteList data = new ByteList(bd.getBytes()); - System.out.println(data); + com.neuronrobotics.sdk.common.Log.error(data.toString()); BowlerDatagram back = BowlerDatagramFactory.build(data); if (back == null) fail(); - System.out.println(back); + com.neuronrobotics.sdk.common.Log.error(back.toString()); } } diff --git a/test/java/src/junit/test/neuronrobotics/utilities/ParallelArmTest.java b/test/java/src/junit/test/neuronrobotics/utilities/ParallelArmTest.java index a8ff20e7..e06096be 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/ParallelArmTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/ParallelArmTest.java @@ -24,7 +24,7 @@ public class ParallelArmTest { @Test public void test() throws Exception { - main(null); + //main(null); } public static void main(String[] args) throws Exception { @@ -53,7 +53,7 @@ public static void main(String[] args) throws Exception { kin.setDesiredJointSpaceVector(new double[]{0,0,0}, 0); kin.setDesiredTaskSpaceTransform(Tip, 0); - System.out.println("Arm "+kin.getScriptingName()+"setting to : "+Tip); + com.neuronrobotics.sdk.common.Log.error("Arm "+kin.getScriptingName()+"setting to : "+Tip); } assertEquals(Tip.getX(), group.getCurrentTaskSpaceTransform().getX(), 1); group.setDesiredTaskSpaceTransform(Tip.copy(), 0); @@ -61,7 +61,7 @@ public static void main(String[] args) throws Exception { TransformNR TipOffset = group.getTipOffset().get(limb); TransformNR newTip = limb.getCurrentTaskSpaceTransform().times(TipOffset); - System.out.println("Expected tip to be " + Tip.getX() + " and got: " + newTip.getX()); + com.neuronrobotics.sdk.common.Log.error("Expected tip to be " + Tip.getX() + " and got: " + newTip.getX()); assertTrue(!Double.isNaN(Tip.getX())); assertEquals(Tip.getX(), newTip.getX(), 1); } diff --git a/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java b/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java index 7e984f06..d3c844dd 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java @@ -22,7 +22,7 @@ import com.neuronrobotics.sdk.common.Log; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class RotationNRTest. */ @@ -52,10 +52,10 @@ public void test() throws FileNotFoundException { for (RotationConvention conv : conventions) { RotationNR.setConvention(conv); - System.out.println("\n\nUsing convention " + conv.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing convention " + conv.toString()); for (RotationOrder ro : list) { RotationNR.setOrder(ro); - System.out.println("\n\nUsing rotationOrder " + ro.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing rotationOrder " + ro.toString()); // for (int i = 0; i < iterations; i++) { @@ -65,22 +65,22 @@ public void test() throws FileNotFoundException { try { RotationNR rotTest = new RotationNR(Math.toDegrees(tilt), Math.toDegrees(azumus), Math.toDegrees(elevation)); - System.out.println("\n\nTest #" + i); - System.out.println("Testing Az=" + Math.toDegrees(azumus) + " El=" + Math.toDegrees(elevation) + com.neuronrobotics.sdk.common.Log.error("\n\nTest #" + i); + com.neuronrobotics.sdk.common.Log.error("Testing Az=" + Math.toDegrees(azumus) + " El=" + Math.toDegrees(elevation) + " Tl=" + Math.toDegrees(tilt)); - System.out.println("Got Az=" + Math.toDegrees(rotTest.getRotationAzimuth()) + " El=" + com.neuronrobotics.sdk.common.Log.error("Got Az=" + Math.toDegrees(rotTest.getRotationAzimuth()) + " El=" + Math.toDegrees(rotTest.getRotationElevation()) + " Tl=" + Math.toDegrees(rotTest.getRotationTilt())); if (!RotationNR.bound(tilt - .01, tilt + .01, rotTest.getRotationTilt())) { failCount++; - System.err.println("Rotation Tilt is not consistant. expected " + Math.toDegrees(tilt) + com.neuronrobotics.sdk.common.Log.error("Rotation Tilt is not consistant. expected " + Math.toDegrees(tilt) + " got " + Math.toDegrees(rotTest.getRotationTilt()) + " \t\tOff By " + (Math.toDegrees(tilt) - Math.toDegrees(rotTest.getRotationTilt()))); } if (!RotationNR.bound(elevation - .01, elevation + .01, rotTest.getRotationElevation())) { failCount++; - System.err.println("Rotation Elevation is not consistant. expected " + com.neuronrobotics.sdk.common.Log.error("Rotation Elevation is not consistant. expected " + Math.toDegrees(elevation) + " got " + Math.toDegrees(rotTest.getRotationElevation()) + " \t\tOff By " + (Math.toDegrees(elevation) + Math.toDegrees(rotTest.getRotationElevation())) @@ -89,14 +89,14 @@ public void test() throws FileNotFoundException { } if (!RotationNR.bound(azumus - .01, azumus + .01, rotTest.getRotationAzimuth())) { failCount++; - System.err.println("Rotation azumus is not consistant. expected " + Math.toDegrees(azumus) + com.neuronrobotics.sdk.common.Log.error("Rotation azumus is not consistant. expected " + Math.toDegrees(azumus) + " got " + Math.toDegrees(rotTest.getRotationAzimuth()) + " \t\tOff By " + (Math.toDegrees(azumus) - Math.toDegrees(rotTest.getRotationAzimuth()))); } ThreadUtil.wait(20); } catch (NumberFormatException ex) { if (elevation >= Math.PI / 2 || elevation <= -Math.PI / 2) { - System.out.println("Invalid numbers rejected ok"); + com.neuronrobotics.sdk.common.Log.error("Invalid numbers rejected ok"); } } @@ -104,7 +104,7 @@ public void test() throws FileNotFoundException { // frame(); // frame2(); - System.out.println("Frame test passed with " + ro); + com.neuronrobotics.sdk.common.Log.error("Frame test passed with " + ro); // return; } } @@ -126,10 +126,10 @@ public void compareAzemuth() throws FileNotFoundException { Log.enableDebugPrint(); for (RotationConvention conv : conventions) { RotationNR.setConvention(conv); - System.out.println("\n\nUsing convention " + conv.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing convention " + conv.toString()); for (RotationOrder ro : list) { RotationNR.setOrder(ro); - System.out.println("\n\nUsing rotationOrder " + ro.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing rotationOrder " + ro.toString()); failCount = 0; for (int i = 0; i < iterations; i++) { @@ -154,7 +154,7 @@ public void compareAzemuth() throws FileNotFoundException { RotationNR newRot = new RotationNR(rotation); RotationNRLegacy oldRot = new RotationNRLegacy(rotation); double[][] rotationMatrix = newRot.getRotationMatrix(); - System.out.println("Testing pure azumeth \nrotation " + rotationAngleDegrees + "\n as radian " + com.neuronrobotics.sdk.common.Log.error("Testing pure azumeth \nrotation " + rotationAngleDegrees + "\n as radian " + Math.toRadians(rotationAngleDegrees) + "\n Az " + oldRot.getRotationAzimuth() + "\n El " + oldRot.getRotationElevation() + "\n Tl " + oldRot.getRotationTilt() + "\n New Az " + newRot.getRotationAzimuth() + "\n New El " + newRot.getRotationElevation() @@ -163,7 +163,7 @@ public void compareAzemuth() throws FileNotFoundException { assertArrayEquals(rotation[1], rotationMatrix[1], 0.001); assertArrayEquals(rotation[2], rotationMatrix[2], 0.001); - System.out.println( + com.neuronrobotics.sdk.common.Log.error( "Testing Quaturnion \nrotation " + "\n qw " + oldRot.getRotationMatrix2QuaturnionW() + "\n qx " + oldRot.getRotationMatrix2QuaturnionX() + "\n qy " + oldRot.getRotationMatrix2QuaturnionY() + "\n qz " @@ -197,7 +197,7 @@ public void compareAzemuth() throws FileNotFoundException { oldRot.getRotationAzimuth(), oldRot.getRotationElevation(), oldRot.getRotationTilt() }, 0.001); } else { - System.err.println("Legacy angle would fail here " + rotationAngleDegrees); + com.neuronrobotics.sdk.common.Log.error("Legacy angle would fail here " + rotationAngleDegrees); } // Check the new rotation against the known value assertArrayEquals(new double[] { Math.toRadians(rotationAngleDegrees), 0, 0 }, new double[] { @@ -206,7 +206,7 @@ public void compareAzemuth() throws FileNotFoundException { } // frame(); // frame2(); - System.out.println("Frame test passed with " + ro); + com.neuronrobotics.sdk.common.Log.error("Frame test passed with " + ro); // return; } } @@ -223,10 +223,10 @@ public void compareElevation() throws FileNotFoundException { int iterations = 100; for (RotationConvention conv : conventions) { RotationNR.setConvention(conv); - System.out.println("\n\nUsing convention " + conv.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing convention " + conv.toString()); for (RotationOrder ro : list) { RotationNR.setOrder(ro); - System.out.println("\n\nUsing rotationOrder " + ro.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing rotationOrder " + ro.toString()); failCount = 0; for (int i = 0; i < iterations; i++) { @@ -251,7 +251,7 @@ public void compareElevation() throws FileNotFoundException { RotationNR newRot = new RotationNR(rotation); RotationNRLegacy oldRot = new RotationNRLegacy(rotation); double[][] rotationMatrix = newRot.getRotationMatrix(); - System.out.println("Testing pure elevation \nrotation " + rotationAngleDegrees + "\n as radian " + com.neuronrobotics.sdk.common.Log.error("Testing pure elevation \nrotation " + rotationAngleDegrees + "\n as radian " + Math.toRadians(rotationAngleDegrees) + "\n Az " + oldRot.getRotationAzimuth() + "\n El " + oldRot.getRotationElevation() + "\n Tl " + oldRot.getRotationTilt() + "\n New Az " + newRot.getRotationAzimuth() + "\n New El " + newRot.getRotationElevation() @@ -260,7 +260,7 @@ public void compareElevation() throws FileNotFoundException { assertArrayEquals(rotation[1], rotationMatrix[1], 0.001); assertArrayEquals(rotation[2], rotationMatrix[2], 0.001); - System.out.println( + com.neuronrobotics.sdk.common.Log.error( "Testing Quaturnion \nrotation " + "\n qw " + oldRot.getRotationMatrix2QuaturnionW() + "\n qx " + oldRot.getRotationMatrix2QuaturnionX() + "\n qy " + oldRot.getRotationMatrix2QuaturnionY() + "\n qz " @@ -300,7 +300,7 @@ public void compareElevation() throws FileNotFoundException { } // frame(); // frame2(); - System.out.println("Frame test passed with " + ro); + com.neuronrobotics.sdk.common.Log.error("Frame test passed with " + ro); // return; } } @@ -317,10 +317,10 @@ public void compareTilt() throws FileNotFoundException { int iterations = 100; for (RotationConvention conv : conventions) { RotationNR.setConvention(conv); - System.out.println("\n\nUsing convention " + conv.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing convention " + conv.toString()); for (RotationOrder ro : list) { RotationNR.setOrder(ro); - System.out.println("\n\nUsing rotationOrder " + ro.toString()); + com.neuronrobotics.sdk.common.Log.error("\n\nUsing rotationOrder " + ro.toString()); failCount = 0; for (int i = 0; i < iterations; i++) { @@ -345,7 +345,7 @@ public void compareTilt() throws FileNotFoundException { RotationNR newRot = new RotationNR(rotation); RotationNRLegacy oldRot = new RotationNRLegacy(rotation); double[][] rotationMatrix = newRot.getRotationMatrix(); - System.out.println("Testing pure tilt \nrotation " + rotationAngleDegrees + "\n as radian " + com.neuronrobotics.sdk.common.Log.error("Testing pure tilt \nrotation " + rotationAngleDegrees + "\n as radian " + Math.toRadians(rotationAngleDegrees) + "\n Az " + oldRot.getRotationAzimuth() + "\n El " + oldRot.getRotationElevation() + "\n Tl " + oldRot.getRotationTilt() + "\n New Az " + newRot.getRotationAzimuth() + "\n New El " + newRot.getRotationElevation() @@ -354,7 +354,7 @@ public void compareTilt() throws FileNotFoundException { assertArrayEquals(rotation[1], rotationMatrix[1], 0.001); assertArrayEquals(rotation[2], rotationMatrix[2], 0.001); - System.out.println( + com.neuronrobotics.sdk.common.Log.error( "Testing Quaturnion \nrotation " + "\n qw " + oldRot.getRotationMatrix2QuaturnionW() + "\n qx " + oldRot.getRotationMatrix2QuaturnionX() + "\n qy " + oldRot.getRotationMatrix2QuaturnionY() + "\n qz " @@ -391,7 +391,7 @@ public void compareTilt() throws FileNotFoundException { } // frame(); // frame2(); - System.out.println("Frame test passed with " + ro); + com.neuronrobotics.sdk.common.Log.error("Frame test passed with " + ro); // return; } } diff --git a/test/java/src/junit/test/neuronrobotics/utilities/TestMobilBaseLoading.java b/test/java/src/junit/test/neuronrobotics/utilities/TestMobilBaseLoading.java new file mode 100644 index 00000000..f553e5f4 --- /dev/null +++ b/test/java/src/junit/test/neuronrobotics/utilities/TestMobilBaseLoading.java @@ -0,0 +1,45 @@ +package junit.test.neuronrobotics.utilities; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.junit.Test; + +import com.neuronrobotics.sdk.addons.kinematics.MobileBase; +import com.neuronrobotics.sdk.addons.kinematics.VitaminLocation; +import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR; + +public class TestMobilBaseLoading { + + @Test + public void test() throws IOException { + File file = new File("src/main/resources/com/neuronrobotics/sdk/addons/kinematics/xml/NASASuspensionTest.xml"); + + String content = new String(Files.readAllBytes(Paths.get(file.getAbsolutePath()))); + MobileBase base = new MobileBase(new FileInputStream(file)); +// base.getAllDHChains() +// .get(0) +// .getLinkConfiguration(0) +// .setVitamin(new VitaminLocation("test1", "hobbyServo", "mg92b", new TransformNR(0, 1, 4))); +// base.setVitamin(new VitaminLocation("test1", "hobbyServo", "mg92b", new TransformNR(0, 1, 4))); +// base.setVitamin(new VitaminLocation("test2", "hobbyServo", "mg92b", new TransformNR(0, 1, 4))); +// base.setVitamin(new VitaminLocation("test1", "hobbyServo", "mg92b", new TransformNR(0, 1, 4))); + + if(Math.abs(0.1-base.getMassKg())>0.0001) { + fail("Base mass failed to load! expected "+0.1+" got "+base.getMassKg()); + } + String read = base.getXml(); + if(!content.contentEquals(read)) { + File out = new File("src/main/resources/com/neuronrobotics/sdk/addons/kinematics/xml/NASASuspensionTestOUTPUT.xml"); + Files.write( Paths.get(out.getAbsolutePath()), read.getBytes()); + com.neuronrobotics.sdk.common.Log.error("diff "+file.getAbsolutePath()+" "+out.getAbsolutePath()); + fail("What was loaded failed to match the source"); + } + } + +} diff --git a/test/java/src/junit/test/neuronrobotics/utilities/TestTimer.java b/test/java/src/junit/test/neuronrobotics/utilities/TestTimer.java index d557a005..1c23b618 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/TestTimer.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/TestTimer.java @@ -10,7 +10,7 @@ import com.neuronrobotics.sdk.common.ThreadedTimeout; import com.neuronrobotics.sdk.util.ThreadUtil; -// TODO: Auto-generated Javadoc +// Auto-generated Javadoc /** * The Class TestTimer. */ @@ -37,7 +37,7 @@ public void test() { t.initialize(500+(i++), new IthreadedTimoutListener() { @Override public void onTimeout(String message) { - System.out.println(message); + com.neuronrobotics.sdk.common.Log.error(message); timerTimedOut++; } });