klampt.vis.editors module

Functions for visual editing. Used by the klampt.io.resource module in resource.get(...) and resource.edit(...).

A couple editors, SelectionEditor and WorldEditor, cannot be launched from the resource module. To use these, call:

from klampt.vis import editors
ed = editors.SelectionEditor("Some links",[],"Select the links that you want to modify",world))
indices = editors.run(ed)

Classes:

AABBEditor(name, value, description, world)

Edits a 3D axis-aligned bounding box (bmin,bmax).

ConfigEditor(name, value, description, world)

Edits a Config object.

ConfigsEditor(name, value, description, world)

Edits a Configs object.

GeometricPrimitiveEditor(name, value, …[, …])

Edits a GeometricPrimitive.

ObjectTransformEditor(name, value, …)

Edits rigid object transforms.

PointEditor(name, value, description, world)

Edits a 3-D point.

RigidTransformEditor(name, value, …[, frame])

Edits a 3-D transform.

SelectionEditor(name, value, description, world)

Edits a list of indices selecting some links of a robot.

SensorEditor(name, value, description, world)

Edits a SimRobotSensor.

SphereEditor(name, value, description, world)

Edits a sphere represented by a tuple (center,radius).

TrajectoryEditor(name, value, description, world)

Edits a Trajectory, RobotTrajectory, or SE3Trajectory object.

VisualEditorBase(name, value, description, world)

A base class for editing resources.

WorldEditor(name, value, description)

Edits poses of robots, rigid objects, and terrains in a world.

Functions:

run(editorObject)

Launches a visual editor.

