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:
|
A base class for editing resources. |
|
Edits a Config object. |
|
Edits a Configs object. |
|
Edits a |
|
Edits a list of indices selecting some links of a robot. |
|
Edits a 3-D point. |
|
Edits a 3-D transform. |
|
Edits a 3D axis-aligned bounding box |
|
Edits a sphere represented by a tuple |
|
Edits a |
|
Edits rigid object transforms. |
|
Edits poses of robots, rigid objects, and terrains in a world. |
|
Edits a SensorModel. |
Functions:
|
Launches a visual editor. |
- class klampt.vis.editors.VisualEditorBase(name, value, description, world)[source]
Bases:
GLWidgetPlugin
A base class for editing resources. Used in conjunction with
run()
.Methods:
loadable
()Whether Load.
savable
()Whether Save.
display
()Called when the value is externally changed (from Load...)
Called when the value is requested (from Save.
add_dialog_items
(parent[, ui])
- class klampt.vis.editors.ConfigEditor(name, value, description, world, robot=None)[source]
Bases:
VisualEditorBase
Edits a Config object.
Either a world or a
RobotModel
orSubRobotModel
must be provided.Methods:
mousefunc
(button, state, x, y)display
()Called when the value is externally changed (from Load...)
- class klampt.vis.editors.ConfigsEditor(name, value, description, world, robot=None)[source]
Bases:
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:
add_dialog_items
(parent[, ui])insert
()delete
()index_changed
(index)mousefunc
(button, state, x, y)keyboardfunc
(c, x, y)display
()Called when the value is externally changed (from Load...)
- class klampt.vis.editors.TrajectoryEditor(name, value, description, world, robot=None)[source]
Bases:
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:
attach
(object[, relativePose])For an SE3 trajectory, shows the given object relative to the edited transform trajectory
add_dialog_items
(parent[, ui])insert
()delete
()index_changed
(index)duration_changed
(value)time_driver_changed
(value)anim_selector_changed
(value)toggle_play
(value)Update the trajectory times
mousefunc
(button, state, x, y)keyboardfunc
(c, x, y)display
()idle
()Called when the value is externally changed (from Load...)
- class klampt.vis.editors.SelectionEditor(name, value, description, world, robot=None)[source]
Bases:
VisualEditorBase
Edits a list of indices selecting some links of a robot.
Methods:
add_dialog_items
(parent[, ui])clear
()click_world
(x, y)Helper: returns a list of world objects sorted in order of increasing distance.
click_robot
(x, y)Helper: returns a list of robot objects sorted in order of increasing distance.
add_selection
(id)remove_selection
(id)toggle_selection
(id)mousefunc
(button, state, x, y)keyboardfunc
(c, x, y)display
()Called when the value is externally changed (from Load...)
- click_world(x, y)[source]
Helper: returns a list of world objects sorted in order of increasing distance.
- class klampt.vis.editors.PointEditor(name, value, description, world, frame=None)[source]
Bases:
VisualEditorBase
Edits a 3-D point.
If
frame
is given, then it is aklampt.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:
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:
Turns off editing of translation.
Turns off editing of rotation.
attach
(object[, relativePose])Attaches an object to visually move along with the edited transform.
mousefunc
(button, state, x, y)motionfunc
(x, y, dx, dy)display
()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.
- Parameters:
object (RigidObjectModel or Geometry3D) – the object to move
relativePose (se3 element, optional) – if given, the relative pose of the object w.r.t. the transform
- class klampt.vis.editors.AABBEditor(name, value, description, world, frame=None)[source]
Bases:
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.SphereEditor(name, value, description, world, frame=None)[source]
Bases:
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.GeometricPrimitiveEditor(name, value, description, world, frame=None)[source]
Bases:
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:
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.WorldEditor(name, value, description)[source]
Bases:
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
update_value_from_gui()
after the editor has been run.Methods:
loadable
()Whether Load.
savable
()Whether Save.
display
()Applies the transforms to all the terrain geometries.
motionfunc
(button, state, x, y)
- class klampt.vis.editors.SensorEditor(name, value, description, world)[source]
Bases:
RigidTransformEditor
Edits a SensorModel.
Assumes that the sensor is attached to the first robot in the world, if
world
is provided.Methods:
Called by backend after the GL context is created but before the event loop starts.
loadable
()Whether Load.
savable
()Whether Save.
add_dialog_items
(parent[, ui])display
()mousefunc
(button, state, x, y)motionfunc
(x, y, dx, dy)Called when the value is requested (from Save.
Called when the value is externally changed (from Load...)
- klampt.vis.editors.run(editorObject)[source]
Launches a visual editor.
- Return type:
Tuple
[bool
,Any
]- 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