コード例 #1
0
	def __init__(self):
		
		ShowBase.__init__(self)
		
		mousePicker = Picker()
		
		#load the models
		obj1 = loader.loadModel('panda')
		obj2 = loader.loadModel('teapot')
		obj3 = loader.loadModel('box')
		
		obj1.reparentTo(render)
		obj1.setPos(camera,0,100,0)
		
		obj2.reparentTo(render)
		obj2.setPos(obj1, -30, 0, 0)
		
		obj3.reparentTo(render)
		obj3.setPos(obj1, 30,0,0)
		
		mousePicker.makePickable(obj1)
		mousePicker.makePickable(obj2)
		mousePicker.makePickable(obj3)
		
		ShowBase.destroy()
コード例 #2
0
ファイル: conftest.py プロジェクト: Moguri/panda3d-simplepbr
def showbase(request):
    extra_prc = request.param if hasattr(request, 'param') else ''
    print(extra_prc)
    p3d.load_prc_file_data('', f'{PRC_BASE}\n{extra_prc}')
    showbase = ShowBase()
    yield showbase
    showbase.destroy()
コード例 #3
0
def showbase(request):
    extra_prc = request.param
    from direct.showbase.ShowBase import ShowBase
    print(extra_prc)
    p3d.load_prc_file_data('', f'{PRC_BASE}\n{extra_prc}')
    showbase = ShowBase()
    yield showbase
    showbase.destroy()
コード例 #4
0
ファイル: main.py プロジェクト: afrantisak/roaming_randy
def main():
    print "Please wait while initializing Panda3d..."
    stub = ShowBase()
    stub.destroy()

    print "Now launching the real thing in a loop..."
    exec("import game")
    while True:
        exec("game.Game().run()")
        exec("reload(game)")
コード例 #5
0
ファイル: main.py プロジェクト: afrantisak/roaming_randy
def main():
    print "Please wait while initializing Panda3d..."
    stub = ShowBase()
    stub.destroy()

    print "Now launching the real thing in a loop..."
    exec("import game")
    while True:
        exec("game.Game().run()")
        exec("reload(game)")
コード例 #6
0
ファイル: test_ShowBase.py プロジェクト: OSToontown/panda3d
def test_showbase_create_destroy():
    sb = ShowBase(windowType='none')
    try:
        assert builtins.base == sb
    finally:
        sb.destroy()
        sb = None

    assert not hasattr(builtins, 'base')
    assert not hasattr(builtins, 'run')
    assert not hasattr(builtins, 'loader')
    assert not hasattr(builtins, 'taskMgr')
コード例 #7
0
    def run_trial(self, task):
        ### this is the state-machine calling the different functions for each state
        if task.time < 10.0:  #both playing the gesture in panda and performing the gesture with the robot arm take 10s
            return task.cont

        if self.state == 1 or self.state == 1.5:
            ### state 1 and 1.5: do notlive recording (1 for high force, 1.5 for low force)
            self.run_notlive()
            ### change state from 1 to 2 (classify) or to 0 (end)
            if len(self.cue_pos_choices_notlive) == 1 and len(
                    self.cue_pos_choices_live) > 1:
                self.state = 2
            elif len(self.cue_pos_choices_live) <= 1:
                self.state = 0
            return task.again

        elif self.state == 2:
            ### state 2: do classification of notlive data and change to state 3
            self.classify_notlive()
            self.state = 3
            return task.again

        elif self.state == 3 or self.state == 3.5:
            ### state 3: do live recording
            ###  start next trial (only if there is one trial left. otherwise change state to 0 (end))
            if len(self.cue_pos_choices_live) <= 1:
                self.state = 0
            else:
                self.run_live()
                ### change to 4 or 4.5, important to keep information of high or low
                self.state += 1
            return task.again

        elif self.state == 4 or self.state == 4.5:
            ### state 4 do live classification and robot arm movement ->afterwards go back to state 3/3.5
            self.classify_life()
            ### change to 3 or 3.5, important to keep information of high or low
            self.state -= 1
            return task.again

        else:
            ### other, e.g. 0:   stop system
            if (self.true + self.false) != 0:
                print('Correct:', self.true, '/', self.true + self.false)
            self.record_data.stop_recording_and_dump()
            ShowBase.destroy(self)  #base.destroy()
            if self.robotconnected:
                self.robothand.shutdown()
            sys.exit()
            return task.done
    def stop_session(self):
        if self.mode == "EEG" or self.mode == "HYBRID":
            if (self.EEG_true + self.EEG_false) != 0:
                print('EEG Correct:', self.EEG_true, '/',
                      self.EEG_true + self.EEG_false)
            self.record_data_EEG.stop_recording_and_dump()
            pygame.quit()
        if self.mode == "EMG" or self.mode == "HYBRID":
            if (self.EMG_true + self.EMG_false) != 0:
                print('EMG Correct:', self.EMG_true, '/',
                      self.EMG_true + self.EMG_false)
            self.record_data_EMG.stop_recording_and_dump()

        ShowBase.destroy(self)  #base.destroy()
        if self.robothandconnected:
            self.robothand.shutdown()
        if self.robotarmconnected:
            self.robotarm.shutdown()
        sys.exit()
コード例 #9
0
 def destroy(self):
     if hasattr(__builtin__, 'localServer') and localServer:
         localServer.killProcesses()
     ShowBase.destroy(self)
コード例 #10
0
 def exit(self):
     base.graphicsEngine.removeAllWindows()
     ShowBase.destroy(self)
     os._exit(0)
コード例 #11
0
def showbase():
    showbase = ShowBase()
    yield showbase
    showbase.destroy()
コード例 #12
0
ファイル: utils.py プロジェクト: uclyyu/home-platform
	def destroy(self):
		self.taskMgr.remove('peppers-update')
		ShowBase.destroy(self)
コード例 #13
0
ファイル: utils.py プロジェクト: uclyyu/home-platform
	def destroy(self):
		self.taskMgr.remove('viewer-update')
		ShowBase.destroy(self)
コード例 #14
0
ファイル: utils.py プロジェクト: uclyyu/home-platform
	def destroy(self):
		self.taskMgr.remove('controller-update')
		ShowBase.destroy(self)
コード例 #15
0
 def destroy(self):
     self.taskMgr.remove('viewer-update')
     ShowBase.destroy(self)
     # this should only be destroyed by the Python garbage collector
     # StaticShowBase.instance.destroy()
コード例 #16
0
 def destroy(self):
     print("Cleaning memory...")
     self.is_simulating = False
     ShowBase.destroy(self)
     print("Simulation stopped!")