pycram.helper#
Implementation of helper functions and classes for internal usage only.
Classes: Singleton – implementation of singleton metaclass
Classes#
Metaclass for singletons |
Functions#
Get the paths to the MJCF and URDF files of a robot from the Multiverse resources directory. |
|
|
Parse the actuator elements from an MJCF file. |
Get the path to the description file of a robot. |
|
|
|
|
Executes the perform logic for a given action instance. |
|
Resolve the first available action from the designator. |
Module Contents#
- class pycram.helper.Singleton#
Bases:
typeMetaclass for singletons
- _instances#
Dictionary of singleton child classes inheriting from this metaclass, keyed by child class objects.
- __call__(*args, **kwargs)#
- pycram.helper.get_robot_urdf_and_mjcf_file_paths(robot_name: str, robot_relative_dir: str, multiverse_resources: typing_extensions.Optional[str] = None) typing_extensions.Tuple[typing_extensions.Optional[str], typing_extensions.Optional[str]]#
Get the paths to the MJCF and URDF files of a robot from the Multiverse resources directory.
- Parameters:
robot_name – The name of the robot.
robot_relative_dir – The relative directory of the robot in the Multiverse resources/robots directory.
multiverse_resources – The path to the Multiverse resources directory.
- pycram.helper.parse_mjcf_actuators(file_path: str) typing_extensions.Dict[str, str]#
Parse the actuator elements from an MJCF file.
- Parameters:
file_path – The path to the MJCF file.
- pycram.helper.get_robot_description_path(robot_relative_dir: str, robot_name: str, description_type: pycram.datastructures.enums.DescriptionType = DescriptionType.MJCF, file_name: typing_extensions.Optional[str] = None, resources_dir: typing_extensions.Optional[str] = None) typing_extensions.Optional[str]#
Get the path to the description file of a robot.
- Parameters:
robot_relative_dir – The relative directory of the robot in the resources/robots directory.
robot_name – The name of the robot.
description_type – The type of the description (URDF, MJCF).
file_name – The name of the XML file of the robot.
resources_dir – The path to the Multiverse resources directory.
- Returns:
The path to the description file of the robot if it exists, otherwise None.
- pycram.helper.find_multiverse_resources_path() typing_extensions.Optional[str]#
- Returns:
The path to the Multiverse resources directory.
- pycram.helper.find_multiverse_path() typing_extensions.Optional[str]#
- Returns:
the path to the Multiverse installation.
- pycram.helper.perform(action_instance)#
Executes the perform logic for a given action instance.
- Parameters:
action_instance – An instance of an action class.
- pycram.helper.an(designator)#
Resolve the first available action from the designator.
- Parameters:
designator – The designator description instance.
- Returns:
The first resolved action instance.