klampt.model.subrobot module¶
Defines the SubRobotModel
class, which is RobotModel
-like but
only modifies selected degrees of freedom of the robot (e.g., an arm, a leg).
Many, but not all, klampt
module functions accept SubRobotModel in
the place of RobotModel.
-
class
klampt.model.subrobot.
SubRobotModel
(robot, links)[source]¶ A helper that lets you conveniently set/get quantities for a subset of moving links on a RobotModel. This class has the same API as RobotModel, but everything is re-indexed so that configurations and link indices only modify the given subset of links. As a reult, most methods applicable to a RobotModel can also be applied to a SubRobotModel.
You provide the list of moving link indices or names in the constructor.
The methods
tofull
andfromfull
convert objects to and from the full robot.Parameters: - robot (RobotModel or SubRobotModel) – the robot to base this on.
- links (list of ints or strs) – the links to use in this sub-robot.
-
fromfull
(object)[source]¶ Converts the given index, configuration, velocity, or trajectory of a full robot to the corresponding object of the sub-robot. Returns the object for the sub-robot.
Parameters: object – an integer index, configuration, velocity, matrix, list of configurations, or Trajectory. Note
For indices, this is an O(n) operation where n is the size of the sub-robot. If the index doesn’t belong to the sub-robot then None is returned.
-
tofull
(object, type=None)[source]¶ Converts the given index, link, configuration, velocity, or trajectory of a sub robot to the corresponding object of the full robot. Returns the object for the full robot.
Parameters: - object – an integer index, configuration, velocity, matrix, list of configurations, or Trajectory.
- type (str, optional) –
describes how to interpret object:
- ’vector’ or ‘Velocity’: object is treated like a velocity.
- ’jacobian’: object is treated like a jacobian matrix.
- anything else: object is treated as a list of configurations.