PyBullet Quickstart Guide - Google Docs

https://github.com/bulletphysics/bullet3/tree/master

  • First of all, there is something called Bullet Physics, which is written in C++.

PyBullet has built-in support for cross-platform client-server communication using shared memory, UDP, and TCP networking.

  • You can use it (blu3mo).
  • Or, it’s about integrating with a simulation server.
    • Well, either way, it works if you use Python.

After importing the PyBullet module, the first thing to do is ‘connecting’ to the physics simulation. PyBullet is designed around a client-server driven API, with a client sending commands and a physics server returning the status. PyBullet has some built-in physics servers: DIRECT and GUI. Both GUI and DIRECT connections will execute the physics simulation and rendering in the same process as PyBullet. I see (blu3mo)(blu3mo)

Importing URDF is the easiest way.

The stepSimulation function performs all the necessary actions in a single forward dynamics simulation step, including collision detection, constraint solving, and integration. The default timestep is 1/240 second, but you can change it using the setTimeStep or setPhysicsEngineParameter API. You can run this in a while loop.

A simulated robot described in a URDF file has a base and optionally links connected by joints. Each joint connects a parent link to a child link. At the top of the hierarchy, there is a single root parent called the base. The base can be fully fixed, with 0 degrees of freedom, or fully free, with 6 degrees of freedom. Since each link is connected to a parent with a single joint, the number of joints is equal to the number of links.

Generally, it’s best to start with VELOCITY_CONTROL or POSITION_CONTROL. TORQUE_CONTROL (force control) is more difficult because simulating the correct forces requires accurate URDF/SDF file parameters and system identification (such as correct masses, inertias, center of mass location, joint friction, etc.).

  • Position control seems convenient.
  • What should I do if I want to move the end effector to a specific coordinate?
    • Inverse Kinematics

    • You can compute the joint angles that make the end effector reach a given target position in Cartesian world space. Internally, Bullet uses an improved version of Samuel Buss Inverse Kinematics library.

    • Oh, here it is. That’s great.

getVisualShapeData You can access visual shape information using getVisualShapeData. You could use this to bridge your own rendering method with PyBullet simulation and manually synchronize the world transforms after each simulation step. You can also use getMeshData, particularly for deformable objects, to receive data about vertex locations.

  • Let’s use this to send data to Unity.
  • We can keep the data in PyBullet and use it in Unity.
  • Shouldn’t we do the physics simulation in a separate PyBullet program?