class klampt.vis.editors.AABBEditor(name, value, description, world, frame=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a 3D axis-aligned bounding box (bmin,bmax).

If frame is given, then it is klampt.math.se3 element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.

Methods:

instructions()

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

instructions()[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.ConfigEditor(name, value, description, world, robot=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a Config object.

Either a world or a RobotModel or SubRobotModel must be provided.

Methods:

display()

instructions()

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

display()[source]
instructions()[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.ConfigsEditor(name, value, description, world, robot=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a Configs object. The GUI lets the user select which index to edit, and then can click and drag on the robot widget to pose the selected configuration.

Either a world or a RobotModel or SubRobotModel must be provided.

Methods:

addDialogItems(parent[, ui])

delete()

display()

indexChanged(index)

insert()

instructions()

keyboardfunc(c, x, y)

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

addDialogItems(parent, ui='qt')[source]
delete()[source]
display()[source]
indexChanged(index)[source]
insert()[source]
instructions()[source]
keyboardfunc(c, x, y)[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.GeometricPrimitiveEditor(name, value, description, world, frame=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a GeometricPrimitive.

Can only handle Point, Sphere, AABB, and Box types for now.

If frame is given, then it is klampt.math.se3 element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.

Methods:

instructions()

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

instructions()[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.ObjectTransformEditor(name, value, description, world, object)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits rigid object transforms.

value is the klampt.math.se3 transform.

object is the :class:~klampt.RigidObjectModel`.

Methods:

instructions()

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

instructions()[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.PointEditor(name, value, description, world, frame=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a 3-D point.

If frame is given, then it is klampt.math.se3 element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.

Methods:

instructions()

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

instructions()[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.RigidTransformEditor(name, value, description, world, frame=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a 3-D transform.

If frame is given, then it is klampt.math.se3 element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.

Visualization objects can be attached to the edited transform using the attach() method.

Methods:

attach(object[, relativePose])

Attaches an object to visually move along with the edited transform.

disableRotation()

Turns off editing of rotation.

disableTranslation()

Turns off editing of translation.

display()

instructions()

motionfunc(x, y, dx, dy)

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

attach(object, relativePose=None)[source]

Attaches an object to visually move along with the edited transform.

disableRotation()[source]

Turns off editing of rotation.

disableTranslation()[source]

Turns off editing of translation.

display()[source]
instructions()[source]
motionfunc(x, y, dx, dy)[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.SelectionEditor(name, value, description, world, robot=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a list of indices selecting some links of a robot.

Methods:

addDialogItems(parent[, ui])

add_selection(id)

clear()

click_robot(x, y)

Helper: returns a list of robot objects sorted in order of increasing distance.

click_world(x, y)

Helper: returns a list of world objects sorted in order of increasing distance.

display()

instructions()

keyboardfunc(c, x, y)

mousefunc(button, state, x, y)

remove_selection(id)

selectAll()

selectionListChanged()

toggle_selection(id)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

addDialogItems(parent, ui='qt')[source]
add_selection(id)[source]
clear()[source]
click_robot(x, y)[source]

Helper: returns a list of robot objects sorted in order of increasing distance.

click_world(x, y)[source]

Helper: returns a list of world objects sorted in order of increasing distance.

display()[source]
instructions()[source]
keyboardfunc(c, x, y)[source]
mousefunc(button, state, x, y)[source]
remove_selection(id)[source]
selectAll()[source]
selectionListChanged()[source]
toggle_selection(id)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.SensorEditor(name, value, description, world)[source]

Bases: klampt.vis.editors.RigidTransformEditor

Edits a SimRobotSensor.

Assumes that the sensor is attached to the first robot in the world, if world is provided.

Methods:

addDialogItems(parent[, ui])

display()

initialize()

Called by backend after the GL context is created but before the event loop starts.

instructions()

loadable()

Whether Load.

motionfunc(x, y, dx, dy)

mousefunc(button, state, x, y)

onSettingEdited()

onSettingSelected()

refreshVisualization()

savable()

Whether Save.

updateGuiFromValue()

Called when the value is externally changed (from Load…)

updateValueFromGui()

Called when the value is requested (from Save.

addDialogItems(parent, ui='qt')[source]
display()[source]
initialize()[source]

Called by backend after the GL context is created but before the event loop starts.

instructions()[source]
loadable()[source]

Whether Load… should be shown

motionfunc(x, y, dx, dy)[source]
mousefunc(button, state, x, y)[source]
onSettingEdited()[source]
onSettingSelected()[source]
refreshVisualization()[source]
savable()[source]

Whether Save… should be shown

updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

updateValueFromGui()[source]

Called when the value is requested (from Save… and OK)

class klampt.vis.editors.SphereEditor(name, value, description, world, frame=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a sphere represented by a tuple (center,radius).

If frame is given, then it is klampt.math.se3 element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.

Methods:

instructions()

mousefunc(button, state, x, y)

updateGuiFromValue()

Called when the value is externally changed (from Load…)

instructions()[source]
mousefunc(button, state, x, y)[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.TrajectoryEditor(name, value, description, world, robot=None)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits a Trajectory, RobotTrajectory, or SE3Trajectory object.

If a Trajectory is given, then it must either be attached to a robot or a 1D, 2D, or 3D trajectory.

Methods:

addDialogItems(parent[, ui])

animSelectorChanged(value)

attach(object[, relativePose])

For an SE3 trajectory, shows the given object relative to the edited transform trajectory

delete()

display()

durationChanged(value)

idle()

indexChanged(index)

insert()

instructions()

keyboardfunc(c, x, y)

milestone_to_poser(m)

mousefunc(button, state, x, y)

onDurationsChanged()

Update the trajectory times

poser_to_milestone()

timeDriverChanged(value)

togglePlay(value)

updateAnimTrajectory()

updateGuiFromValue()

Called when the value is externally changed (from Load…)

addDialogItems(parent, ui='qt')[source]
animSelectorChanged(value)[source]
attach(object, relativePose=None)[source]

For an SE3 trajectory, shows the given object relative to the edited transform trajectory

delete()[source]
display()[source]
durationChanged(value)[source]
idle()[source]
indexChanged(index)[source]
insert()[source]
instructions()[source]
keyboardfunc(c, x, y)[source]
milestone_to_poser(m)[source]
mousefunc(button, state, x, y)[source]
onDurationsChanged()[source]

Update the trajectory times

poser_to_milestone()[source]
timeDriverChanged(value)[source]
togglePlay(value)[source]
updateAnimTrajectory()[source]
updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

class klampt.vis.editors.VisualEditorBase(name, value, description, world)[source]

Bases: klampt.vis.glcommon.GLWidgetPlugin

A base class for editing resources. Used in conjunction with run().

Methods:

addDialogItems(parent[, ui])

display()

display_screen()

instructions()

loadable()

Whether Load.

savable()

Whether Save.

updateGuiFromValue()

Called when the value is externally changed (from Load…)

updateValueFromGui()

Called when the value is requested (from Save.

addDialogItems(parent, ui='qt')[source]
display()[source]
display_screen()[source]
instructions()[source]
loadable()[source]

Whether Load… should be shown

savable()[source]

Whether Save… should be shown

updateGuiFromValue()[source]

Called when the value is externally changed (from Load…)

updateValueFromGui()[source]

Called when the value is requested (from Save… and OK)

class klampt.vis.editors.WorldEditor(name, value, description)[source]

Bases: klampt.vis.editors.VisualEditorBase

Edits poses of robots, rigid objects, and terrains in a world.

Note

Edits to robot and rigid object poses are done immediately, but since terrains do not have poses, their actual geometry needs to be updated. To apply the edited poses to the terrain geometries, call updateValueFromGui() after the editor has been run.

Methods:

display()

instructions()

loadable()

Whether Load.

motionfunc(button, state, x, y)

savable()

Whether Save.

updateValueFromGui()

Applies the transforms to all the terrain geometries.

display()[source]
instructions()[source]
loadable()[source]

Whether Load… should be shown

motionfunc(button, state, x, y)[source]
savable()[source]

Whether Save… should be shown

updateValueFromGui()[source]

Applies the transforms to all the terrain geometries.

klampt.vis.editors.run(editorObject)[source]

Launches a visual editor.

Parameters

editorObject (VisualEditorBase) – some subclass of VisualEditorBase

Returns

A pair (res,value) containing:

  • res (bool):True / False if OK / Cancel was pressed, respectively,

  • value: the return value of the editor object

Return type

tuple