@@ -147,19 +147,18 @@ function generate()
147
147
sim .removeObjects {existingMotionPlanning }
148
148
end
149
149
150
- local jointGroupPath = sim .getObjectAliasRelative (jointGroup , robotModel , 1 )
151
-
152
150
local scriptText = ' '
153
151
local function appendLine (...)
154
152
scriptText = scriptText .. string.format (... ) .. ' \n '
155
153
end
156
154
appendLine (" sim = require 'sim'" )
157
155
appendLine (" simOMPL = require 'simOMPL'" )
158
- appendLine (" robotConfigPath = require 'models.robotConfigPath-2 '" )
156
+ appendLine (" robotConfigPath = require 'models.robotConfigPath-3 '" )
159
157
appendLine (" " )
160
158
appendLine (" function sysCall_init()" )
159
+ appendLine (" self = sim.getObject '.'" )
161
160
appendLine (" model = sim.getObject '::'" )
162
- appendLine (" jointGroup = sim.getObject('%s', {proxy = model}) " , jointGroupPath )
161
+ appendLine (" jointGroup = sim.getReferencedHandle(self, 'jointGroup') " )
163
162
appendLine (" joints = sim.getReferencedHandles(jointGroup)" )
164
163
appendLine (" " )
165
164
appendLine (" robotCollection = sim.createCollection()" )
@@ -205,7 +204,7 @@ function generate()
205
204
appendLine (' %s' , " printf('solved: %s (%s)', solved, hasApproximateSolution() and 'approximate' or 'exact')" )
206
205
appendLine (' %s' , " printf('path: %d states', #path)" )
207
206
appendLine (" if solved then" )
208
- appendLine (" robotConfigPath.create(path, model, '%s') " , jointGroupPath )
207
+ appendLine (" robotConfigPath.create(path, model, jointGroup) " )
209
208
appendLine (" end" )
210
209
appendLine (" end" )
211
210
@@ -216,24 +215,27 @@ function generate()
216
215
sim .setObjectPose (motionPlanningScript , {0 , 0 , 0 , 0 , 0 , 0 , 1 }, robotModel )
217
216
sim .setObjectInt32Param (motionPlanningScript , sim .objintparam_visibility_layer , 0 )
218
217
sim .setObjectInt32Param (motionPlanningScript , sim .objintparam_manipulation_permissions , 0 )
218
+ sim .setReferencedHandles (motionPlanningScript , {jointGroup }, ' jointGroup' )
219
219
220
- local startStateScript = sim .createScript (sim .scripttype_customization , [[ require 'models.robotConfig_customization-2 '
220
+ local startStateScript = sim .createScript (sim .scripttype_customization , [[ require 'models.robotConfig_customization-3 '
221
221
model = sim.getObject '::'
222
- jointGroupPath = ' ]] .. jointGroupPath .. " ' " )
222
+ ]] )
223
223
sim .setObjectAlias (startStateScript , ' StartState' )
224
224
sim .setObjectParent (startStateScript , motionPlanningScript , false )
225
225
sim .setObjectPose (startStateScript , {0 , 0 , 0 , 0 , 0 , 0 , 1 }, motionPlanningScript )
226
226
sim .setObjectInt32Param (startStateScript , sim .objintparam_visibility_layer , 0 )
227
227
sim .setObjectInt32Param (startStateScript , sim .objintparam_manipulation_permissions , 0 )
228
- local goalStateScript = sim .createScript (sim .scripttype_customization , [[ require 'models.robotConfig_customization-2'
228
+ sim .setReferencedHandles (startStateScript , {jointGroup }, ' jointGroup' )
229
+ local goalStateScript = sim .createScript (sim .scripttype_customization , [[ require 'models.robotConfig_customization-3'
229
230
model = sim.getObject'::'
230
- jointGroupPath = ' ]] .. jointGroupPath .. [[ '
231
- color = {0, 1, 0} ]] )
231
+ color = {0, 1, 0}
232
+ ]] )
232
233
sim .setObjectAlias (goalStateScript , ' GoalState' )
233
234
sim .setObjectParent (goalStateScript , motionPlanningScript , false )
234
235
sim .setObjectPose (goalStateScript , {0 , 0 , 0 , 0 , 0 , 0 , 1 }, motionPlanningScript )
235
236
sim .setObjectInt32Param (goalStateScript , sim .objintparam_visibility_layer , 0 )
236
237
sim .setObjectInt32Param (goalStateScript , sim .objintparam_manipulation_permissions , 0 )
238
+ sim .setReferencedHandles (goalStateScript , {jointGroup }, ' jointGroup' )
237
239
238
240
sim .announceSceneContentChange ()
239
241
0 commit comments