klampt.control.interop module

Defines utilities for connecting simulation controllers to the Robot Interface Layer, and connect ControllerBlocks to RobotInterfaceBase receivers.

Classes:

SimRobotControllerToInterface(robotInterface)

A class that provides an API like SimRobotController so that simulation control code can be ported easily to a RobotInterfaceBase Robot Interface Layer API.

RobotControllerBlockToInterface(controller, …)

A class that connects the I/O of a RobotControllerBlock robot controller with a RobotInterfaceBase Robot Interface Layer API.

RobotInterfacetoVis(robotInterface[, …])

A class that produces a standard klampt.vis display to monitor a RobotInterfaceBase Robot Interface Layer API.

class klampt.control.interop.SimRobotControllerToInterface(robotInterface)[source]

Bases: object

A class that provides an API like SimRobotController so that simulation control code can be ported easily to a RobotInterfaceBase Robot Interface Layer API.

Missing:

  • setRate(dt): can’t change a real robot’s control rate.

  • getSetting()/setSetting(): no interface to configure robot.

  • setMilestone(q,dq): can’t set a terminal velocity.

  • add*(): can’t queue up commands.

  • getPIDGains(): can’t configure PID gains.

Parameters

robotInterface (RobotInterfaceBase) – the robot interface to use

Methods:

initialize()

beginStep()

endStep()

model()

setRate(dt)

getRate()

getCommandedConfig()

getCommandedVelocity()

getCommandedTorque()

getSensedConfig()

getSensedVelocity()

getSensedTorque()

sensor(index_or_name)

commands()

sendCommand(name, args)

getSetting(name)

setSetting(name, val)

setMilestone(q[, dq])

addMilestone(q[, dq])

addMilestoneLinear(q)

setLinear(q, dt)

setCubic(q, v, dt)

addLinear(q, dt)

addCubic(q, dt)

remainingTime()

setVelocity(dq, dt)

setTorque(t)

setPIDCommand(qdes, dqdes[, tfeedforward])

setManualMode(enabled)

getControlType()

setPIDGains(kP, kI, kD)

getPIDGains()

initialize()[source]
beginStep()[source]
endStep()[source]
model()[source]
setRate(dt)[source]
getRate()[source]
getCommandedConfig()[source]
getCommandedVelocity()[source]
getCommandedTorque()[source]
getSensedConfig()[source]
getSensedVelocity()[source]
getSensedTorque()[source]
sensor(index_or_name)[source]
commands()[source]
sendCommand(name, args)[source]
getSetting(name)[source]
setSetting(name, val)[source]
setMilestone(q, dq=None)[source]
addMilestone(q, dq=None)[source]
addMilestoneLinear(q)[source]
setLinear(q, dt)[source]
setCubic(q, v, dt)[source]
addLinear(q, dt)[source]
addCubic(q, dt)[source]
remainingTime()[source]
setVelocity(dq, dt)[source]
setTorque(t)[source]
setPIDCommand(qdes, dqdes, tfeedforward=None)[source]
setManualMode(enabled)[source]
getControlType()[source]
setPIDGains(kP, kI, kD)[source]
getPIDGains()[source]
class klampt.control.interop.RobotControllerBlockToInterface(controller, robotInterface, controllerRateRatio=1)[source]

Bases: object

A class that connects the I/O of a RobotControllerBlock robot controller with a RobotInterfaceBase Robot Interface Layer API.

Parameters
  • controller (RobotControllerBlock) – the controller block.

  • robotInterface (RobotInterfaceBase) – the robot interface

  • controllerRateRatio (float, optional) – if not 1, scales how many times the block is run for each main loop of the robotInterface

Methods:

advance([step_interface])

Moves forward the controller and interface one step.

advance(step_interface=False)[source]

Moves forward the controller and interface one step.

If step_interface = True the robotInterface will also be stepped. Otherwise, make sure you call startStep()/endStep() like:

c2i = RobotControllerBlockToInterface(...)
c2i.robotInterface.startStep()
c2i.advance()
c2i.robotInterface.endStep()
class klampt.control.interop.RobotInterfacetoVis(robotInterface, visRobotIndex=0)[source]

Bases: object

A class that produces a standard klampt.vis display to monitor a RobotInterfaceBase Robot Interface Layer API.

Note: this assumes that vis has been set up with an appropriate world.

Methods:

update()

update()[source]