pydrake.common

pydrake.common.AddResourceSearchPath(search_path: unicode) → None

(Deprecated.) Sets the kDrakeResourceRootEnvironmentVariableName environment variable to root_directory.

Raises:RuntimeError if the environment variable is already set.
Raises:RuntimeError if the given path is not absolute. (Deprecated.)
Deprecated:
Call setenv(kDrakeResourceRootEnvironmentVariableName) instead. This will be removed from Drake on or after 2019-08-01.
pydrake.common.FindResourceOrThrow(resource_path: unicode) → unicode

Convenient wrapper for querying FindResource(resource_path) followed by FindResourceResult::get_absolute_path_or_throw().

pydrake.common.GetDrakePath() → unicode

Returns the fully-qualified path to the root of the drake source tree. (Deprecated.)

Deprecated:
Please use drake::FindResource() instead. This will be removed from Drake on or after 2019-06-01.
pydrake.common.GetResourceSearchPaths() → List[unicode]

Returns a single-element vector containing the last root_directory passed to AddResourceSearchPath() if any; otherwise, returns an empty vector. (Deprecated.)

Deprecated:
Call getenv(kDrakeResourceRootEnvironmentVariableName) instead. This will be removed from Drake on or after 2019-08-01.
class pydrake.common.RandomDistribution

Drake supports explicit reasoning about a few carefully chosen random distributions.

Members:

kExponential : < Vector elements are independent and drawn from an

kUniform : < Vector elements are independent and uniformly distributed

kGaussian : < Vector elements are independent and drawn from a

__init__(self: pydrake.common._module_py.RandomDistribution, arg0: int) → None
kExponential = RandomDistribution.kExponential
kGaussian = RandomDistribution.kGaussian
kUniform = RandomDistribution.kUniform
name

(self – handle) -> str

class pydrake.common.RandomGenerator

Defines Drake’s canonical implementation of the UniformRandomBitGenerator C++ concept (as well as a few conventional extras beyond the concept, e.g., seeds). This uses the 32-bit Mersenne Twister mt19937 by Matsumoto and Nishimura, 1998. For more information, see https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: pydrake.common._module_py.RandomGenerator) -> None

Default constructor. Seeds the engine with the default_seed.

  1. __init__(self: pydrake.common._module_py.RandomGenerator, arg0: int) -> None

Constructs the engine and initializes the state with a given value.

pydrake.common.set_assertion_failure_to_throw_exception() → None

Set Drake’s assertion failure mechanism to be exceptions

pydrake.common.set_log_level(level: unicode) → unicode

Invokes drake::log()->set_level(level).

Parameter level:
Must be a string from spdlog enumerations: trace, debug, info, warn, err, critical, off, or unchanged (not an enum, but useful for command-line).
Returns:The string value of the previous log level. If SPDLOG is disabled, then this returns an empty string.
pydrake.common.temp_directory() → unicode

Returns a directory location suitable for temporary files.

Returns:

The value of the environment variable TEST_TMPDIR if defined or otherwise ${TMPDIR:-/tmp}/robotlocomotion_drake_XXXXXX where each X is replaced by a character from the portable filename character set. Any trailing / will be stripped from the output.

Raises:
  • RuntimeError If the path referred to by TEST_TMPDIR or
  • ${TMPDIR – -/tmp}/robotlocomotion_drake_XXXXXX cannot be created,
  • does not exist, or is not a directory.
pydrake.common.trigger_an_assertion_failure() → None

Trigger a Drake C++ assertion failure