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 and fromfull 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.
accelFromTorques(t)[source]
distance(a, b)[source]
drawGL(keepAppearance=True)[source]
driver(index)[source]
enableSelfCollision(link1, link2, value=True)[source]
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.

getAccelerationLimits()[source]
getCom()[source]
getComJacobian()[source]
getConfig()[source]
getCoriolisForceMatrix()[source]
getCoriolisForces()[source]
getDOFPosition(index)[source]
getGravityForces(g)[source]
getJointLimits()[source]
getMassMatrix()[source]
getMassMatrixInv()[source]
getTorqueLimits()[source]
getVelocity()[source]
getVelocityLimits()[source]
interpolate(a, b, u)[source]
interpolate_deriv(a, b)[source]
numDrivers()[source]
randomizeConfig(unboundedScale=1.0)[source]
selfCollides()[source]
selfCollisionEnabled(link1, link2)[source]
setAccelerationLimits(amax)[source]
setConfig(q)[source]
setDOFPosition(index, qi)[source]
setJointLimits(qmin, qmax)[source]
setTorqueLimits(tmax)[source]
setVelocity(q)[source]
setVelocityLimits(vmax)[source]
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.
torquesFromAccel(ddq)[source]

A helper that lets you treat links of a subrobot just like a normal RobotModelLink. Correctly implements jacobians and indices with respect to the sub-robot.

getIndex()[source]
getJacobian(p)[source]
getOrientationJacobian()[source]
getParent()[source]
getPositionJacobian(p)[source]
parent()[source]
robot()[source]
setParent(p)[source]