40 from amino.tf import Vec3, Quat, QuatTrans
42 from amino.util import ensure_cstring, is_string
45 FRAME_ROOT = ctypes.c_long.in_dll(libamino,
"aa_rx_frame_root").value
48 FRAME_NONE = ctypes.c_long.in_dll(libamino,
"aa_rx_frame_none").value
51 CONFIG_NONE = ctypes.c_long.in_dll(libamino,
"aa_rx_config_none").value
54 CONFIG_MULTI = ctypes.c_long.in_dll(libamino,
"aa_rx_config_multi").value
57 class RxSg(ctypes.Structure):
58 """Opaque type for scenegraph pointer."""
60 class RxSgSub(ctypes.Structure):
61 """Opaque type for sub-scenegraph pointer."""
63 class RxGeom(ctypes.Structure):
64 """Opaque type for geometry pointer."""
67 """Opaque type for geometry opts pointer."""
70 """Geometry options object.
78 """Constructs object with default and specified options.
81 options: A dictionary of options corresponding to GeomOpt attributes."""
82 self.
_ptr_ptr = libamino.aa_rx_geom_opt_create()
85 self.__setattr__(key, options[key])
88 libamino.aa_rx_geom_opt_destroy(self.
_ptr_ptr)
90 def _get_val(self, func):
91 return func(self.
_ptr_ptr).value
93 def _get_val3(self, func0, func1, func2):
100 def _get_bool(self, func):
106 """Boolean indicating whether to use for visual geometry."""
107 return self.
_get_bool_get_bool(libamino.aa_rx_geom_opt_get_visual)
111 """Boolean indicating whether to use for collision geometry."""
112 return self.
_get_bool_get_bool(libamino.aa_rx_geom_opt_get_collision)
116 """Boolean indicating to not display a shadow."""
117 return self.
_get_bool_get_bool(libamino.aa_rx_geom_opt_get_no_shadow)
121 """Float indicating alpha (transparency)."""
122 return self.
_get_val_get_val(libamino.aa_rx_geom_opt_get_alpha)
126 """Float indicating how much to scale the geometry."""
127 return self.
_get_val_get_val(libamino.aa_rx_geom_opt_get_scale)
131 """Three floats, between 0 and 1, for color in red-blue-green order."""
132 return self.
_get_val3_get_val3(libamino.aa_rx_geom_opt_get_color_red,
133 libamino.aa_rx_geom_opt_get_color_blue,
134 libamino.aa_rx_geom_opt_get_color_green)
138 """Three floats, between 0 and 1, for color in red-blue-green order."""
139 return self.
_get_val3_get_val3(libamino.aa_rx_geom_opt_get_specular_red,
140 libamino.aa_rx_geom_opt_get_specular_blue,
141 libamino.aa_rx_geom_opt_get_specular_green)
145 libamino.aa_rx_geom_opt_set_visual(self.
_ptr_ptr, value)
149 libamino.aa_rx_geom_opt_set_collision(self.
_ptr_ptr, value)
153 libamino.aa_rx_geom_opt_set_no_shadow(self.
_ptr_ptr, value)
156 def alpha(self, value):
157 libamino.aa_rx_geom_opt_set_alpha(self.
_ptr_ptr, value)
160 def scale(self, value):
161 libamino.aa_rx_geom_opt_set_scale(self.
_ptr_ptr, value)
164 def color(self, value):
165 libamino.aa_rx_geom_opt_set_color3(self.
_ptr_ptr, value[0], value[1],
170 libamino.aa_rx_geom_opt_set_specular3(self.
_ptr_ptr, value[0], value[1],
175 """Ensures thing is a GeomOpt, converting dicts if necessary."""
176 if isinstance(thing, GeomOpt):
178 elif isinstance(thing, dict):
187 """A geometry object."""
191 def __init__(self, _ptr):
195 def box(opt, dimension):
196 """Creates a box geometry object."""
197 o = GeomOpt.ensure(opt)
198 return Geom(libamino.aa_rx_geom_box(o._ptr, Vec3.ensure(dimension)))
202 """Creates a sphere geometry object."""
203 o = GeomOpt.ensure(opt)
204 return Geom(libamino.aa_rx_geom_sphere(o._ptr, radius))
208 """Creates a cylinder geometry object."""
209 o = GeomOpt.ensure(opt)
210 return Geom(libamino.aa_rx_geom_cylinder(o._ptr, height, radius))
213 def cone(opt, height, start_radius, end_radius):
214 """Creates a cone geometry object."""
215 o = GeomOpt.ensure(opt)
217 libamino.aa_rx_geom_cone(o._ptr, height, start_radius, end_radius))
220 def torus(opt, angle, major_radius, minor_radius):
221 """Creates a torus geometry object."""
222 o = GeomOpt.ensure(opt)
224 libamino.aa_rx_geom_torus(o._ptr, angle, major_radius,
228 def grid(opt, dimension, delta, width):
229 """Creates a grid geometry object."""
230 o = GeomOpt.ensure(opt)
231 c_dimension = (ctypes.c_double * 2)(dimension[0], dimension[1])
232 c_delta = (ctypes.c_double * 2)(delta[0], delta[1])
238 libamino.aa_rx_geom_grid(o._ptr, c_dimension, c_delta, width))
241 libamino.aa_rx_geom_opt_create.argtypes = []
242 libamino.aa_rx_geom_opt_create.restype = ctypes.POINTER(RxGeomOpt)
243 libamino.aa_rx_geom_opt_destroy.argtypes = [ctypes.POINTER(RxGeomOpt)]
245 libamino.aa_rx_geom_opt_set_no_shadow.argtypes = [
246 ctypes.POINTER(RxGeomOpt), ctypes.c_int
249 libamino.aa_rx_geom_opt_set_visual.argtypes = [
250 ctypes.POINTER(RxGeomOpt), ctypes.c_int
253 libamino.aa_rx_geom_opt_set_collision.argtypes = [
254 ctypes.POINTER(RxGeomOpt), ctypes.c_int
257 libamino.aa_rx_geom_opt_set_alpha.argtypes = [
258 ctypes.POINTER(RxGeomOpt), ctypes.c_double
261 libamino.aa_rx_geom_opt_set_color3.argtypes = [
262 ctypes.POINTER(RxGeomOpt), ctypes.c_double, ctypes.c_double,
266 libamino.aa_rx_geom_opt_set_specular3.argtypes = [
267 ctypes.POINTER(RxGeomOpt), ctypes.c_double, ctypes.c_double,
271 libamino.aa_rx_geom_opt_set_scale.argtypes = [
272 ctypes.POINTER(RxGeomOpt), ctypes.c_double
275 libamino.aa_rx_geom_opt_get_scale.argtypes = [ctypes.POINTER(RxGeomOpt)]
276 libamino.aa_rx_geom_opt_get_scale.restypes = ctypes.c_double
278 libamino.aa_rx_geom_opt_get_alpha.argtypes = [ctypes.POINTER(RxGeomOpt)]
279 libamino.aa_rx_geom_opt_get_alpha.restypes = ctypes.c_double
281 libamino.aa_rx_geom_opt_get_color_red.argtypes = [ctypes.POINTER(RxGeomOpt)]
282 libamino.aa_rx_geom_opt_get_color_red.restypes = ctypes.c_double
283 libamino.aa_rx_geom_opt_get_color_blue.argtypes = [ctypes.POINTER(RxGeomOpt)]
284 libamino.aa_rx_geom_opt_get_color_blue.restypes = ctypes.c_double
285 libamino.aa_rx_geom_opt_get_color_green.argtypes = [ctypes.POINTER(RxGeomOpt)]
286 libamino.aa_rx_geom_opt_get_color_green.restypes = ctypes.c_double
288 libamino.aa_rx_geom_opt_get_specular_red.argtypes = [ctypes.POINTER(RxGeomOpt)]
289 libamino.aa_rx_geom_opt_get_specular_red.restypes = ctypes.c_double
290 libamino.aa_rx_geom_opt_get_specular_blue.argtypes = [
291 ctypes.POINTER(RxGeomOpt)
293 libamino.aa_rx_geom_opt_get_specular_blue.restypes = ctypes.c_double
294 libamino.aa_rx_geom_opt_get_specular_green.argtypes = [
295 ctypes.POINTER(RxGeomOpt)
297 libamino.aa_rx_geom_opt_get_specular_green.restypes = ctypes.c_double
299 libamino.aa_rx_geom_box.argtypes = [
300 ctypes.POINTER(RxGeomOpt), ctypes.POINTER(Vec3)
302 libamino.aa_rx_geom_box.restype = ctypes.POINTER(RxGeom)
304 libamino.aa_rx_geom_sphere.argtypes = [
305 ctypes.POINTER(RxGeomOpt), ctypes.c_double
307 libamino.aa_rx_geom_sphere.restype = ctypes.POINTER(RxGeom)
309 libamino.aa_rx_geom_cylinder.argtypes = [
310 ctypes.POINTER(RxGeomOpt), ctypes.c_double, ctypes.c_double
312 libamino.aa_rx_geom_cylinder.restype = ctypes.POINTER(RxGeom)
314 libamino.aa_rx_geom_cone.argtypes = [
315 ctypes.POINTER(RxGeomOpt), ctypes.c_double, ctypes.c_double,
318 libamino.aa_rx_geom_cone.restype = ctypes.POINTER(RxGeom)
320 libamino.aa_rx_geom_grid.argtypes = [
321 ctypes.POINTER(RxGeomOpt),
322 ctypes.POINTER(ctypes.c_double),
323 ctypes.POINTER(ctypes.c_double), ctypes.c_double
325 libamino.aa_rx_geom_grid.restype = ctypes.POINTER(RxGeom)
327 libamino.aa_rx_geom_torus.argtypes = [
328 ctypes.POINTER(RxGeomOpt), ctypes.c_double, ctypes.c_double,
331 libamino.aa_rx_geom_torus.restype = ctypes.POINTER(RxGeom)
338 def __init__(self, ptr=None):
340 self.
_ptr_ptr = libamino.aa_rx_sg_create()
345 libamino.aa_rx_sg_destroy(self.
_ptr_ptr)
349 """Adds a new fixed frame to the scene."""
350 E = QuatTrans.ensure(tf)
351 name = ensure_cstring(name)
352 parent = ensure_cstring(parent)
353 libamino.aa_rx_sg_add_frame_fixed(self.
_ptr_ptr, parent, name, E.quat,
360 tf=QuatTrans.identity(),
365 """Adds a new revolute frame to the scene."""
366 E = QuatTrans.ensure(tf)
367 if config_name
is None:
369 name = ensure_cstring(name)
370 parent = ensure_cstring(parent)
371 config_name = ensure_cstring(config_name)
372 libamino.aa_rx_sg_add_frame_revolute(self.
_ptr_ptr, parent, name, E.quat,
373 E.trans, config_name,
374 Vec3.ensure(axis), offset)
380 tf=QuatTrans.identity(),
386 """Adds a new prismatic frame to the scene."""
387 E = QuatTrans.ensure(tf)
388 if config_name
is None:
390 name = ensure_cstring(name)
391 parent = ensure_cstring(parent)
392 config_name = ensure_cstring(config_name)
393 libamino.aa_rx_sg_add_frame_prismatic(self.
_ptr_ptr, parent, name, E.quat,
394 E.trans, config_name,
395 Vec3.ensure(axis), offset)
399 libamino.aa_rx_sg_set_limit_pos(self.
_ptr_ptr, config_name, limits[0], limits[1])
402 """Removes a frame from the scene"""
403 libamino.aa_rx_sg_rm_frame(self.
_ptr_ptr, ensure_cstring(name))
406 """Attaches geometry to the named frame."""
407 name = ensure_cstring(name)
410 elif isinstance(geom, Geom):
411 libamino.aa_rx_geom_attach(self.
_ptr_ptr, name, geom._ptr)
412 elif isinstance(geom, (list, tuple)):
416 raise Exception(
"Invalid Geom config provided.")
418 def reparent(self, new_parent, frame, rel_tf=QuatTrans.identity()):
419 """Change the parent of frame in the scenegraph."""
420 frame = ensure_cstring(frame)
421 new_parent = ensure_cstring(new_parent)
422 libamino.aa_rx_sg_reparent_name(self.
_ptr_ptr, new_parent, frame, rel_tf)
425 def load(self, filename, name, root=""):
426 """Loads a scene plugin into this scene.
429 filname: plugin name, passed directly to dlopen().
430 name: scene name, as provided to the scene compiler.
431 root: parent frame for the loaded scene.
434 LookupError: the shared object or named scene could not be found.
436 root = ensure_cstring(root)
437 name = ensure_cstring(name)
438 filename = ensure_cstring(filename)
439 r = libamino.aa_rx_dl_sg_at(filename, name, self.
_ptr_ptr, root)
441 raise LookupError(
"Could not load scene %s:%s" % (filename, name))
444 """Initializes the scene, must be called after all frames are added."""
445 libamino.aa_rx_sg_init(self.
_ptr_ptr)
449 """Set allowed collisions between frames id0 and id1."""
452 libamino.aa_rx_sg_allow_collision(self.
_ptr_ptr, id0, id1, allowed)
457 """Number of configuration variables in the scene."""
458 return libamino.aa_rx_sg_config_count(self.
_ptr_ptr)
462 """Number of frames in the scene."""
463 return libamino.aa_rx_sg_frame_count(self.
_ptr_ptr)
466 """Returns the config id for string name."""
467 name = ensure_cstring(name)
468 return libamino.aa_rx_sg_config_id(self.
_ptr_ptr, name)
471 """Returns the frame id for string name."""
472 name = ensure_cstring(name)
473 return libamino.aa_rx_sg_frame_id(self.
_ptr_ptr, name)
476 """Returns the config name for the id."""
477 name = libamino.aa_rx_sg_config_name(self.
_ptr_ptr, i)
478 return str(name, encoding=
"utf-8")
481 """Returns the frame name for the id.
484 IndexError: value is out of range.
486 if i >= self.
frame_countframe_count
or i < FRAME_NONE:
487 raise IndexError(
"Invalid frame id: %d" % i)
489 name = libamino.aa_rx_sg_frame_name(self.
_ptr_ptr, i)
490 return str(name, encoding=
"utf-8")
493 """Ensures value is a config id, converting strings if necessary.
496 IndexError: value is out range.
497 ValueError: config name is invalid.
500 if self.
config_idconfig_id(value) == CONFIG_NONE:
501 raise ValueError(
"Invalid config name: %s" % value)
505 raise IndexError(
"Invalid config id: %d" % value)
509 """Ensures value is a string config name, converting int ids if necessary.
512 IndexError: value is out of range.
513 ValueError: config name is invalid.
517 if id == CONFIG_NONE:
518 raise ValueError(
"Invalid config name: %s" % value)
522 raise IndexError(
"Invalid config id: %d" % value)
526 """Ensures value is a frame id, converting strings if necessary.
529 IndexError: value is out range.
530 ValueError: frame name is invalid.
535 raise ValueError(
"Invalid frame name: %s" % value)
538 if value >= self.
frame_countframe_count
or value <= FRAME_NONE:
539 raise IndexError(
"Invalid frame id: %d" % value)
543 """Ensures value is a frame id, converting strings if necessary.
545 The difference between this function and ensure_frame_id() is
546 that this function throws errors if given reserved frame ids,
547 FRAME_ROOT and FRAME_NONE.
550 IndexError: value is out range.
554 raise IndexError(
"Invalid frame id: %d" % value)
558 """Ensures value is a string frame name, converting int ids if necessary.
561 IndexError: value is out of range.
562 ValueError: frame name is invalid.
567 raise ValueError(
"Invalid frame name: %s" % value)
570 if value >= self.
frame_countframe_count
or value <= FRAME_NONE:
571 raise IndexError(
"Invalid frame id: %d" % value)
575 """Create or convert to a configuration vector.
578 IndexError: provided vector is the wrong size"""
579 if isinstance(config, dict):
586 vector[self.
config_idconfig_id(key)] = config[key]
589 return DVec.ensure(config)
591 vector.copy_from(config)
595 """Copy configuration as a vector."""
599 """Convert vector to a dict."""
606 """Get the name of the parent of the input frame"""
608 parent = libamino.aa_rx_sg_frame_parent(self.
_ptr_ptr, frame_id)
612 """Return a SubSceneGraph for the chain from root to tip.
615 key: a slice starting at the root and ending at the tip.
618 LookupError: invalid slice or frames
620 if isinstance(key, slice):
621 if key.step
is not None:
622 raise LookupError(
"Cannot step scenegraph")
623 root_key =
"" if key.start
is None else key.start
626 ptr = libamino.aa_rx_sg_chain_create(self.
_ptr_ptr, root, tip)
629 raise LookupError(
"Could not get scene graph items")
632 """Create a copy of the scenegraph"""
639 libamino.aa_rx_sg_create.argtypes = []
640 libamino.aa_rx_sg_create.restype = ctypes.POINTER(RxSg)
641 libamino.aa_rx_sg_destroy.argtypes = [ctypes.POINTER(RxSg)]
642 libamino.aa_rx_sg_init.argtypes = [ctypes.POINTER(RxSg)]
644 libamino.aa_rx_sg_config_count.argtypes = [ctypes.POINTER(RxSg)]
645 libamino.aa_rx_sg_config_count.restype = ctypes.c_size_t
647 libamino.aa_rx_sg_frame_count.argtypes = [ctypes.POINTER(RxSg)]
648 libamino.aa_rx_sg_frame_count.restype = ctypes.c_size_t
650 libamino.aa_rx_sg_config_id.argtypes = [ctypes.POINTER(RxSg), ctypes.c_char_p]
651 libamino.aa_rx_sg_config_id.restype = ctypes.c_int
653 libamino.aa_rx_sg_frame_id.argtypes = [ctypes.POINTER(RxSg), ctypes.c_char_p]
654 libamino.aa_rx_sg_frame_id.restype = ctypes.c_int
656 libamino.aa_rx_sg_frame_name.argtypes = [ctypes.POINTER(RxSg), ctypes.c_int]
657 libamino.aa_rx_sg_frame_name.restype = ctypes.c_char_p
659 libamino.aa_rx_sg_config_name.argtypes = [ctypes.POINTER(RxSg), ctypes.c_int]
660 libamino.aa_rx_sg_config_name.restype = ctypes.c_char_p
662 libamino.aa_rx_sg_reparent_name.argtypes = [ctypes.POINTER(RxSg), ctypes.c_char_p,
663 ctypes.c_char_p, ctypes.POINTER(QuatTrans)]
665 libamino.aa_rx_sg_tf.argtypes = [ctypes.POINTER(RxSg), ctypes.c_size_t,
666 ctypes.POINTER(ctypes.c_double), ctypes.c_size_t,
667 ctypes.POINTER(ctypes.c_double), ctypes.c_size_t,
668 ctypes.POINTER(ctypes.c_double), ctypes.c_size_t]
670 libamino.aa_rx_sg_frame_parent.argtypes = [ctypes.POINTER(RxSg), ctypes.c_int]
671 libamino.aa_rx_sg_frame_parent.restype = ctypes.c_int
674 libamino.aa_rx_sg_copy.argtypes = [ctypes.POINTER(RxSg)]
675 libamino.aa_rx_sg_copy.restype = ctypes.POINTER(RxSg)
677 libamino.aa_rx_sg_allow_collision.argtypes = [ctypes.POINTER(RxSg), ctypes.c_int,
678 ctypes.c_int, ctypes.c_int]
680 libamino.aa_rx_sg_set_limit_pos.argtypes = [ctypes.POINTER(RxSg), ctypes.c_char_p,
681 ctypes.c_double, ctypes.c_double]
683 libamino.aa_rx_dl_sg_at.argtypes = [
684 ctypes.c_char_p, ctypes.c_char_p,
685 ctypes.POINTER(RxSg), ctypes.c_char_p
687 libamino.aa_rx_dl_sg_at.restype = ctypes.POINTER(RxSg)
689 libamino.aa_rx_sg_add_frame_fixed.argtypes = [
690 ctypes.POINTER(RxSg), ctypes.c_char_p, ctypes.c_char_p,
691 ctypes.POINTER(Quat),
695 libamino.aa_rx_sg_add_frame_revolute.argtypes = [
696 ctypes.POINTER(RxSg), ctypes.c_char_p, ctypes.c_char_p,
697 ctypes.POINTER(Quat),
698 ctypes.POINTER(Vec3), ctypes.c_char_p,
699 ctypes.POINTER(Vec3), ctypes.c_double
702 libamino.aa_rx_sg_add_frame_prismatic.argtypes = [
703 ctypes.POINTER(RxSg), ctypes.c_char_p, ctypes.c_char_p,
704 ctypes.POINTER(Quat),
705 ctypes.POINTER(Vec3), ctypes.c_char_p,
706 ctypes.POINTER(Vec3), ctypes.c_double
709 libamino.aa_rx_sg_rm_frame.argtypes = [ctypes.POINTER(RxSg), ctypes.c_char_p]
711 libamino.aa_rx_geom_attach.argtypes = [
712 ctypes.POINTER(RxSg), ctypes.c_char_p,
713 ctypes.POINTER(RxGeom)
716 libamino.aa_rx_sg_fill_tf_abs.argtypes = [
717 ctypes.POINTER(RxSg),
718 ctypes.POINTER(DVec),
724 """A subset of a scene graph"""
726 __slots__ = [
'_ptr',
'scenegraph']
728 def __init__(self, scenegraph, _ptr):
729 """Initialize from a scenegraph and sub-scenegraph pointer."""
734 libamino.aa_rx_sg_sub_destroy(self.
_ptr_ptr)
749 """Returns the number of configuration variables in the sub-scenegraph."""
750 return libamino.aa_rx_sg_sub_config_count(self.
_ptr_ptr)
753 """Copy elements of a sub-scenegraph config into the full config vector."""
754 if isinstance(config_sub, dict):
757 if vector_all
is None:
760 libamino.aa_rx_sg_sub_config_scatter(self.
_ptr_ptr, config_sub, vector_all)
764 """Copy elements of a full config into the sub config vector."""
766 if vector_sub
is None:
768 libamino.aa_rx_sg_sub_config_gather(self.
_ptr_ptr, config_all, vector_sub)
773 """Returns the frame id of the end-effector."""
774 return libamino.aa_rx_sg_sub_frame_ees(self.
_ptr_ptr)[0]
777 """Convert config to a vector."""
780 return DVec.ensure(config)
782 vector.copy_from(config)
793 libamino.aa_rx_sg_sub_destroy.argtypes = [ctypes.POINTER(RxSgSub)]
795 libamino.aa_rx_sg_sub_jacobian_size.argtypes = [
796 ctypes.POINTER(RxSgSub),
797 ctypes.POINTER(ctypes.c_size_t),
798 ctypes.POINTER(ctypes.c_size_t)
801 libamino.aa_rx_sg_sub_jacobian.argtypes = [
802 ctypes.POINTER(RxSgSub), ctypes.c_size_t,
803 ctypes.POINTER(ctypes.c_double), ctypes.c_size_t,
804 ctypes.POINTER(ctypes.c_double), ctypes.c_size_t
808 libamino.aa_rx_sg_sub_config_count.argtypes = [ctypes.POINTER(RxSgSub)]
809 libamino.aa_rx_sg_sub_config_count.restype = ctypes.c_size_t
811 libamino.aa_rx_sg_sub_config_scatter.argtypes = [
812 ctypes.POINTER(RxSgSub),
813 ctypes.POINTER(DVec),
817 libamino.aa_rx_sg_sub_config_gather.argtypes = [
818 ctypes.POINTER(RxSgSub),
819 ctypes.POINTER(DVec),
823 libamino.aa_rx_sg_chain_create.argtypes = [
824 ctypes.POINTER(RxSg), ctypes.c_int, ctypes.c_int
826 libamino.aa_rx_sg_chain_create.restype = ctypes.POINTER(RxSgSub)
828 libamino.aa_rx_sg_sub_frame_ees.argtypes = [ctypes.POINTER(RxSgSub)]
829 libamino.aa_rx_sg_sub_frame_ees.restype = ctypes.POINTER(ctypes.c_int)
831 libamino.aa_rx_sg_sub_frame_ee.argtypes = [ctypes.POINTER(RxSgSub)]
832 libamino.aa_rx_sg_sub_frame_ee.restype = ctypes.c_int
def no_shadow(self)
Boolean indicating to not display a shadow.
def specular(self)
Three floats, between 0 and 1, for color in red-blue-green order.
def visual(self)
Boolean indicating whether to use for visual geometry.
def collision(self)
Boolean indicating whether to use for collision geometry.
def color(self)
Three floats, between 0 and 1, for color in red-blue-green order.
def scale(self)
Float indicating how much to scale the geometry.
def _get_val3(self, func0, func1, func2)
def ensure(thing)
Ensures thing is a GeomOpt, converting dicts if necessary.
def alpha(self)
Float indicating alpha (transparency).
def _get_bool(self, func)
def __init__(self, options=None)
Constructs object with default and specified options.
def box(opt, dimension)
Creates a box geometry object.
def cylinder(opt, height, radius)
Creates a cylinder geometry object.
def torus(opt, angle, major_radius, minor_radius)
Creates a torus geometry object.
def sphere(opt, radius)
Creates a sphere geometry object.
def grid(opt, dimension, delta, width)
Creates a grid geometry object.
def cone(opt, height, start_radius, end_radius)
Creates a cone geometry object.
Opaque type for geometry opts pointer.
Opaque type for geometry pointer.
def allow_collision(self, i, j, allowed=1)
Set allowed collisions between frames id0 and id1.
def init(self)
Initializes the scene, must be called after all frames are added.
def ensure_frame_id_actual(self, value)
Ensures value is a frame id, converting strings if necessary.
def add_frame_prismatic(self, parent, name, tf=QuatTrans.identity(), config_name=None, axis=(0, 0, 1), offset=0, geom=None, limits=None)
Adds a new prismatic frame to the scene.
def ensure_config_name(self, value)
Ensures value is a string config name, converting int ids if necessary.
def copy(self)
Create a copy of the scenegraph.
def add_frame_revolute(self, parent, name, tf=QuatTrans.identity(), config_name=None, axis=(0, 0, 1), offset=0, geom=None)
Adds a new revolute frame to the scene.
def frame_name(self, i)
Returns the frame name for the id.
def config_count(self)
Number of configuration variables in the scene.
def ensure_frame_id(self, value)
Ensures value is a frame id, converting strings if necessary.
def copy_config(self, config)
Copy configuration as a vector.
def load(self, filename, name, root="")
Loads a scene plugin into this scene.
def config_vector(self, config, vector=None)
Create or convert to a configuration vector.
def get_parent(self, frame)
Get the name of the parent of the input frame.
def frame_count(self)
Number of frames in the scene.
def attach_geom(self, name, geom)
Attaches geometry to the named frame.
def ensure_frame_name(self, value)
Ensures value is a string frame name, converting int ids if necessary.
def config_name(self, i)
Returns the config name for the id.
def remove_frame(self, name)
Removes a frame from the scene.
def frame_id(self, name)
Returns the frame id for string name.
def add_frame_fixed(self, parent, name, tf=QuatTrans.identity(), geom=None)
Adds a new fixed frame to the scene.
def config_id(self, name)
Returns the config id for string name.
def ensure_config_id(self, value)
Ensures value is a config id, converting strings if necessary.
def reparent(self, new_parent, frame, rel_tf=QuatTrans.identity())
Change the parent of frame in the scenegraph.
def config_dict(self, vector)
Convert vector to a dict.
def __getitem__(self, key)
Return a SubSceneGraph for the chain from root to tip.
A subset of a scene graph.
def end_effector_id(self)
Returns the frame id of the end-effector.
def gather_config(self, config_all, vector_sub=None)
Copy elements of a full config into the sub config vector.
def config_count(self)
Returns the number of configuration variables in the sub-scenegraph.
def scatter_config(self, config_sub, vector_all=None)
Copy elements of a sub-scenegraph config into the full config vector.
def config_vector(self, config, vector=None)
Convert config to a vector.
def __init__(self, scenegraph, _ptr)
Initialize from a scenegraph and sub-scenegraph pointer.