0

More or less all functions of pyBullet take an optional argument physicsClientId which is needed when multiple instances are running in parallel.

When writing custom functions that call pybullet internally, I would like to provide this as an optional argument there as well. So I tried the following:

def my_func(..., physicsClientId=None):
    pybullet.some_func(
        ...,
        physicsClientId=physicsClientId,
    )

However, when I call this without specifying the ID, I get

TypeError: an integer is required (got type NoneType)

so None is obviously the wrong default value. As it want's an integer, I assume it is something like 0 or -1 but I would like to know if there is an official answer to this (in the pyBullet documentation, there are typically no default values specified for optional arguments).

luator
  • 4,769
  • 3
  • 30
  • 51

1 Answers1

0

From looking at the code (pybullet.c), it seems the default is 0.

And indeed, def my_func(..., physicsClientId=0) is working.

luator
  • 4,769
  • 3
  • 30
  • 51