Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kh/time keeper update #35

Open
wants to merge 60 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
fc6f2fb
Adding time keeper code throughout the kinematics stack, the mobil base
madhephaestus Mar 20, 2024
1770997
Adding wait and sleep
madhephaestus Mar 20, 2024
461e658
adding a listener for timebase change
madhephaestus Mar 20, 2024
b40e017
adding helper functions
madhephaestus Mar 20, 2024
1a4fb20
fix old warning
madhephaestus Mar 20, 2024
ad33397
removing the compile error
madhephaestus Mar 20, 2024
326d935
adding comments
madhephaestus Mar 21, 2024
d03c232
catch null excceptions
madhephaestus Mar 21, 2024
b636fe4
revert changed to reflection code, this is the correct way to do this,
madhephaestus Mar 21, 2024
d4f7be5
adding helper functions
madhephaestus Mar 21, 2024
9d6b057
add helper functions to detect if a link is a foot or wheel
madhephaestus Mar 21, 2024
22da067
working helper function
madhephaestus Mar 21, 2024
ba0ba69
Fixed a bug in how the masses of tags were loaded.
madhephaestus Mar 24, 2024
6a6a069
fully robust Unit test that checks loaded XML against exported XML
madhephaestus Mar 24, 2024
728b103
A refresh of the Vitamins layer using objecte and properly integrating
madhephaestus Mar 24, 2024
7200666
add cnfiguration listeners
madhephaestus Mar 24, 2024
99cb4cd
use vitamin configuration listners
madhephaestus Mar 24, 2024
0f25ece
renamed the api to add
madhephaestus Mar 24, 2024
d17fc03
testing adding additional vitamins on a link
madhephaestus Mar 24, 2024
d266c31
Adding vitamin to lin
madhephaestus Mar 24, 2024
f86ae42
runtime smoke test
madhephaestus Mar 24, 2024
7cd504d
loading of vitamins using a manipuable object
madhephaestus Mar 25, 2024
9761964
mks having vitamins into an interface
madhephaestus Mar 25, 2024
65ccfce
add print string helper functions
madhephaestus Apr 4, 2024
838acaf
Adding accessor methods to dh parameters and abstriact link to access
madhephaestus Apr 7, 2024
ffb1087
More accessor methods
madhephaestus Apr 7, 2024
93bf0b0
add fire of the change event for setting location
madhephaestus Apr 7, 2024
bcb6ca6
add configuration change update
madhephaestus Apr 7, 2024
d799358
Add a frame definition to the vitamin
madhephaestus Apr 9, 2024
cb55def
default methods for getting vitamins of a given frame
madhephaestus Apr 9, 2024
f3dc7de
fire the event from each vitamin added
madhephaestus Apr 10, 2024
560aad3
only force the default frame on the motor and shaft if it is not defined
madhephaestus Apr 14, 2024
f5117e1
Remove the listeners from Gson load and unload and make a unit test for
Apr 18, 2024
2ca90c3
do not have a null constructor
Apr 19, 2024
e4eeee2
Make sure add vitamin rejects duplicate names
Apr 19, 2024
8667f98
Adding a tostring for all devices
Apr 19, 2024
b4b4cd0
updating the defaults for servos and shafts
Apr 24, 2024
bbb7af0
force loading of default vitamins
Apr 24, 2024
2943207
change the way vitamin defaults are loaded
Apr 24, 2024
1d8f5e4
add comments
May 2, 2024
f02816a
set time based on the best time
madhephaestus May 5, 2024
2fc3287
frame can not be null
May 6, 2024
f34bf8c
less dramatic euler fix
Jul 9, 2024
bf8208a
Adding a field to the XML, and to the test for that field
Jul 10, 2024
c147d6b
ensure all values are set when instantiating a vitamin
Jul 10, 2024
f35e1fa
Fix the typo in the access to the script boolean id
Jul 10, 2024
44bae57
Allow foe no script tags
Jul 11, 2024
1379b93
compatibilit
Jul 15, 2024
5862915
replace jars with gradle imports
Jul 16, 2024
12d9d0e
replace jar with gradle import
Jul 16, 2024
abda742
adding repo for the new dep
Jul 16, 2024
86182bb
remove unused dep
Jul 16, 2024
f0c79d2
Adding the Depricated API back in to maintain compatibility with
madhephaestus Jul 19, 2024
b30018f
changing the storage type to be more compatible with json encoding
madhephaestus Jul 25, 2024
a7ddf0e
Adding helper methods for the transforms to allow pure rotation
madhephaestus Jul 25, 2024
da4cf32
rename variable to correct spelling
madhephaestus Jul 25, 2024
79b257a
adding to the comment to make the dataatype more explicate
madhephaestus Jul 25, 2024
188a01f
Allow construction using an axis and and angle
madhephaestus Aug 15, 2024
b61304b
construct from other transform
madhephaestus Sep 7, 2024
af1c55a
removing all print staatements from Java-Bowler
madhephaestus Oct 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 37 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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(
Expand All @@ -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'
Expand All @@ -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'


}

Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void main(String[] args) {
// }
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();
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public UDPClientTest(){
clnt=new UDPBowlerConnection();

// ArrayList<InetAddress> 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));
Expand All @@ -42,15 +42,15 @@ public UDPClientTest(){
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<numPings;i++)
if (!ping())
throw new RuntimeException("Ping failed!");
System.out.println("Ping average = "+(System.currentTimeMillis()-start)/numPings+"ms");
com.neuronrobotics.sdk.common.Log.error("Ping average = "+(System.currentTimeMillis()-start)/numPings+"ms");
clnt.disconnect();
System.out.println("done");
com.neuronrobotics.sdk.common.Log.error("done");
System.exit(0);
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public static void main(String [] args){
new UDPClientTest();
}catch (Exception e){
e.printStackTrace();
System.err.println("###Client Failed out!");
com.neuronrobotics.sdk.common.Log.error("###Client Failed out!");
System.exit(1);
}
}
Expand Down
Binary file removed libs/bluecove-2.1.1.jar
Binary file not shown.
Binary file removed libs/bluecove-gpl-2.1.1.jar
Binary file not shown.
Binary file removed libs/motej.0.9.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,24 @@ public DyIOConversation(IChatLog log) {
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()+" from: "+message.getFrom());
com.neuronrobotics.sdk.common.Log.error("Received: " + message.getBody()+" from: "+message.getFrom());
if(log!=null){
log.onLogEvent(""+message.getFrom()+">> "+ 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());
}
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -203,7 +203,7 @@ 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<tokens.length;i++){
tokens[i] = tokens[i].trim();
Expand All @@ -163,7 +163,7 @@ public void processSingleGCODELine(String line) throws Exception{
nextLine.storeWord(code, val);
}
}
//System.out.println(nextLine);
//com.neuronrobotics.sdk.common.Log.error(nextLine);
executeLine(line);
}

Expand Down
Loading
Loading