view, parent='sensors', urdfFile=urdf_path, color=roboturdf.getRobotGrayColor(), visible=True) segmentationroutines.SegmentationContext.initWithRobot(robotStateModel) # load poly data dataDir = app.getTestingDataDirectory() polyData = ioutils.readPolyData( os.path.join(dataDir, 'misc/valve/valve-sparse-stereo.pcd')) vis.showPolyData(polyData, 'pointcloud snapshot original', colorByName='rgb_colors') polyData = segmentationroutines.sparsifyStereoCloud(polyData) vis.showPolyData(polyData, 'pointcloud snapshot') # fit valve and lever segmentation.segmentValveWallAuto( .2, mode='valve', removeGroundMethod=segmentation.removeGroundSimple) if app.getTestingInteractiveEnabled(): v = applogic.getCurrentView() v.camera().SetPosition([3, 3, 3]) v.camera().SetFocalPoint([0, 0, 0]) view.show() app.showObjectModel() app.start()
robotStateModel, robotStateJointController = roboturdf.loadRobotModel('robot state model', view, parent='sensors', color=roboturdf.getRobotGrayColor(), visible=True) segmentationroutines.SegmentationContext.initWithRobot(robotStateModel) # Move robot to near to valve wall: # 0degrees #robotStateJointController.q[5] = math.radians(120) #robotStateJointController.q[0] = 0 #robotStateJointController.q[1] = 0 # 30,60,90 robotStateJointController.q [5] = math.radians(-120) robotStateJointController.q [0] = 1 robotStateJointController.q [1] = 1 robotStateJointController.q[2] = 0.85 robotStateJointController.push() # load poly data dataDir = app.getTestingDataDirectory() #polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene.vtp')) #polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene-30.vtp')) #polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene-60.vtp')) polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene-90.vtp')) vis.showPolyData(polyData, 'pointcloud snapshot') segmentation.segmentValveWallAuto(.2, mode='both', removeGroundMethod=segmentation.removeGround ) if app.getTestingInteractiveEnabled(): view.show() app.showObjectModel() app.start()
app = ConsoleApp() # create a view view = app.createView() segmentation._defaultSegmentationView = view segmentation.initAffordanceManager(view) robotStateModel, robotStateJointController = roboturdf.loadRobotModel('robot state model', view, parent='sensors', color=roboturdf.getRobotGrayColor(), visible=True) segmentationroutines.SegmentationContext.initWithRobot(robotStateModel) # load poly data dataDir = app.getTestingDataDirectory() polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-sparse-stereo.pcd')) vis.showPolyData(polyData, 'pointcloud snapshot original', colorByName='rgb_colors') polyData = segmentationroutines.sparsifyStereoCloud( polyData ) vis.showPolyData(polyData, 'pointcloud snapshot') # fit valve and lever segmentation.segmentValveWallAuto(.2, mode='valve', removeGroundMethod=segmentation.removeGroundSimple ) if app.getTestingInteractiveEnabled(): v = applogic.getCurrentView() v.camera().SetPosition([3,3,3]) v.camera().SetFocalPoint([0,0,0]) view.show() app.showObjectModel() app.start()
# Move robot to near to valve wall: # 0degrees #robotStateJointController.q[5] = math.radians(120) #robotStateJointController.q[0] = 0 #robotStateJointController.q[1] = 0 # 30,60,90 robotStateJointController.q[5] = math.radians(-120) robotStateJointController.q[0] = 1 robotStateJointController.q[1] = 1 robotStateJointController.q[2] = 0.85 robotStateJointController.push() # load poly data dataDir = app.getTestingDataDirectory() #polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene.vtp')) #polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene-30.vtp')) #polyData = ioUtils.readPolyData(os.path.join(dataDir, 'valve/valve-lever-scene-60.vtp')) polyData = ioUtils.readPolyData( os.path.join(dataDir, 'valve/valve-lever-scene-90.vtp')) vis.showPolyData(polyData, 'pointcloud snapshot') segmentation.segmentValveWallAuto(.2, mode='both', removeGroundMethod=segmentation.removeGround) if app.getTestingInteractiveEnabled(): view.show() app.showObjectModel() app.start()