
    ni                     V    S r SSKJr  SSKJr  SSKrSSKrSSKrSSKr " S S\5      r	g)3A wrapper for pybullet to manage different clients.    )absolute_import)divisionNc                   .    \ rS rSrSrSS jrS rS rSrg)	BulletClient
   r   Nc                 L   0 U l         [        R                  " 5       U l        UcI  [        R
                  " [        R                  US9U l        U R                  S:  a  g[        R                  nUc  [        R
                  " XS9U l        g[        R
                  " XUS9U l        g)ac  Creates a Bullet client and connects to a simulation.

Args:
  connection_mode:
    `None` connects to an existing simulation or, if fails, creates a
      new headless simulation,
    `pybullet.GUI` creates a new simulation with a GUI,
    `pybullet.DIRECT` creates a headless simulation,
    `pybullet.SHARED_MEMORY` connects to an existing simulation.
N)optionsr   )hostNamer
   )	_shapesosgetpid_pidpybulletconnectSHARED_MEMORY_clientDIRECT)selfconnection_moder   r
   s       V/home/james-whalen/.local/lib/python3.13/site-packages/pybullet_utils/bullet_client.py__init__BulletClient.__init__   s}     DL		DI%%h&<&<gNdl		"//''I''T[\    c                     U R                   S:  aK  U R                  [        R                  " 5       :X  a'   [        R
                  " U R                   S9  SU l         ggg! [        R                   a     gf = f)z(Clean up connection if not already done.r   physicsClientIdN)r   r   r   r   r   
disconnecterror)r   s    r   __del__BulletClient.__del__%   s[    ||Q499		3DLL9 4 ^^ s   %A A43A4c                     [        [        U5      n[        R                  " U5      (       a  [        R
                  " X R                  S9nUS:X  a  SU l        U$ )z+Inject the client id into Bullet functions.r   r   r   )getattrr   inspect	isbuiltin	functoolspartialr   )r   name	attributes      r   __getattr__BulletClient.__getattr__.   sH    $'I####I||Li\dlr   )r   r   r   )NN )	__name__
__module____qualname____firstlineno____doc__r   r!   r+   __static_attributes__ r   r   r   r   
   s    ;]0r   r   )
r2   
__future__r   r   r   r'   r%   r   objectr   r4   r   r   <module>r7      s&    9 &  	   +6 +r   