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 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.

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.

getAccelerationLimits()[source]
getAngularMomentum()[source]
getCom()[source]
getComJacobian()[source]
getConfig()[source]
getCoriolisForceMatrix()[source]
getCoriolisForces()[source]
getDOFPosition(index)[source]
getGravityForces(g)[source]
getJointLimits()[source]
getKineticEnergy()[source]
getLinearMomentum()[source]
getMassMatrix()[source]
getMassMatrixInv()[source]
getTorqueLimits()[source]
getTotalInertia()[source]
getVelocity()[source]
getVelocityLimits()[source]
interpolate(a, b, u)[source]
interpolate_deriv(a, b)[source]
mount(link, subRobot, R, t)[source]
numDrivers()[source]
randomizeConfig(unboundedScale=1.0)[source]
reduce()[source]
selfCollides()[source]
selfCollisionEnabled(link1, link2)[source]
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) –

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, 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.

torquesFromAccel(ddq)[source]

Bases: object

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]