Skip to content

Commit 663b7ed

Browse files
committed
require that teh affine listener is set before attaching a new link
1 parent 26eea02 commit 663b7ed

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.w3c.dom.Element;
1010

1111
import Jama.Matrix;
12+
import javafx.scene.transform.Affine;
1213

1314
import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
1415
import com.neuronrobotics.sdk.addons.kinematics.xml.XmlFactory;
@@ -580,11 +581,20 @@ public void addNewLink(LinkConfiguration newLink, DHLink dhLink) {
580581
LinkFactory factory = getFactory();
581582
// remove the link listener while the number of links could chnage
582583
factory.removeLinkListener(this);
583-
factory.getLink(newLink);// adds new link internally
584+
AbstractLink link = factory.getLink(newLink);// adds new link internally
585+
if(dhLink.getListener()==null)
586+
throw new RuntimeException("FAIL the link listner must be set to dhLink.setListener(new Affine());");
587+
link.setGlobalPositionListener(dhLink.getListener());
584588
DHChain chain = getDhChain();
585589
chain.addLink(dhLink);
586590
// set the modified kinematics chain
587591
setChain(chain);
592+
if (newLink.isTool()) {
593+
dhLink.setLinkType(DhLinkType.TOOL);
594+
} else if (newLink.isPrismatic())
595+
dhLink.setLinkType(DhLinkType.PRISMATIC);
596+
else
597+
dhLink.setLinkType(DhLinkType.ROTORY);
588598
// once the new link configuration is set up, re add the listener
589599
factory.addLinkListener(this);
590600
}

0 commit comments

Comments
 (0)