klampt.model.types module
Utilities for inspecting Klamp’t objects to retrieve a type string / create objects from type strings.
Functions:
Returns a set of all known Klampt types |
|
|
Returns a string defining the type of the given Python Klamp't object. |
|
Returns a type string for the Klamp't object obj, restricted to the set of validTypes. |
|
Makes a default instance of the given type. |
|
Returns a dictionary containing metadata for the object. |
|
Converts an object to a semi-equivalent destination type. |
|
Converts a Klampt object that refers to a source robot to an object that refers to a target robot, assuming matched link names. |
|
Deprecated in a future version of Klampt. |
|
Deprecated in a future version of Klampt. |
- klampt.model.types.object_to_types(object, world=None)[source]
Returns a string defining the type of the given Python Klamp’t object. If multiple types could be associated with it, then it returns a list of all possible valid types.
- klampt.model.types.object_to_type(obj, validTypes=None, world=None)[source]
Returns a type string for the Klamp’t object obj, restricted to the set of validTypes. If there are multiple interpretations, the first type in object_to_types that matches a valid type is returned.
- Parameters:
obj – A Klamp’t-compatible object
validTypes (set, dict, or None) – a set or dict of possible valid types. If None, any type is accepted
- Returns:
The type of the object, or None if no valid type was found
- Return type:
str or None
- klampt.model.types.make(type, object=None)[source]
Makes a default instance of the given type.
- Parameters:
type (str) – the name of the desired type
object (optional) – If
type
is ‘Config’, ‘Configs’, ‘Vector’, or ‘Trajectory’, can provide the object for which the new instance will be compatible.
- klampt.model.types.info(object, world=None)[source]
Returns a dictionary containing metadata for the object. At a minimum, the “type” key will be filled in with the object’s type, or None if the Klampt type is unknown.
- Return type:
dict
- klampt.model.types.convert(object, dest_type)[source]
Converts an object to a semi-equivalent destination type.
Only works for path-like objects (Configs, Trajectory, MultiPath, [X]Trajectory) and geometry objects.
Object data may be referenced in the result.
- klampt.model.types.transfer(object, source_robot, target_robot, link_map=None)[source]
Converts a Klampt object that refers to a source robot to an object that refers to a target robot, assuming matched link names.
- Parameters:
object – any Klampt object. This is only meaningful for int, list of int (IntArray), vector (Config), list of vector (Configs), Trajectory, IKGoal, RobotModelLink, or SubRobotModel types.
source_robot (str or RobotModel) – the robot for which
object
is meaningful. If str, this is the filename of the source robot.target_robot (str or RobotModel) – the robot that will use the return result. If str, this is the filename of the target robot.
link_map (dict, optional) – if given, maps source link names to target link names, or source link indices to target link indices. This can also be a 1-element dict {‘*’:’prefix:’} indicating that the links of source_robot map to ‘prefix:’+[LINK_NAME], or a dict {‘prefix:’:’*’} indicating the reverse.
- Returns:
the object, with links mapped to the target robot.
- Return type:
same type as object
- klampt.model.types.knownTypes(*args, **kwargs)
Deprecated in a future version of Klampt. Use known_types instead
- klampt.model.types.objectToTypes(*args, **kwargs)
Deprecated in a future version of Klampt. Use object_to_types instead