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]¶ Bases:
object
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.
- Parameters
object – an integer index, configuration, velocity, matrix, list of configurations, or Trajectory.
- Returns
The corresponding object mapped to the sub-robot.
Note
For indices, if the index doesn’t belong to the sub-robot then None is returned.
-
sensor
(index)[source]¶ Returns the SimSensorModel corresponding to index. Note however that you can’t set the “link” setting according to this SubRobotModel.
- Parameters
index (int or str) –
-
tofull
(object, reference=None)[source]¶ Converts the given index, link, configuration, velocity, or trajectory of a sub robot to the corresponding object of the full robot.
- Parameters
object – an integer index, configuration, velocity, matrix, list of configurations, or Trajectory.
reference (list, optional) – describes the reference object that this should fill in for the indices not in this sub-robot. By default, uses the robot’s current configuration.
- Returns
The corresponding object mapped to the full robot.