@@ -117,15 +117,15 @@ public abstract class AbstractKinematicsNR extends NonBowlerDevice implements IP
117117 private Runnable renderWrangler =null ;
118118
119119 public int getLinkIndex (AbstractLink l ) {
120- for (int i = 0 ; i < getNumberOfLinks ();i ++) {
121- if (getAbstractLink (i )== l )
120+ for (int i = 0 ; i < getNumberOfLinks (); i ++) {
121+ if (getAbstractLink (i ) == l )
122122 return i ;
123123 }
124124 return -1 ;
125125 }
126126 public int getLinkIndex (LinkConfiguration l ) {
127- for (int i = 0 ; i < getNumberOfLinks ();i ++) {
128- if (getAbstractLink (i ).getLinkConfiguration ()== l )
127+ for (int i = 0 ; i < getNumberOfLinks (); i ++) {
128+ if (getAbstractLink (i ).getLinkConfiguration () == l )
129129 return i ;
130130 }
131131 return -1 ;
@@ -223,8 +223,9 @@ public AbstractKinematicsNR() {
223223 */
224224 public AbstractKinematicsNR (InputStream configFile , LinkFactory f ) {
225225 this ();
226- if ( configFile == null || f == null )
226+ if (( configFile == null ) || ( f == null ) )
227227 return ;
228+
228229 Document doc = XmlFactory .getAllNodesDocument (configFile );
229230 NodeList nodListofLinks = doc .getElementsByTagName ("appendage" );
230231 for (int i = 0 ; i < 1 ; i ++) {
@@ -546,9 +547,9 @@ public double[] getCurrentJointSpaceVector() {
546547
547548 public double [] getCurrentJointSpaceTarget () {
548549
549- double [] currentJointSpaceTarget = new double [getNumberOfLinks ()];
550- for (int i = 0 ; i < currentJointSpaceTarget .length ;i ++) {
551- currentJointSpaceTarget [i ]= readLinkTarget (i );
550+ double [] currentJointSpaceTarget = new double [getNumberOfLinks ()];
551+ for (int i = 0 ; i < currentJointSpaceTarget .length ; i ++) {
552+ currentJointSpaceTarget [i ] = readLinkTarget (i );
552553 }
553554 return currentJointSpaceTarget ;
554555 }
@@ -574,15 +575,15 @@ public double[] setDesiredTaskSpaceTransform(TransformNR taskSpaceTransform, dou
574575 TickToc .tic ("inverseOffset" );
575576 double [] jointSpaceVect = inverseKinematics (inverseOffset );
576577 TickToc .tic ("inverseKinematics" );
577- if (checkVector (this ,jointSpaceVect ,seconds )) {
578+ if (checkVector (this , jointSpaceVect , seconds )) {
578579 TickToc .tic ("checkVector success" );
579580 if (jointSpaceVect == null )
580581 throw new RuntimeException ("The kinematics model must return an array, not null" );
581582
582- _setDesiredJointSpaceVector (jointSpaceVect , seconds ,false );
583+ _setDesiredJointSpaceVector (jointSpaceVect , seconds , false );
583584 TickToc .tic ("_setDesiredJointSpaceVector complete" );
584585 return jointSpaceVect ;
585- }else
586+ } else
586587 TickToc .tic ("checkVector fail" );
587588
588589 double [] currentJointSpaceTarget2 = getCurrentJointSpaceTarget ();
@@ -620,40 +621,41 @@ private static boolean checkVector(AbstractKinematicsNR dev, double[] jointSpace
620621 for (int i = 0 ; i < jointSpaceVect .length ; i ++) {
621622 AbstractLink link = dev .factory .getLink (dev .getLinkConfiguration (i ));
622623 double val = jointSpaceVect [i ];
623- Double double1 = new Double ( val );
624- if ( double1 .isNaN () ||double1 .isInfinite () ) {
625- Log .error (dev .getScriptingName ()+ " Link " + i + " Invalid unput " + double1 );
624+
625+ if ( Double .isNaN (val ) || Double .isInfinite (val ) ) {
626+ Log .error (dev .getScriptingName () + " Link " + i + " Invalid input " + val );
626627 return false ;
627628 }
628629 if (val > link .getMaxEngineeringUnits ()) {
629- Log .error (dev .getScriptingName ()+ " Link " + i + " can not reach " + val + " limited to " + link .getMaxEngineeringUnits ());
630+ Log .error (dev .getScriptingName () + " Link " + i + " can not reach " + val + " limited to " + link .getMaxEngineeringUnits ());
630631 return false ;
631632 }
632633 if (val < link .getMinEngineeringUnits ()) {
633- Log .error (dev .getScriptingName ()+ " Link " + i + " can not reach " + val + " limited to " + link .getMinEngineeringUnits ());
634+ Log .error (dev .getScriptingName () + " Link " + i + " can not reach " + val + " limited to " + link .getMinEngineeringUnits ());
634635 return false ;
635636 }
636- if (seconds > 0 ) {
637+ if (seconds > 0 ) {
637638 double maxVel = Math .abs (link .getMaxVelocityEngineeringUnits ());
638639 double deltaPosition = Math .abs (current [i ] - jointSpaceVect [i ]);
639- double computedVelocity = deltaPosition / seconds ;
640- if ((computedVelocity -maxVel )>0.0001 ) {
641- Log .error ("Link " + i + " can not move at rate of " + computedVelocity + " capped at " + maxVel + " requested position of " + jointSpaceVect [i ]+ " from current position of " + current [i ]+ " in " + seconds + " seconds" );
640+ double computedVelocity = deltaPosition / seconds ;
641+ if ((computedVelocity -maxVel )>0.0001 ) {
642+ Log .error ("Link " + i + " can not move at rate of " + computedVelocity + " capped at " + maxVel + " requested position of " + jointSpaceVect [i ] + " from current position of " + current [i ] + " in " + seconds + " seconds" );
642643 return false ;
643644 }
644645 }
645646 }
646647 return true ;
647648 }
648649
650+
649651 /**
650652 * Checks the desired pose for ability for the IK to calculate a valid pose.
651653 *
652654 * @param taskSpaceTransform the task space transform
653655 * @return True if pose is reachable, false if it is not
654656 */
655657 public boolean checkTaskSpaceTransform (TransformNR taskSpaceTransform , double seconds ) {
656- return AbstractKinematicsNR .checkTaskSpaceTransform (this , taskSpaceTransform ,seconds );
658+ return AbstractKinematicsNR .checkTaskSpaceTransform (this , taskSpaceTransform , seconds );
657659 }
658660 /**
659661 * Checks the desired pose for ability for the IK to calculate a valid pose.
@@ -662,7 +664,7 @@ public boolean checkTaskSpaceTransform(TransformNR taskSpaceTransform, double se
662664 * @return True if pose is reachable, false if it is not
663665 */
664666 public boolean checkTaskSpaceTransform (TransformNR taskSpaceTransform ) {
665- return checkTaskSpaceTransform (this , taskSpaceTransform ,0 );
667+ return checkTaskSpaceTransform (this , taskSpaceTransform , 0 );
666668 }
667669
668670 /**
@@ -689,7 +691,7 @@ public double getBestTime(TransformNR currentTaskSpaceTransform) {
689691 * @return the time of translation at best possible speed based on checking each link
690692 */
691693 public double getBestTime (double [] jointSpaceVect ) {
692- double best = 0 ;
694+ double best = 0 ;
693695 double [] current = getCurrentJointSpaceTarget ();
694696 for (int i = 0 ; i < current .length ; i ++) {
695697 AbstractLink link = getAbstractLink (i );
@@ -730,8 +732,8 @@ private double[] _setDesiredJointSpaceVector(double[] jointSpaceVect, double se
730732 + " links, actual number of links = " + jointSpaceVect .length );
731733 }
732734 double best = getBestTime (jointSpaceVect );
733- if (seconds < best )
734- seconds = best ;
735+ if (seconds < best )
736+ seconds = best ;
735737 //synchronized(AbstractKinematicsNR.class) {
736738 int except = 0 ;
737739 Exception e = null ;
@@ -762,7 +764,7 @@ private double[] _setDesiredJointSpaceVector(double[] jointSpaceVect, double se
762764 TickToc .tic ("FK from vector" );
763765 fireTargetJointsUpdate (getCurrentJointSpaceTarget (), fwd );
764766 TickToc .tic ("Joint space updates" );
765- if (fireTaskUpdate ) {
767+ if (fireTaskUpdate ) {
766768 setCurrentPoseTarget (forwardOffset (fwd ));
767769 TickToc .tic ("task space updates" );
768770 }
@@ -952,7 +954,7 @@ public void setGlobalToFiducialTransform(TransformNR frameToBase, boolean fireUp
952954 return ;
953955 }
954956 this .fiducial2RAS = frameToBase ;
955- if (!fireUpdate )
957+ if (!fireUpdate )
956958 return ;
957959 for (int i = 0 ; i < regListeners .size (); i ++) {
958960 IRegistrationListenerNR r = regListeners .get (i );
@@ -1009,8 +1011,9 @@ public TransformNR forwardOffset(TransformNR t) {
10091011 * @param l the l
10101012 */
10111013 public void addJointSpaceListener (IJointSpaceUpdateListenerNR l ) {
1012- if (jointSpaceUpdateListeners .contains (l ) || l == null )
1014+ if (jointSpaceUpdateListeners .contains (l ) || ( l == null ) )
10131015 return ;
1016+
10141017 jointSpaceUpdateListeners .add (l );
10151018 }
10161019
@@ -1030,8 +1033,9 @@ public void removeJointSpaceUpdateListener(IJointSpaceUpdateListenerNR l) {
10301033 * @param l the l
10311034 */
10321035 public void addRegistrationListener (IRegistrationListenerNR l ) {
1033- if (regListeners .contains (l ) || l == null )
1036+ if (regListeners .contains (l ) || ( l == null ) )
10341037 return ;
1038+
10351039 regListeners .add (l );
10361040 l .onBaseToFiducialUpdate (this , getRobotToFiducialTransform ());
10371041 }
@@ -1052,7 +1056,7 @@ public void removeRegestrationUpdateListener(IRegistrationListenerNR l) {
10521056 * @param l the l
10531057 */
10541058 public void addPoseUpdateListener (ITaskSpaceUpdateListenerNR l ) {
1055- if (taskSpaceUpdateListeners .contains (l ) || l == null ) {
1059+ if (taskSpaceUpdateListeners .contains (l ) || ( l == null ) ) {
10561060 return ;
10571061 }
10581062 // new RuntimeException("adding "+l.getClass().getName()).printStackTrace();
@@ -1083,16 +1087,16 @@ public void onLinkPositionUpdate(AbstractLink source, double engineeringUnitsVal
10831087 for (LinkConfiguration c : getLinkConfigurations ()) {
10841088 AbstractLink tmp = getFactory ().getLink (c );
10851089 if (tmp == source ) {// Check to see if this lines up with a known link
1086- // // Log.info("Got PID event "+ source+ " value="+ engineeringUnitsValue);
1087- // if(new Double(engineeringUnitsValue).isNaN()) {
1088- // new RuntimeException("Link values can not ne NaN").printStackTrace();
1089- // engineeringUnitsValue= 0;
1090+ // // Log.info("Got PID event " + source + " value=" + engineeringUnitsValue);
1091+ // if (new Double(engineeringUnitsValue).isNaN()) {
1092+ // new RuntimeException("Link values can not be NaN").printStackTrace();
1093+ // engineeringUnitsValue = 0;
10901094// }
10911095// ArrayList<LinkConfiguration> linkConfigurations = getLinkConfigurations();
1092- // if(linkConfigurations!=null) {
1096+ // if (linkConfigurations!=null) {
10931097// int indexOf = linkConfigurations.indexOf(c);
1094- // if(currentJointSpacePositions!= null)
1095- // if( indexOf>=0 && indexOf< currentJointSpacePositions.length)
1098+ // if (currentJointSpacePositions != null)
1099+ // if (( indexOf >= 0) && ( indexOf < currentJointSpacePositions.length) )
10961100// currentJointSpacePositions[indexOf] = engineeringUnitsValue;
10971101// }
10981102 firePoseUpdate ();
@@ -1200,7 +1204,7 @@ public void onPIDEvent(PIDEvent e) {
12001204 * @param link the link
12011205 */
12021206 public void homeLink (int link ) {
1203- if (link < 0 || link >= getNumberOfLinks ()) {
1207+ if (( link < 0 ) || ( link >= getNumberOfLinks () )) {
12041208 throw new IndexOutOfBoundsException (
12051209 "There are only " + getNumberOfLinks () + " known links, requested:" + link );
12061210 }
@@ -1637,7 +1641,7 @@ public void clearChangeListener(int linkIndex) {
16371641
16381642 public void runRenderWrangler () {
16391643 firePoseUpdate ();
1640- if (renderWrangler != null )
1644+ if (renderWrangler != null )
16411645 try {
16421646 renderWrangler .run ();
16431647 }catch (Throwable t ) {
@@ -1719,7 +1723,7 @@ public InterpolationMoveState blockingInterpolatedMove(TransformNR target, doubl
17191723 }
17201724 wait ((int ) msPerStep );
17211725 }
1722- }else {
1726+ } else {
17231727 return InterpolationMoveState .FAULT ;
17241728 }
17251729 return InterpolationMoveState .READY ;
@@ -1728,7 +1732,7 @@ public InterpolationMoveState blockingInterpolatedMove(TransformNR target, doubl
17281732 public void setTimeProvider (ITimeProvider t ) {
17291733 super .setTimeProvider (t );
17301734 imu .setTimeProvider (getTimeProvider ());
1731- for (int i = 0 ; i < getNumberOfLinks ();i ++) {
1735+ for (int i = 0 ; i < getNumberOfLinks (); i ++) {
17321736 AbstractLink l = getAbstractLink (i );
17331737 l .setTimeProvider (getTimeProvider ());
17341738 }
0 commit comments