pyrep package¶
Subpackages¶
Submodules¶
pyrep.const module¶
-
class
pyrep.const.ConfigurationPathAlgorithms¶ Bases:
enum.EnumAn enumeration.
-
BITstar= 'BITstar'¶
-
BKPIECE1= 'BKPIECE1'¶
-
BiTRRT= 'BiTRRT'¶
-
CForest= 'CForest'¶
-
EST= 'EST'¶
-
FMT= 'FMT'¶
-
KPIECE1= 'KPIECE1'¶
-
LBKPIECE1= 'LBKPIECE1'¶
-
LBTRRT= 'LBTRRT'¶
-
LazyPRM= 'LazyPRM'¶
-
LazyPRMstar= 'LazyPRMstar'¶
-
LazyRRT= 'LazyRRT'¶
-
PDST= 'PDST'¶
-
PRM= 'PRM'¶
-
PRMstar= 'PRMstar'¶
-
RRT= 'RRT'¶
-
RRTConnect= 'RRTConnect'¶
-
RRTstar= 'RRTstar'¶
-
SBL= 'SBL'¶
-
SPARS= 'SPARS'¶
-
SPARStwo= 'SPARStwo'¶
-
STRIDE= 'STRIDE'¶
-
TRRT= 'TRRT'¶
-
pRRT= 'pRRT'¶
-
pSBL= 'pSBL'¶
-
-
class
pyrep.const.JointMode¶ Bases:
enum.EnumAn enumeration.
-
DEPENDENT= 4¶
-
FORCE= 5¶
-
IK= 2¶
-
IK_DEPENDENT= 3¶
-
PASSIVE= 0¶
-
-
class
pyrep.const.JointType¶ Bases:
enum.EnumAn enumeration.
-
PRISMATIC= 11¶
-
REVOLUTE= 10¶
-
SPHERICAL= 12¶
-
-
class
pyrep.const.ObjectType¶ Bases:
enum.EnumAn enumeration.
-
ALL= -2¶
-
CAMERA= 3¶
-
DUMMY= 4¶
-
FORCE_SENSOR= 12¶
-
GRAPH= 2¶
-
JOINT= 1¶
-
LIGHT= 13¶
-
MILl= 11¶
-
MIRROR= 14¶
-
OCTREE= 15¶
-
PATH= 8¶
-
PROXIMITY_SENSOR= 5¶
-
SHAPE= 0¶
-
VISION_SENSOR= 9¶
-
VOLUME= 10¶
-
-
class
pyrep.const.PerspectiveMode¶ Bases:
enum.EnumAn enumeration.
-
ORTHOGRAPHIC= 0¶
-
PERSPECTIVE= 1¶
-
-
class
pyrep.const.PrimitiveShape¶ Bases:
enum.EnumAn enumeration.
-
CONE= 3¶
-
CUBOID= 0¶
-
CYLINDER= 2¶
-
SPHERE= 1¶
-
-
class
pyrep.const.RenderMode¶ Bases:
enum.EnumAn enumeration.
-
EXTERNAL= 5¶
-
EXTERNAL_WINDOWED= 6¶
-
OPENGL= 0¶
-
OPENGL3= 7¶
-
OPENGL3_WINDOWED= 8¶
-
OPENGL_AUXILIARY= 1¶
-
OPENGL_COLOR_CODED= 2¶
-
POV_RAY= 3¶
-
-
class
pyrep.const.TextureMappingMode¶ Bases:
enum.EnumAn enumeration.
-
CUBE= 3¶
-
CYLINDER= 1¶
-
PLANE= 0¶
-
SPHERE= 2¶
-
-
class
pyrep.const.Verbosity¶ Bases:
enum.EnumAn enumeration.
-
DEBUG= 'debug'¶
-
ERRORS= 'errors'¶
-
INFOS= 'infos'¶
-
LOAD_INFOS= 'loadinfos'¶
-
NONE= 'none'¶
-
SCRIPT_ERRORS= 'scripterrors'¶
-
SCRIPT_INFOS= 'scriptinfos'¶
-
SCRIPT_WARNINGS= 'scriptwarnings'¶
-
TRACE= 'trace'¶
-
TRACE_LUA= 'tracelua'¶
-
TYRACE_ALL= 'traceall'¶
-
WARNINGS= 'warnings'¶
-
pyrep.errors module¶
-
exception
pyrep.errors.ConfigurationError¶ Bases:
Exception
-
exception
pyrep.errors.ConfigurationPathError¶ Bases:
Exception
-
exception
pyrep.errors.GripperError¶ Bases:
Exception
-
exception
pyrep.errors.IKError¶ Bases:
Exception
-
exception
pyrep.errors.ObjectAlreadyRemovedError¶ Bases:
Exception
-
exception
pyrep.errors.ObjectIsNotModelError¶ Bases:
Exception
-
exception
pyrep.errors.PyRepError¶ Bases:
Exception
-
exception
pyrep.errors.WrongObjectTypeError¶ Bases:
Exception
pyrep.pyrep module¶
-
class
pyrep.pyrep.PyRep¶ Bases:
objectUsed for interfacing with the CoppeliaSim simulation.
Can be used for starting, stopping, and stepping the simulation. As well as getting, and creating scene objects and robots.
-
create_texture(filename: str, interpolate=True, decal_mode=False, repeat_along_u=False, repeat_along_v=False) → Tuple[pyrep.objects.shape.Shape, pyrep.textures.texture.Texture]¶ Creates a planar shape that is textured.
Parameters: - filename – Path to the texture to load.
- interpolate – Adjacent texture pixels are not interpolated.
- decal_mode – Texture is applied as a decal (its appearance won’t be influenced by light conditions).
- repeat_along_u – Texture will be repeated along the U direction.
- repeat_along_v – Texture will be repeated along the V direction.
Returns: A tuple containing the textured plane and the texture.
-
export_scene(filename: str) → None¶ Saves the current scene.
Parameters: filename – scene filename. The filename extension is required (“ttt”).
-
get_collection_handle_by_name(collection_name: str) → int¶ Retrieves the integer handle for a given collection.
Parameters: collection_name – Name of the collection to retrieve the integer handle for Returns: An integer handle for the collection
-
get_objects_in_tree(root_object=None, *args, **kwargs) → List[pyrep.objects.object.Object]¶ Retrieves the objects in a given hierarchy tree.
Parameters: - root_object – The root object in the tree. Pass None to retrieve
all objects in the configuration tree.
Objector int. - object_type – The object type to retrieve.
One of
ObjectType. - exclude_base – Exclude the tree base from the returned list.
- first_generation_only – Include in the returned list only the object’s first children. Otherwise, entire hierarchy is returned.
Returns: A list of objects in the hierarchy tree.
- root_object – The root object in the tree. Pass None to retrieve
all objects in the configuration tree.
-
get_simulation_timestep() → float¶ Gets the simulation time step.
Returns: The time step value in seconds.
-
group_objects(objects: List[pyrep.objects.shape.Shape]) → pyrep.objects.shape.Shape¶ Groups several shapes into a compound shape (or simple shape).
Parameters: objects – The list of shapes to group. Returns: A single grouped shape.
-
import_model(filename: str) → pyrep.objects.object.Object¶ Loads a previously saved model.
Parameters: filename – model filename. The filename extension is required (“ttm”). An optional “@copy” can be appended to the filename, in which case the model’s objects will be named/renamed as if an associated script was attached to the model. Returns: The imported model.
-
launch(scene_file: str = '', headless: bool = False, responsive_ui: bool = False, blocking: bool = False, verbosity: pyrep.const.Verbosity = <Verbosity.NONE: 'none'>) → None¶ Launches CoppeliaSim.
Launches the UI thread, waits until the UI thread has finished, this results in the current thread becoming the simulation thread.
Parameters: - scene_file – The scene file to load. Empty string for empty scene.
- headless – Run CoppeliaSim in simulation mode.
- responsive_ui – If True, then a separate thread will be created to asynchronously step the UI of CoppeliaSim. Note, that will reduce the responsiveness of the simulation thread.
- blocking – Causes CoppeliaSim to launch as if running the default c++ client application. This is causes the function to block. For most users, this will be set to False.
- verbosity – The verbosity level for CoppeliaSim. Usually Verbosity.NONE or Verbosity.LOAD_INFOS.
-
merge_objects(objects: List[pyrep.objects.shape.Shape]) → pyrep.objects.shape.Shape¶ Merges several shapes into a compound shape (or simple shape).
Parameters: objects – The list of shapes to group. Returns: A single merged shape.
-
script_call(function_name_at_script_name: str, script_handle_or_type: int, ints=(), floats=(), strings=(), bytes='') → Tuple[List[int], List[float], List[str], str]¶ Calls a script function (from a plugin, the main client application, or from another script). This represents a callback inside of a script.
Parameters: - function_name_at_script_name – A string representing the function name and script name, e.g. myFunctionName@theScriptName. When the script is not associated with an object, then just specify the function name.
- script_handle_or_type – The handle of the script, otherwise the type of the script.
- ints – The input ints to the script.
- floats – The input floats to the script.
- strings – The input strings to the script.
- bytes – The input bytes to the script (as a string).
Returns: Any number of return values from the called Lua function.
-
set_configuration_tree(config_tree: bytes) → None¶ Restores configuration information previously retrieved.
Configuration information (object relative positions/orientations, joint/path values) can be retrieved with
Object.get_configuration_tree(). Dynamically simulated objects will implicitly be reset before the command is applied (i.e. similar to callingObject.reset_dynamic_object()just before).Parameters: config_tree – The configuration tree to restore.
-
set_simulation_timestep(dt: float) → None¶ Sets the simulation time step. Default is 0.05.
Parameters: dt – The time step value in seconds.
-
shutdown() → None¶ Shuts down the CoppeliaSim simulation.
-
start() → None¶ Starts the physics simulation if it is not already running.
-
step() → None¶ Execute the next simulation step.
If the physics simulation is not running, then this will only update the UI.
-
step_ui() → None¶ Update the UI.
This will not execute the next simulation step, even if the physics simulation is running. This is only applicable when PyRep was launched without a responsive UI.
-
stop() → None¶ Stops the physics simulation if it is running.
-