def resetTargetPath(self): for obj in om.getObjects(): if obj.getProperty('Name') == 'target frame desired': om.removeFromObjectModel(obj) for obj in om.getObjects(): if obj.getProperty('Name') == 'target frame desired path': om.removeFromObjectModel(obj)
def getCandidates(self): namePrefix = self.properties.getProperty('Candidate name prefix') matchStr = '^%s [0-9]+$' % namePrefix return [ obj for obj in om.getObjects() if re.match(matchStr, obj.getProperty('Name')) ]
def getObjectByProp(prop): if not prop: return None for obj in om.getObjects(): if isinstance(obj, FrameItem) and obj.widget.GetRepresentation() == prop: return obj if isinstance(prop, vtk.vtkActor): return getObjectByDataSet(prop.GetMapper().GetInput())
def approveRefit(): for obj in om.getObjects(): if isinstance(obj, segmentation.BlockAffordanceItem): if 'refit' in obj.getProperty('Name'): originalObj = om.findObjectByName(obj.getProperty('Name').replace(' refit', '')) if originalObj: originalObj.params = obj.params originalObj.polyData.DeepCopy(obj.polyData) originalObj.actor.GetUserTransform().SetMatrix(obj.actor.GetUserTransform().GetMatrix()) originalObj.actor.GetUserTransform().Modified() obj.setProperty('Visible', False)
def spawnTargetAffordance(self): for obj in om.getObjects(): if obj.getProperty('Name') == 'target': om.removeFromObjectModel(obj) targetFrame = transformUtils.frameFromPositionAndRPY([0.6, 0.2, 0.6], [180, 0, 90]) folder = om.getOrCreateContainer('affordances') z = DebugData() z.addLine(np.array([0, 0, 0]), np.array([-self.boxLength, 0, 0]), radius=0.02) # main bar z.addLine(np.array([-self.boxLength, 0, 0]), np.array([-self.boxLength, 0, self.boxLength]), radius=0.02) # main bar z.addLine(np.array([-self.boxLength, 0, self.boxLength]), np.array([0, 0, self.boxLength]), radius=0.02) # main bar z.addLine(np.array([0, 0, self.boxLength]), np.array([0, 0, 0]), radius=0.02) # main bar targetMesh = z.getPolyData() self.targetAffordance = vis.showPolyData( targetMesh, 'target', color=[0.0, 1.0, 0.0], cls=affordanceitems.FrameAffordanceItem, parent=folder, alpha=0.3) self.targetAffordance.actor.SetUserTransform(targetFrame) self.targetFrame = vis.showFrame(targetFrame, 'target frame', parent=self.targetAffordance, visible=False, scale=0.2) self.targetFrame = self.targetFrame.transform params = dict(length=self.boxLength, otdf_type='target', friendly_name='target') self.targetAffordance.setAffordanceParams(params) self.targetAffordance.updateParamsFromActorTransform()
def spawnTargetAffordance(self): for obj in om.getObjects(): if obj.getProperty('Name') == 'target': om.removeFromObjectModel(obj) targetFrame = transformUtils.frameFromPositionAndRPY([0.6,0.2,0.6],[180,0,90]) folder = om.getOrCreateContainer('affordances') z = DebugData() z.addLine(np.array([0,0,0]), np.array([-self.boxLength,0,0]), radius=0.02) # main bar z.addLine(np.array([-self.boxLength,0,0]), np.array([-self.boxLength,0,self.boxLength]), radius=0.02) # main bar z.addLine(np.array([-self.boxLength,0,self.boxLength]), np.array([0,0,self.boxLength]), radius=0.02) # main bar z.addLine(np.array([0,0,self.boxLength]), np.array([0,0,0]), radius=0.02) # main bar targetMesh = z.getPolyData() self.targetAffordance = vis.showPolyData(targetMesh, 'target', color=[0.0, 1.0, 0.0], cls=affordanceitems.FrameAffordanceItem, parent=folder, alpha=0.3) self.targetAffordance.actor.SetUserTransform(targetFrame) self.targetFrame = vis.showFrame(targetFrame, 'target frame', parent=self.targetAffordance, visible=False, scale=0.2) self.targetFrame = self.targetFrame.transform params = dict(length=self.boxLength, otdf_type='target', friendly_name='target') self.targetAffordance.setAffordanceParams(params) self.targetAffordance.updateParamsFromActorTransform()
def updatePolyData(self, viewId, polyData): obj = self.polyDataObjects.get(viewId) if obj not in om.getObjects(): obj = None if not obj: hiddenMapIds = [9999] visibleDefault = False if viewId in hiddenMapIds else True obj = vis.PolyDataItem(self.getNameForViewId(viewId), polyData, self.view) obj.setProperty('Visible', visibleDefault) if obj._isPointCloud(): obj.setProperty('Color', [1, 1, 1]) obj.setProperty('Alpha', 0.5) else: obj.setProperty('Color', [0, 0.68, 1]) if viewId == lcmdrc.data_request_t.HEIGHT_MAP_SCENE: obj.setProperty('Surface Mode', 'Wireframe') folder = om.findObjectByName('Map Server') folder.addProperty('Min Range', self.reader.GetDistanceRange()[0], attributes=om.PropertyAttributes(decimals=2, minimum=0.0, maximum=100.0, singleStep=0.25, hidden=False)) folder.addProperty('Max Range', self.reader.GetDistanceRange()[1], attributes=om.PropertyAttributes(decimals=2, minimum=0.0, maximum=100.0, singleStep=0.25, hidden=False)) folder.addProperty('Edge Filter Angle', self.reader.GetEdgeAngleThreshold(), attributes=om.PropertyAttributes(decimals=0, minimum=0.0, maximum=60.0, singleStep=1, hidden=False)) om.addToObjectModel(obj, folder) om.expand(folder) self.folder = folder self.polyDataObjects[viewId] = obj else: obj.setPolyData(polyData) if self.colorizeCallback: self.colorizeCallback(obj)
def getCandidates(self): namePrefix = self.properties.getProperty('Candidate name prefix') matchStr = '^%s [0-9]+$' % namePrefix return [obj for obj in om.getObjects() if re.match(matchStr, obj.getProperty('Name'))]
def getObjectByDataSet(polyData): for obj in om.getObjects(): if obj.hasDataSet(polyData): return obj
if useMappingPanel: taskPanels['Mapping'] = mappingTaskPanel.widget tasklaunchpanel.init(taskPanels) splinewidget.init(view, handFactory, robotStateModel) rt.robotSystem = robotSystem taskManagerPanel = taskmanagerwidget.init() for taskDescription in loadTaskDescriptions(): taskManagerPanel.taskQueueWidget.loadTaskDescription(taskDescription[0], taskDescription[1]) taskManagerPanel.taskQueueWidget.setCurrentQueue('Task library') for obj in om.getObjects(): obj.setProperty('Deletable', False) if useCOPMonitor and not ikPlanner.fixedBaseArm: copMonitor = copmonitor.COPMonitor(robotSystem, view); if useLoggingWidget: w = lcmloggerwidget.LCMLoggerWidget(statusBar=app.getMainWindow().statusBar()) app.getMainWindow().statusBar().addPermanentWidget(w.button) if useControllerRate:
def getExistingRobotModels(): return [obj for obj in om.getObjects() if isinstance(obj, RobotModelItem)]
def getAffordances(self): return [ obj for obj in om.getObjects() if isinstance(obj, affordanceitems.AffordanceItem) ]
def getAffordances(self): return [obj for obj in om.getObjects() if isinstance(obj, affordanceitems.AffordanceItem)]