public static void checkCorrectJointOrder(String fourBarName, RevoluteJoint masterJointA, PassiveRevoluteJoint passiveJointB, PassiveRevoluteJoint passiveJointC, PassiveRevoluteJoint passiveJointD) { boolean successorAisPredecessorB = masterJointA.getSuccessor() == passiveJointB.getPredecessor(); boolean successorBisPredecessorC = passiveJointB.getSuccessor() == passiveJointC.getPredecessor(); boolean succesorCisPredecessorD = passiveJointC.getSuccessor() == passiveJointD.getPredecessor(); if (!successorAisPredecessorB || !successorBisPredecessorC || !succesorCisPredecessorD) { throw new RuntimeException("The joints that form the " + fourBarName + " four bar must be passed in clockwise or counterclockwise order"); } if (DEBUG) { System.out.println("\nDebugging check joint order:\n\nsuccessor \t predecessor\n" + masterJointA.getSuccessor() + "\t " + passiveJointB.getPredecessor() + "\n" + passiveJointB.getSuccessor() + "\t " + passiveJointC.getPredecessor() + "\n" + passiveJointC.getSuccessor() + "\t " + passiveJointD.getPredecessor() + "\n"); } }
public static PassiveRevoluteJoint getFourBarOutputJoint(PassiveRevoluteJoint passiveJointB, PassiveRevoluteJoint passiveJointC, PassiveRevoluteJoint passiveJointD) { // If the output joint is D then it will have at least 1 child, otherwise it won't have any if(passiveJointD.getSuccessor().hasChildrenJoints()) { return passiveJointD; } // Joint C wil only have joint D as its child, unless it's the output joint of the fourbar else if (passiveJointC.getSuccessor().getChildrenJoints().size() > 1) { return passiveJointC; } else { return passiveJointB; } }
public static void checkCorrectJointOrder(String fourBarName, RevoluteJoint masterJointA, PassiveRevoluteJoint passiveJointB, PassiveRevoluteJoint passiveJointC, PassiveRevoluteJoint passiveJointD) { boolean successorAisPredecessorB = masterJointA.getSuccessor() == passiveJointB.getPredecessor(); boolean successorBisPredecessorC = passiveJointB.getSuccessor() == passiveJointC.getPredecessor(); boolean succesorCisPredecessorD = passiveJointC.getSuccessor() == passiveJointD.getPredecessor(); if (!successorAisPredecessorB || !successorBisPredecessorC || !succesorCisPredecessorD) { throw new RuntimeException("The joints that form the " + fourBarName + " four bar must be passed in clockwise or counterclockwise order"); } if (DEBUG) { System.out.println("\nDebugging check joint order:\n\nsuccessor \t predecessor\n" + masterJointA.getSuccessor() + "\t " + passiveJointB.getPredecessor() + "\n" + passiveJointB.getSuccessor() + "\t " + passiveJointC.getPredecessor() + "\n" + passiveJointC.getSuccessor() + "\t " + passiveJointD.getPredecessor() + "\n"); } }
public static PassiveRevoluteJoint getFourBarOutputJoint(PassiveRevoluteJoint passiveJointB, PassiveRevoluteJoint passiveJointC, PassiveRevoluteJoint passiveJointD) { // If the output joint is D then it will have at least 1 child, otherwise it won't have any if(passiveJointD.getSuccessor().hasChildrenJoints()) { return passiveJointD; } // Joint C wil only have joint D as its child, unless it's the output joint of the fourbar else if (passiveJointC.getSuccessor().getChildrenJoints().size() > 1) { return passiveJointC; } else { return passiveJointB; } }