simulation.py
def _setupKeyBinds(self): # {{{0
    "Create the keypress manager and register keypress events"
    kbm = KeyPressManager(self.app, debug=self.args.debug)
    # TODO: Detect these and others using X11
    kbm.map("!", "S-1")
    kbm.map("?", "S-/")
    onMove = lambda keys: onMovementKey(self.app, keys)
    for key in KEY_CLASS_ARROWS + KEY_CLASS_NUMPAD:
      kbm.bind(key, onMove, keys=True, repeat=True)
    kbm.bind(" ", self._onKeyReset)
    kbm.bind("h", self._onKeyHelp)
    kbm.bind("b", self._onKeyDump)
    kbm.bind("?", self._onKeyStatus)
    kbm.bind(".", self._onKeyStep, repeat=True)
    kbm.bind("m", self._onKeyToggleMousePicking)
    kbm.bind("`", self._onKeyToggleKeyEvents)
    kbm.bind("\\", self._onKeyToggleSim)
    kbm.bind("f", self._onKeyFireProjectile, keys=True)
    kbm.bind("F12", self._onKeyVideoLogging)
    kbm.bind("^o", self.app.loadUrdf)

    # Debugging: simulate a Bullet error
    if self.args.debug:
      def injectErrorFunc():
        p.b3Print("Injected error message")
        p.b3Warning("Injected error message")
        p.b3Error("Injected error message")
        p.getAABB(-1) # Results in pybullet.error
      kbm.bind("^e", injectErrorFunc)
    return kbm
Create the keypress manager and register keypress events
Create the keypress manager and register keypress events
Create the keypress manager and register keypress events
def _setupKeyBinds(self): 
    kbm = KeyPressManager(self.app, debug=self.args.debug)
    kbm.map("!", "S-1")
    kbm.map("?", "S-/")
    onMove = lambda keys: onMovementKey(self.app, keys)
    for key in KEY_CLASS_ARROWS + KEY_CLASS_NUMPAD:
      kbm.bind(key, onMove, keys=True, repeat=True)
    kbm.bind(" ", self._onKeyReset)
    kbm.bind("h", self._onKeyHelp)
    kbm.bind("b", self._onKeyDump)
    kbm.bind("?", self._onKeyStatus)
    kbm.bind(".", self._onKeyStep, repeat=True)
    kbm.bind("m", self._onKeyToggleMousePicking)
    kbm.bind("`", self._onKeyToggleKeyEvents)
    kbm.bind("\\", self._onKeyToggleSim)
    kbm.bind("f", self._onKeyFireProjectile, keys=True)
    kbm.bind("F12", self._onKeyVideoLogging)
    kbm.bind("^o", self.app.loadUrdf)
    if self.args.debug:
      def injectErrorFunc():
        p.b3Print("Injected error message")
        p.b3Warning("Injected error message")
        p.b3Error("Injected error message")
        p.getAABB(-1) 
      kbm.bind("^e", injectErrorFunc)
    return kbm
def _setupKeyBinds ( self ) : kbm = KeyPressManager ( self . app , debug = self . args . debug ) kbm . map ( "!" , "S-1" ) kbm . map ( "?" , "S-/" ) onMove = lambda keys : onMovementKey ( self . app , keys ) for key in KEY_CLASS_ARROWS + KEY_CLASS_NUMPAD : kbm . bind ( key , onMove , keys = True , repeat = True ) kbm . bind ( " " , self . _onKeyReset ) kbm . bind ( "h" , self . _onKeyHelp ) kbm . bind ( "b" , self . _onKeyDump ) kbm . bind ( "?" , self . _onKeyStatus ) kbm . bind ( "." , self . _onKeyStep , repeat = True ) kbm . bind ( "m" , self . _onKeyToggleMousePicking ) kbm . bind ( "`" , self . _onKeyToggleKeyEvents ) kbm . bind ( "\\" , self . _onKeyToggleSim ) kbm . bind ( "f" , self . _onKeyFireProjectile , keys = True ) kbm . bind ( "F12" , self . _onKeyVideoLogging ) kbm . bind ( "^o" , self . app . loadUrdf ) if self . args . debug : def injectErrorFunc ( ) : p . b3Print ( "Injected error message" ) p . b3Warning ( "Injected error message" ) p . b3Error ( "Injected error message" ) p . getAABB ( - 1 ) kbm . bind ( "^e" , injectErrorFunc ) return kbm
Create the keypress manager and register keypress events
Create the keypress manager and register keypress events
# {{{0 "Create the keypress manager and register keypress events" # TODO: Detect these and others using X11 # Debugging: simulate a Bullet error # Results in pybullet.error
self