klampt.model.types module

Utilities for inspecting Klamp’t objects to retrieve a type string / create objects from type strings.

Functions:

known_types()

Returns a set of all known Klampt types

object_to_types(object[, world])

Returns a string defining the type of the given Python Klamp’t object.

object_to_type(obj[, validTypes, world])

Returns a type string for the Klamp’t object obj, restricted to the set of validTypes.

make(type[, object])

Makes a default instance of the given type.

transfer(object, source_robot, target_robot)

Converts a Klampt object that refers to a source robot to an object that refers to a target robot, assuming matched link names.

objectToTypes(*args, **kwargs)

Deprecated in a future version of Klampt.

knownTypes(*args, **kwargs)

Deprecated in a future version of Klampt.

klampt.model.types.known_types()[source]

Returns a set of all known Klampt types

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.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.objectToTypes(*args, **kwargs)

Deprecated in a future version of Klampt. Use object_to_types instead

klampt.model.types.knownTypes(*args, **kwargs)

Deprecated in a future version of Klampt. Use known_types instead