Graphical user interface

Primitive functions

pymanoid.gui.draw_arrow(origin, end, color='r', linewidth=0.02)

Draw an arrow between two points.

Parameters
  • origin (array, shape=(3,)) – World coordinates of the origin of the arrow.

  • end (array, shape=(3,)) – World coordinates of the end of the arrow.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • linewidth (scalar, optional) – Thickness of arrow.

Returns

handle – OpenRAVE graphical handle. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

openravepy.GraphHandle

pymanoid.gui.draw_force(point, force, scale=0.0025, color='r', linewidth=0.015)

Draw a force acting at a given point.

Parameters
  • point (array, shape=(3,)) – Point where the force is acting.

  • force (array, shape=(3,)) – Force vector, in [N].

  • scale (scalar, optional) – Force-to-distance scaling factor in [N] / [m].

  • linewidth (scalar, optional) – Thickness of force vector.

Returns

handles – Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of GUI handles

pymanoid.gui.draw_line(start_point, end_point, color='g', linewidth=1.0)

Draw a line between two points.

Parameters
  • start_point (array, shape=(3,)) – One end of the line, in world frame coordinates.

  • end_point (array, shape=(3,)) – Other end of the line, in world frame coordinates.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • linewidth (scalar) – Thickness of drawn line.

Returns

handle – OpenRAVE graphical handle. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

openravepy.GraphHandle

pymanoid.gui.draw_point(point, color='g', pointsize=0.01)

Draw a point.

Parameters
  • point (array, shape=(3,)) – Point coordinates in the world frame.

  • pointsize (scalar, optional) – Radius of the drawn sphere in [m].

Returns

handle – OpenRAVE graphical handle. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

openravepy.GraphHandle

pymanoid.gui.draw_points(points, color='g', pointsize=0.01)

Draw a list of points.

Parameters
  • point (list of arrays) – List of point coordinates in the world frame.

  • pointsize (scalar, optional) – Radius of the drawn sphere in [m].

Returns

handle – OpenRAVE graphical handle. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

openravepy.GraphHandle

pymanoid.gui.draw_trajectory(points, color='b', linewidth=3, pointsize=0.01)

Draw a trajectory as a set of points connected by line segments.

Parameters
  • = array (points) – List of points or 2D array.

  • shape=(N – List of points or 2D array.

  • 3) – List of points or 2D array.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • linewidth (scalar) – Thickness of drawn line.

  • pointsize (scalar) – Vertex size.

Returns

handles – OpenRAVE graphical handles. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of openravepy.GraphHandle

pymanoid.gui.draw_wrench(surface, wrench, scale=0.005, pointsize=0.02, linewidth=0.01, yaw_moment=False)

Draw a 6D wrench as a 3D force applied at the center of pressure of a given surface frame.

Parameters
  • surface (surface) – Surface at which the wrench is acting.

  • wrench (ndarray) – 6D wrench vector in world-frame coordinates.

  • scale (scalar) – Scaling factor between Euclidean and Force spaces.

  • pointsize (scalar) – Point radius in [m].

  • linewidth (scalar) – Thickness of force vector.

  • yaw_moment (bool, optional) – Depict the yaw moment by a blue line.

Returns

handles – This list must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of OpenRAVE handles

Convex polyhedra

Polyhedra correspond to the sets of linear inequality constraints applied to the system, for instance the support area in which the zero-tilting moment point (ZMP) of a legged robot should lie to avoid breaking contacts with the ground.

pymanoid.gui.draw_2d_cone(vertices, rays, normal, combined='g-#', color=None, faces=None)

Draw a 2D cone defined from its rays and vertices. The normal vector n of the plane containing the cone must also be supplied.

