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:
|
Edits a 3D axis-aligned bounding box |
|
Edits a Config object. |
|
Edits a Configs object. |
|
Edits a |
|
Edits rigid object transforms. |
|
Edits a 3-D point. |
|
Edits a 3-D transform. |
|
Edits a list of indices selecting some links of a robot. |
|
Edits a SimRobotSensor. |
|
Edits a sphere represented by a tuple |
|
Edits a |
|
A base class for editing resources. |
|
Edits poses of robots, rigid objects, and terrains in a world. |
Functions:
|
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 isklampt.math.se3
element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.Methods:
mousefunc
(button, state, x, y)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
orSubRobotModel
must be provided.Methods:
display
()mousefunc
(button, state, x, y)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
orSubRobotModel
must be provided.Methods:
addDialogItems
(parent[, ui])delete
()display
()indexChanged
(index)insert
()keyboardfunc
(c, x, y)mousefunc
(button, state, x, y)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 isklampt.math.se3
element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.Methods:
mousefunc
(button, state, x, y)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 theklampt.math.se3
transform.object
is the :class:~klampt.RigidObjectModel`.Methods:
mousefunc
(button, state, x, y)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 isklampt.math.se3
element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.Methods:
mousefunc
(button, state, x, y)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 isklampt.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.
Turns off editing of rotation.
Turns off editing of translation.
display
()motionfunc
(x, y, dx, dy)mousefunc
(button, state, x, y)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
()keyboardfunc
(c, x, y)mousefunc
(button, state, x, y)remove_selection
(id)toggle_selection
(id)Called when the value is externally changed (from Load…)
-
click_robot
(x, y)[source]¶ Helper: returns a list of robot objects sorted in order of increasing distance.
-
-
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
()Called by backend after the GL context is created but before the event loop starts.
loadable
()Whether Load.
motionfunc
(x, y, dx, dy)mousefunc
(button, state, x, y)savable
()Whether Save.
Called when the value is externally changed (from Load…)
Called when the value is requested (from Save.
-
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 isklampt.math.se3
element, and the input and output are measured with respect to that frame. However, the editing is done in world coordinates.Methods:
mousefunc
(button, state, x, y)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
, orSE3Trajectory
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
()keyboardfunc
(c, x, y)mousefunc
(button, state, x, y)Update the trajectory times
timeDriverChanged
(value)togglePlay
(value)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
()loadable
()Whether Load.
savable
()Whether Save.
Called when the value is externally changed (from Load…)
Called when the value is requested (from Save.
-
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
()loadable
()Whether Load.
motionfunc
(button, state, x, y)savable
()Whether Save.
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