Skip to content

Commit 7e0428e

Browse files
committed
helper functions
1 parent 6562e8e commit 7e0428e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/main/java/com/neuronrobotics/sdk/addons/kinematics/AbstractKinematicsNR.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ public abstract class AbstractKinematicsNR extends NonBowlerDevice implements IP
113113
private IMU imu = new IMU();
114114

115115
private Runnable renderWrangler=null;
116+
public int getLinkIndex(AbstractLink l) {
117+
for (int i=0;i<getNumberOfLinks();i++) {
118+
if(getAbstractLink(i)==l)
119+
return i;
120+
}
121+
return -1;
122+
}
116123

117124
/**
118125
* Gets the root listener.

src/main/java/com/neuronrobotics/sdk/addons/kinematics/MobileBase.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ public HashMap<DHParameterKinematics, TransformNR> getTipLocations() {
9393
}
9494
return tipList;
9595
}
96-
96+
public DHParameterKinematics getLimb(AbstractLink l) {
97+
for(DHParameterKinematics k:getAllDHChains()) {
98+
if(k.getLinkIndex(l)>=0)
99+
return k;
100+
}
101+
return null;
102+
}
97103
public boolean pose(TransformNR newAbsolutePose) throws Exception {
98104
HashMap<DHParameterKinematics, TransformNR> tipLocations = getTipLocations();
99105

0 commit comments

Comments
 (0)