class ToggleImageViewHandler(object): def __init__(self, manager): self.action = app.getToolsMenuActions()['ActionToggleImageView'] self.action.connect('triggered()', self.toggle) self.manager = manager def toggle(self): if self.action.checked: self.manager.show() else: self.manager.hide() imageOverlayManager = ImageOverlayManager() imageWidget = cameraview.ImageWidget(cameraview.imageManager, 'CAMERA_LEFT', view, visible=False) imageViewHandler = ToggleImageViewHandler(imageWidget) setImageWidgetSource = imageWidget.setImageName screengrabberpanel.init(view) framevisualization.init(view) affordancePanel = affordancepanel.init(view, affordanceManager, robotStateJointController, raycastDriver) camerabookmarks.init(view) cameraControlPanel = cameracontrolpanel.CameraControlPanel(view) app.addWidgetToDock(cameraControlPanel.widget, action=None).hide()
robotHighlighter = RobotLinkHighlighter(robotSystem.robotStateModel) if useDataFiles: for filename in drcargs.args().data_files: actionhandlers.onOpenFile(filename) cameras = [ camera["name"] for camera in directorConfig["sensors"]["camera"]["color"] ] imageOverlayManager = ImageOverlayManager(cameras, robotSystem.robotName) imageWidget = cameraview.ImageWidget( cameraview.imageManager, cameras, view, visible=False, robotName=robotSystem.robotName, ) imageViewHandler = ToggleImageViewHandler(imageWidget) screengrabberpanel.init(view, imageWidget, robotSystem.robotName) framevisualization.init(view, robotSystem) affordancePanel = affordancepanel.init( view, robotSystem.affordanceManager, robotSystem.robotStateJointController) def drawCenterOfMass(model): stanceFrame = robotSystem.footstepsDriver.getFeetMidPoint(model) com = list(model.model.getCenterOfMass()) com[2] = stanceFrame.GetPosition()[2]