Skip to content

Commit 03aa4c2

Browse files
committed
Adding helper functions
1 parent 7e0428e commit 03aa4c2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

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

115115
private Runnable renderWrangler=null;
116+
116117
public int getLinkIndex(AbstractLink l) {
117118
for (int i=0;i<getNumberOfLinks();i++) {
118119
if(getAbstractLink(i)==l)
119120
return i;
120121
}
121122
return -1;
122123
}
124+
public int getLinkIndex(LinkConfiguration l) {
125+
for (int i=0;i<getNumberOfLinks();i++) {
126+
if(getAbstractLink(i).getLinkConfiguration()==l)
127+
return i;
128+
}
129+
return -1;
130+
}
123131

124132
/**
125133
* Gets the root listener.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,12 @@ public void setDH_Alpha(int index, double value) {
795795
public DHLink getDhLink(int i) {
796796
return getDhChain().getLinks().get(i);
797797
}
798+
public DHLink getDhLink(AbstractLink myLink) {
799+
return getDhChain().getLinks().get(getLinkIndex(myLink));
800+
}
801+
public DHLink getDhLink(LinkConfiguration myLink) {
802+
return getDhChain().getLinks().get(getLinkIndex(myLink));
803+
}
798804
public Object getListener(int i) {
799805
return getDhChain().getLinks().get(i).getListener();
800806
}

0 commit comments

Comments
 (0)