pyrieef.rendering package¶
Submodules¶
pyrieef.rendering.common_imports module¶
pyrieef.rendering.gl_cartesian module¶
Optional 3D renderer based on Open3D’s visualizer.
pyrieef.rendering.gl_planar module¶
2D rendering framework imported from openai 15/08/08 https://github.com/openai/gym/blob/master/gym/envs/classic_control/rendering.py
-
class
pyrieef.rendering.gl_planar.
Color
(vec4)¶ Bases:
pyrieef.rendering.gl_planar.Attr
-
enable
()¶
-
-
class
pyrieef.rendering.gl_planar.
Compound
(gs)¶ Bases:
pyrieef.rendering.gl_planar.Geom
-
render1
()¶
-
-
class
pyrieef.rendering.gl_planar.
FilledPolygon
(v)¶ Bases:
pyrieef.rendering.gl_planar.Geom
-
render1
()¶
-
-
class
pyrieef.rendering.gl_planar.
Geom
¶ Bases:
object
-
add_attr
(attr)¶
-
render
()¶
-
render1
()¶
-
set_color
(r, g, b)¶
-
-
class
pyrieef.rendering.gl_planar.
Image
(width, height, arr=None, fname=None)¶ Bases:
pyrieef.rendering.gl_planar.Geom
-
render1
()¶
-
-
class
pyrieef.rendering.gl_planar.
Line
(start=(0.0, 0.0), end=(0.0, 0.0))¶ Bases:
pyrieef.rendering.gl_planar.Geom
-
render1
()¶
-
set_linewidth
(x)¶
-
-
class
pyrieef.rendering.gl_planar.
LineStyle
(style)¶ Bases:
pyrieef.rendering.gl_planar.Attr
-
disable
()¶
-
enable
()¶
-
-
class
pyrieef.rendering.gl_planar.
LineWidth
(stroke)¶ Bases:
pyrieef.rendering.gl_planar.Attr
-
enable
()¶
-
-
class
pyrieef.rendering.gl_planar.
Point
¶ Bases:
pyrieef.rendering.gl_planar.Geom
-
render1
()¶
-
-
class
pyrieef.rendering.gl_planar.
PolyLine
(v, close)¶ Bases:
pyrieef.rendering.gl_planar.Geom
-
render1
()¶
-
set_linewidth
(x)¶
-
-
class
pyrieef.rendering.gl_planar.
SimpleImageViewer
(display=None)¶ Bases:
object
-
close
()¶
-
imshow
(arr)¶
-
-
class
pyrieef.rendering.gl_planar.
Transform
(translation=(0.0, 0.0), rotation=0.0, scale=(1, 1))¶ Bases:
pyrieef.rendering.gl_planar.Attr
-
disable
()¶
-
enable
()¶
-
set_rotation
(new)¶
-
set_scale
(newx, newy)¶
-
set_translation
(newx, newy)¶
-
-
class
pyrieef.rendering.gl_planar.
Viewer
(width, height, display=None)¶ Bases:
object
-
add_geom
(geom)¶
-
add_onetime
(geom)¶
-
close
()¶
-
draw_circle
(radius=10, res=30, filled=True, **attrs)¶
-
draw_line
(start, end, **attrs)¶
-
draw_polygon
(v, filled=True, **attrs)¶
-
draw_polyline
(v, **attrs)¶
-
get_array
()¶
-
render
(return_rgb_array=False)¶
-
set_bounds
(left, right, bottom, top)¶
-
window_closed_by_user
()¶
-
-
pyrieef.rendering.gl_planar.
get_display
(spec)¶ Convert a display specification (such as :0) into an actual Display object. Pyglet only supports multiple Displays on Linux.
-
pyrieef.rendering.gl_planar.
make_capsule
(length, width)¶
-
pyrieef.rendering.gl_planar.
make_circle
(radius=10, res=30, filled=True)¶
-
pyrieef.rendering.gl_planar.
make_polygon
(v, filled=True)¶
-
pyrieef.rendering.gl_planar.
make_polyline
(v)¶
pyrieef.rendering.heightmap module¶
-
class
pyrieef.rendering.heightmap.
Heightmap
¶ Bases:
object
-
add_circle_to_draw
(origin, radius=1.0, color=(1, 0, 0), alpha=1.0)¶
-
add_sphere_to_draw
(origin, radius=1.0, color=(1, 0, 0), alpha=1.0)¶
-
draw
(black=False)¶
-
draw_objects
()¶
-
get_x
(i, dx)¶
-
get_y
(j, dy)¶
-
load
(image, dx, dy, dz)¶ loads the vertices positions from an image
-
transform
(x_min, x_max, y_min, y_max)¶ From certain box coordinates to heightmap coordinates
-
-
class
pyrieef.rendering.heightmap.
Primitive
(object_type, origin, radius, color, alpha)¶ Bases:
object
-
pyrieef.rendering.heightmap.
circle_verticies
(origin, radius=1, nb_verticies=20, z=0.0)¶ This way of proceeding is so stupid…
-
pyrieef.rendering.heightmap.
draw_gl
()¶
-
pyrieef.rendering.heightmap.
flux_qubit_potential
(phi_m, phi_p)¶
-
pyrieef.rendering.heightmap.
image_surface
(nb_points)¶ generate surface from data
-
pyrieef.rendering.heightmap.
potential_surface
(nb_points)¶ generete an abstract mathematical surface
-
pyrieef.rendering.heightmap.
resize_gl
(width, height)¶
-
pyrieef.rendering.heightmap.
sphere_coordinates
(lat, lon)¶
-
pyrieef.rendering.heightmap.
sphere_verticies
(origin, radius=1, step=10)¶ For the some reason the GLU makes colors as shit TODO It would be easier to implement with:
sphere = gluNewQuadric() gluSphere(sphere, o.radius, 50, 50)
This way of proceeding is so stupid…
pyrieef.rendering.heightmap_renderer module¶
pyrieef.rendering.optimization module¶
-
class
pyrieef.rendering.optimization.
TrajectoryOptimizationViewer
(objective, draw=True, draw_gradient=True, use_3d=False, use_gl=True, scale=700.0)¶ Bases:
object
Wrapper around a Trajectory objective function tha can draw the inner optimization quantities
-
draw
(trajectory, g_traj=None)¶
-
draw_gradient
(x)¶
-
forward
(x)¶
-
gradient
(x)¶
-
hessian
(x)¶
-
init_viewer
(workspace, scale=700.0)¶
-
reset_objective
()¶
-
pyrieef.rendering.shader module¶
pyrieef.rendering.show_image module¶
pyrieef.rendering.sphere module¶
pyrieef.rendering.workspace_cartesian module¶
pyrieef.rendering.workspace_planar module¶
-
class
pyrieef.rendering.workspace_planar.
WorkspaceDrawer
(workspace, wait_for_keyboard=False, rows=1, cols=1, scale=1.0, dynamic=False)¶ Bases:
pyrieef.rendering.workspace_planar.WorkspaceRender
Workspace display based on matplotlib backend
-
draw_ws_background
(phi, nb_points=100, color_style=<matplotlib.colors.ListedColormap object>, interpolate='bilinear')¶
-
draw_ws_circle
(radius, origin, color=(0, 1, 0))¶
-
draw_ws_img
(Z, interpolate='nearest', color_style=<matplotlib.colors.ListedColormap object>)¶ - Examples of coloring are[viridis, hot, bone, magma]
see page : https://matplotlib.org/examples/color/colormaps_reference.html
-
draw_ws_line
(line, color='r', color_id=None)¶
-
draw_ws_line_fill
(line, color='r', color_id=None, linewidth=2.0)¶ draws a line where points are given as a list
-
draw_ws_obstacles
()¶
-
draw_ws_point
(point, color='b', shape='x')¶
-
draw_ws_polygon
(vertices, origin, rotation, color=(1, 0, 0))¶
-
init
(rows, cols)¶
-
remove_axis
()¶
-
save_figure
(path)¶
-
set_drawing_axis
(i)¶
-
set_title
(title, fontsize=15)¶
-
show
()¶
-
show_once
(t_sleep=0.0001)¶
-
-
class
pyrieef.rendering.workspace_planar.
WorkspaceHeightmap
(workspace)¶ Bases:
pyrieef.rendering.workspace_planar.WorkspaceRender
Workspace display based on pyglet heighmap
-
close
()¶
-
draw_ws_background
(function)¶
-
draw_ws_circle
(radius, origin, color=(0, 1, 0), height=20.0)¶
-
draw_ws_line
(line, color=(1, 0, 0))¶
-
draw_ws_obstacles
()¶
-
draw_ws_point
(point, color='b', shape='x')¶
-
draw_ws_sphere
(p, height=20.0, color=(1, 0, 0))¶
-
heightmap_coordinates
(p, height)¶
-
normalize_height
(c)¶
-
on_draw
()¶
-
on_mouse_drag
(x, y, dx, dy, button, modifiers)¶
-
on_mouse_scroll
(x, y, scroll_x, scroll_y)¶
-
on_resize
(width, height)¶
-
render
(return_rgb_array=False)¶
-
reset_objects
()¶
-
reset_spheres
()¶
-
show
()¶
-
show_once
(t_sleep=0.2)¶
-
update
(dt)¶
-
window_closed_by_user
()¶
-
-
class
pyrieef.rendering.workspace_planar.
WorkspaceOpenGl
(workspace, wait_for_keyboard=False, display=None, scale=700.0)¶ Bases:
pyrieef.rendering.workspace_planar.WorkspaceRender
Workspace display based on pyglet backend
-
draw_ws_background
(phi, nb_points=100, color_style=<matplotlib.colors.ListedColormap object>, interpolate='bilinear')¶
-
draw_ws_circle
(radius, origin, color=(0, 1, 0))¶
-
draw_ws_img
(Z)¶
-
draw_ws_line
(line, color=(1, 0, 0))¶
-
draw_ws_obstacles
()¶
-
draw_ws_point
(point, color='b', shape='x')¶
-
draw_ws_polygon
(vertices, origin, rotation, color=(1, 0, 0))¶
-
show
()¶
-
show_once
()¶
-
-
class
pyrieef.rendering.workspace_planar.
WorkspaceRender
(workspace)¶ Bases:
object
Abstract class to draw a 2D workspace
-
abstract
draw_ws_background
(function)¶
-
abstract
draw_ws_circle
(radius, origin, color=(0, 1, 0))¶
-
abstract
draw_ws_line
(line, color=(1, 0, 0))¶
-
abstract
draw_ws_obstacles
()¶
-
abstract
draw_ws_polygon
(polygon, color=(1, 0, 0))¶
-
reset_objects
()¶
-
set_workspace
(workspace)¶
-
abstract
-
pyrieef.rendering.workspace_planar.
to_rgb3
(im)¶ we can use dstack and an array copy this has to be slow, we create an array with 3x the data we need and truncate afterwards