@@ -89,14 +89,12 @@ public class PhysicicsDevice extends NonBowlerDevice{
89
89
def hidEventEngine;
90
90
def physicsSource ;
91
91
int count = 0 ;
92
- Closure event = {
92
+ Runnable run = {
93
93
94
94
95
95
count ++
96
96
if (count > 10 ){
97
97
count = 0
98
- // Get the DHChain object
99
- DHChain chain = physicsSource. getChain()
100
98
// Setup of variables done, next perfoem one compute cycle
101
99
102
100
// get the current FK pose to update the data used by the jacobian computation
@@ -106,36 +104,37 @@ public class PhysicicsDevice extends NonBowlerDevice{
106
104
// get the position of all the joints in engineering units
107
105
double [] jointSpaceVector = physicsSource. getCurrentJointSpaceVector()
108
106
// compute the Jacobian using Jama matrix library
109
- Matrix jacobian = physicsSource. getJacobian(chain,jointSpaceVector,jointSpaceVector . length -1 );
107
+ Matrix jacobian = physicsSource. getJacobian();
110
108
Matrix [] massMatrix = new Matrix [jointSpaceVector. length]
111
109
Matrix [] incrementalJacobian = new Matrix [jointSpaceVector. length]
112
110
double [] masses = new double [jointSpaceVector. length]
113
111
// TODO LoadMasses and mass Matrix here
114
112
115
113
for (int i= 0 ;i< jointSpaceVector. length;i++ ){
116
- incrementalJacobian[i] = getJacobian(chain, jointSpaceVector,i);
114
+ incrementalJacobian[i] = physicsSource . getJacobian(jointSpaceVector,i);
117
115
118
- println " Increment " + i+ " " + TransformNR . getMatrixString(incrementalJacobian[i])
116
+ // println "Increment "+i+" "+ TransformNR.getMatrixString(incrementalJacobian[i])
119
117
}
120
- println " Total " + TransformNR . getMatrixString(jacobian)
118
+ // println "Total "+ TransformNR.getMatrixString(jacobian)
121
119
122
120
}
123
121
}
124
122
public PhysicicsDevice (def c ,def d ){
125
123
hidEventEngine= c;
126
124
physicsSource= d;
127
- hidEventEngine. addEvent(37 ,event )
125
+ hidEventEngine. arm . addEvent(37 ,run )
128
126
129
127
}
130
128
@Override
131
129
public void disconnectDeviceImp (){
132
130
println " Physics Termination signel shutdown"
133
- hidEventEngine. removeEvent(37 ,event )
131
+ hidEventEngine. arm . removeEvent(37 ,run )
134
132
}
135
133
136
134
@Override
137
135
public boolean connectDeviceImp (){
138
136
println " Physics Startup signel "
137
+ return true
139
138
}
140
139
public ArrayList<String > getNamespacesImp (){
141
140
// no namespaces on dummy
@@ -171,7 +170,7 @@ def base =DeviceManager.getSpecificDevice( "HephaestusArm",{
171
170
return m
172
171
})
173
172
174
- return base
173
+ // return base
175
174
176
175
def physics = DeviceManager . getSpecificDevice( " HephaestusPhysics" ,{
177
176
PhysicicsDevice pd = new PhysicicsDevice (dev,base. getAllDHChains(). get(0 ))
0 commit comments