Parameters
  • vertices (list of 3D arrays) – Vertices of the 2D cone in the world frame.

  • rays (list of 3D arrays) – Rays of the 2D cone in the world frame.

  • normal (array, shape=(3,)) – Unit vector normal to the drawing plane.

  • combined (string) – Drawing spec in matplotlib fashion: color letter, followed by characters representing the faces of the cone to draw (‘.’ for vertices, ‘-‘ for edges, ‘#’ for facets). Default is ‘g-#’.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • faces (string) – Specifies the faces of the polyhedron to draw. Format is the same as combined.

Returns

handle – OpenRAVE graphical handle. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

openravepy.GraphHandle

pymanoid.gui.draw_cone(apex, axis, section, combined='r-#', color=None, linewidth=2.0, pointsize=0.05)

Draw a 3D cone defined from its apex, axis vector and a cross-section polygon (defined in the plane orthogonal to the axis vector).

Parameters
  • apex (array) – Position of the origin of the cone in world coordinates.

  • axis (array) – Unit vector directing the cone axis and lying inside.

  • combined (string, optional) – Drawing spec in matplotlib fashion. Default is ‘g-#’.

  • linewidth (scalar, optional) – Thickness of the edges of the cone.

  • pointsize (scalar, optional) – Point size in [m].

Returns

handles – Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of GUI handles

pymanoid.gui.draw_horizontal_polygon(points, height, combined='g-#', color=None, faces=None, linewidth=1.0, pointsize=0.01)

Draw a horizontal polygon defined as the convex hull of a set of 2D points.

Parameters
  • points (list of arrays) – List of coplanar 2D points.

  • height (scalar) – Height to draw the polygon at.

  • combined (string, optional) – Drawing spec in matplotlib fashion. Default: ‘g-#’.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • faces (string) – Faces of the polyhedron to draw. Use ‘.’ for vertices, ‘-‘ for edges and ‘#’ for facets.

  • linewidth (scalar) – Thickness of drawn line.

  • pointsize (scalar) – Vertex size.

Returns

handles – OpenRAVE graphical handles. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of openravepy.GraphHandle

pymanoid.gui.draw_polygon(points, normal, combined='g-#', color=None, faces=None, linewidth=1.0, pointsize=0.01)

Draw a polygon defined as the convex hull of a set of points. The normal vector n of the plane containing the polygon must also be supplied.

Parameters
  • points (list of arrays) – List of coplanar 3D points.

  • normal (array, shape=(3,)) – Unit vector normal to the drawing plane.

  • combined (string, optional) – Drawing spec in matplotlib fashion. Default: ‘g-#’.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • faces (string) – Faces of the polyhedron to draw. Use ‘.’ for vertices, ‘-‘ for edges and ‘#’ for facets.

  • linewidth (scalar) – Thickness of drawn line.

  • pointsize (scalar) – Vertex size.

Returns

handles – OpenRAVE graphical handles. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of openravepy.GraphHandle

pymanoid.gui.draw_polytope(points, combined='g-#', color=None, faces=None, linewidth=1.0, pointsize=0.01, hull=None)

Draw a polyhedron defined as the convex hull of a set of points.

Parameters
  • points (list of arrays) – List of 3D points in the world frame.

  • combined (string, optional) – Drawing spec in matplotlib fashion. Default: ‘g-#’.

  • color (char or triplet, optional) – Color letter or RGB values, default is ‘g’ for green.

  • faces (string, optional) – Faces of the polytope to draw. Use ‘.’ for vertices, ‘-‘ for edges and ‘#’ for facets.

  • hull (scipy.spatial.ConvexHull) – 2D convex hull provided when drawing polygons, in which case the 3D hull has zero volume.

  • linewidth (scalar) – Thickness of drawn line.

  • pointsize (scalar) – Vertex size.

Returns

handles – OpenRAVE graphical handles. Must be stored in some variable, otherwise the drawn object will vanish instantly.

Return type

list of openravepy.GraphHandle

Notes

In the faces or combined strings, use ‘.’ for vertices, ‘-‘ for edges and ‘#’ for facets.

Drawers

class pymanoid.gui.WrenchDrawer

Draw contact wrenches applied to the robot.

on_tick(sim)

Find supporting contact forces at each COM acceleration update.

Parameters

sim (pymanoid.Simulation) – Simulation instance.

class pymanoid.gui.PointMassWrenchDrawer(point_mass, contact_set)

Draw contact wrenches applied to a point-mass system in multi-contact.

Parameters
  • point_mass (PointMass) – Point-mass to which forces are applied.

  • contact_set (ContactSet) – Set of contacts providing interaction forces.

on_tick(sim)

Find supporting contact forces at each COM acceleration update.

Parameters

sim (pymanoid.Simulation) – Simulation instance.

class pymanoid.gui.RobotWrenchDrawer(robot)
on_tick(sim)

Main function called by the simulation at each control cycle.

Parameters

sim (Simulation) – Current simulation instance.

class pymanoid.gui.StaticEquilibriumWrenchDrawer(stance)

Draw contact wrenches applied to a robot in static-equilibrium.

Parameters

stance (pymanoid.Stance) – Contacts and COM position of the robot.

class pymanoid.gui.TrajectoryDrawer(body, combined='b-', color=None, linewidth=3, linestyle=None, buffer_size=1000)

Draw the trajectory of a rigid body.

Parameters
  • body (Body) – Rigid body whose trajectory to draw.

  • combined (string, optional) – Drawing spec of the trajectory in matplotlib fashion.

  • color (char or RGBA tuple, optional) – Drawing color.

  • linewidth (scalar, optional) – Thickness of drawn lines.

  • linestyle (char, optional) – Choix between ‘-‘ for continuous and ‘.’ for dotted.

  • buffer_size (int, optional) – Number of trajectory segments to display. Old segments will be replaced by new ones.

on_tick(sim)

Main function called by the simulation at each control cycle.

Parameters

sim (Simulation) – Current simulation instance.