basic_robotics.plotting.vis_matplotlib module

Utility Plotting Functions for Basic-Robotics using matplotlib.

basic_robotics.plotting.vis_matplotlib.drawManipulability(jacobian_matrix: ndarray[float], transform: tm, len_factor: float, ax: Axes3D) → None[source]

Draw Manipulability Ellipsoid based on a Jacobian Matrix.

Parameters:
  • jacobian_matrix (np.ndarray[float]) – jacobian matrix

  • transform (tm) – position to draw ellipsoid at

  • len_factor (float) – scaling

  • ax (Axes3D) – axes object to draw on

basic_robotics.plotting.vis_matplotlib.drawSTL(transform: tm, file_name: str, ax: Axes3D, scale: float = 1.0)[source]

Draw an STL file at a set scale.

Parameters:
  • transform (tm) – transform to draw at

  • file_name (str) – filename of the stl

  • ax (Axes3D) – Axis to draw on

  • scale (float, optional) – scaling factor to apply. Defaults to 1.0.

basic_robotics.plotting.vis_matplotlib.getSTLProps(fname: str)[source]

Get Mass properties of a Mesh.

Parameters:

fname (str) – file name

Returns:

Mass Props – Mesh Mass Properties

basic_robotics.plotting.vis_matplotlib.drawArm(arm, ax: Axes3D, jheight: float = 0.1, jdia: float = 0.3, axes_lens: float = 1.0, c: str = 'grey', forces: ndarray[float] = array([0.]))[source]

Draw A Serial Arm.

Parameters:
  • arm (Arm) – Serial Arm To Draw

  • ax (Axes3D) – Axes object to plot to.

  • jrad (float, optional) – joint circle height. Defaults to .1.

  • jdia (float, optional) – joint circle diameter. Defaults to .3.

  • axes_lens (float, optional) – joint axis marker lengths. Defaults to 1.0.

  • c (str, optional) – _description_. Defaults to ‘grey’.

  • forces (np.ndarray[float], optional) – arm joint torques. Defaults to np.zeros((1)).

basic_robotics.plotting.vis_matplotlib.drawLine(tf1: tm, tf2: tm, ax: Axes3D, col: str = 'blue')[source]

Draw a line Between Two Points.

Parameters:
  • tf1 (tm) – Point 1

  • tf2 (tm) – Point 2

  • ax (Axes3D) – Axes object to plot to.

  • col (str, optional) – color. Defaults to ‘blue’.

basic_robotics.plotting.vis_matplotlib.drawSP(sp, ax: Axes3D, col: str = 'green', forces: bool = False)[source]

Draw A Stewart Platform.

Parameters:
  • sp (SP) – SP model to draw.

  • ax (Axes3D) – Axes object to plot to.

  • col (str, optional) – color. Defaults to ‘green’.

  • forces (bool, optional) – whether or not to indicate leg forces. Defaults to True.

basic_robotics.plotting.vis_matplotlib.drawInterPlate(sp1, sp2, ax: Axes3D, col: str = 'green')[source]

Draw interplate medium between two stacked stewart platforms.

Congratulations! You found an Easter Egg. ASSEMBLERS aren’t included in Basic-Robotics yet.

Parameters:
  • sp1 (SP) – SP 1

  • sp2 (SP) – SP 2

  • ax (Axes3D) – Axes object to plot to.

  • col (str, optional) – color. Defaults to ‘green’.

basic_robotics.plotting.vis_matplotlib.drawAssembler(spl, ax: Axes3D, col: str = 'green', forces: bool = True)[source]

Draw an Assembler.

Congratulations! You found an Easter Egg. ASSEMBLERS aren’t included in Basic-Robotics yet.

Parameters:
  • spl (List[SP]) – List of SP objects

  • ax (Axes3D) – Axes object to plot to.

  • col (str, optional) – color . Defaults to ‘green’.

  • forces (bool, optional) – whether to indicate leg forces. Defaults to True.

basic_robotics.plotting.vis_matplotlib.drawCamera(cam, size: float, ax: Axes3D)[source]

Draw a Camera.

Parameters:
  • cam (Camera) – virtual camera

  • size (float) – camera screen size

  • ax (Axes3D) – Axes object to plot to.

basic_robotics.plotting.vis_matplotlib.drawAxes(zed: tm, lv: float, ax: Axes3D, makelegend: str = None, zdir: tm = None)[source]

Draw a set of Axes in a frame.

Red indicates X Blue indicates Y Green indicates Z

Parameters:
  • zed (tm) – transform to draw

  • lv (float) – axes length scalar

  • ax (Axes3D) – Axes object to plot to.

  • makelegend (str, optional) – text to display

  • zdir (tm, optional) – offset from zdir to draw text

basic_robotics.plotting.vis_matplotlib.drawTrussElement(transform: tm, truss_length: float, truss_radius: float, ax: Axes3D, c: str = 'blue', c2: str = 'blue', hf: bool = False, delt: float = 0.5, RB: float = 0.1)[source]

Draw a Three Segment Truss.

Parameters:
  • transform (tm) – Truss Center and Orientation transform

  • truss_length (float) – Length of Truss

  • truss_radius (float) – Truss Radius

  • ax (Axes3D) – Axes object to plot to.

  • c (str, optional) – Truss Tower Color. Defaults to ‘blue’.

  • c2 (str, optional) – Truss Crosses Color. Defaults to ‘blue’.

  • hf (bool, optional) – Draw truss crosses. Defaults to False.

  • delt (float, optional) – Distance for truss crossees. Defaults to .5.

  • RB (float, optional) – Truss Crosses Radius. Defaults to .1.

basic_robotics.plotting.vis_matplotlib.drawRectangle(transform: ~basic_robotics.general.faser_transform.tm, dims: [<class 'float'>], ax: ~mpl_toolkits.mplot3d.axes3d.Axes3D, c: str = 'grey', a: float = 0.1)[source]

Draw a Rectanglular Prism.

Parameters:
  • transform (tm) – prism origin.

  • dims (List[float]) – rectangle dimensions

  • ax (Axes3D) – Axes object to plot to.

  • c (str, optional) – color. Defaults to ‘grey’.

  • a (float, optional) – transparency. Defaults to 0.1.

basic_robotics.plotting.vis_matplotlib.makeVideo(dir: str = 'VideoTemp')[source]

Make a video from a directory full of images.

Parameters:

dir (str, optional) – Directory. Defaults to “VideoTemp”.

basic_robotics.plotting.vis_matplotlib.drawRRT(listPoints, ax: Axes3D)[source]

Draw A RRT.

Parameters:
  • listPoints (RRT Nodes List) – RRT Nodes List

  • ax (Axes3D) – Axes object to plot to.

basic_robotics.plotting.vis_matplotlib.drawRRTPath(listPoints, ax: Axes3D, col: str = 'red')[source]

Draw a RRT path do destination.

Parameters:
  • listPoints (List of RRT Nodes) – List of RRT Nodes

  • ax (Axes3D) – Axes object to plot to.

  • col (str, optional) – color. Defaults to ‘red’.

basic_robotics.plotting.vis_matplotlib.drawObstructions(listObs, ax: Axes3D, col: str = 'red', a: float = 0.1)[source]

Draw RRT Obstructions.

Parameters:
  • listObs (List[Obstructions]) – List of RRT Obstructions

  • ax (Axes3D) – Axes object to plot to.

  • col (str, optional) – color. Defaults to ‘red’.

  • a (float, optional) – transparency. Defaults to .1.

basic_robotics.plotting.vis_matplotlib.drawMesh(mesh: Mesh, ax: Axes3D)[source]

Draw a Mesh.

Parameters:
  • mesh (mesh.Mesh) – Mesh To Draw

  • ax (Axes3D) – Axes object to plot to.

basic_robotics.plotting.vis_matplotlib.drawWrench(wrench, weight: float, ax: Axes3D)[source]

Draw a Wrench.

Parameters:
  • wrench (Wrench) – wrench to draw

  • weight (float) – length of wrench vector arrow

  • ax (Axes3D) – Axes object to plot to.

basic_robotics.plotting.vis_matplotlib.drawTube(T: tm, height: float, r: float, ax: Axes3D, c: str = 'blue', res: int = 12)[source]

Draw a Tube.

Parameters:
  • T (tm) – Transform of the Tube

  • height (float) – Height of the tube

  • r (float) – Radius of the Tube

  • ax (Axes3D) – Axes object to plot to.

  • c (str, optional) – color. Defaults to ‘blue’.

  • res (int, optional) – resolution of the tube. Defaults to 12.

basic_robotics.plotting.vis_matplotlib.DrawManipulability(jacobian_matrix: ndarray[float], transform: tm, len_factor: float, ax: Axes3D) → None[source]

Deprecated alias for drawManipulability().

basic_robotics.plotting.vis_matplotlib.DrawSTL(transform: tm, file_name: str, ax: Axes3D, scale: float = 1.0)[source]

Deprecated alias for drawSTL().

basic_robotics.plotting.vis_matplotlib.DrawArm(arm, ax: Axes3D, jheight: float = 0.1, jdia: float = 0.3, axes_lens: float = 1.0, c: str = 'grey', forces: ndarray[float] = array([0.]))[source]

Deprecated alias for drawArm().

basic_robotics.plotting.vis_matplotlib.DrawLine(tf1: tm, tf2: tm, ax: Axes3D, col: str = 'blue')[source]

Deprecated alias for drawLine().

basic_robotics.plotting.vis_matplotlib.DrawSP(sp, ax: Axes3D, col: str = 'green', forces: bool = True)[source]

Deprecated alias for drawSP().

basic_robotics.plotting.vis_matplotlib.DrawInterPlate(sp1, sp2, ax: Axes3D, col: str = 'green')[source]

Deprecated alias for drawInterPlate().

basic_robotics.plotting.vis_matplotlib.DrawAssembler(spl, ax: Axes3D, col: str = 'green', forces: bool = True)[source]

Deprecated alias for drawAssembler().

basic_robotics.plotting.vis_matplotlib.DrawCamera(cam, size: float, ax: Axes3D)[source]

Deprecated alias for drawCamera().

basic_robotics.plotting.vis_matplotlib.DrawAxes(zed: tm, lv: float, ax: Axes3D, makelegend: str = None, zdir: tm = None)[source]

Deprecated alias for drawAxes().

basic_robotics.plotting.vis_matplotlib.DrawTrussElement(transform: tm, truss_length: float, truss_radius: float, ax: Axes3D, c: str = 'blue', c2: str = 'blue', hf: bool = False, delt: float = 0.5, RB: float = 0.1)[source]

Deprecated alias for drawTrussElement().

basic_robotics.plotting.vis_matplotlib.DrawRectangle(transform: ~basic_robotics.general.faser_transform.tm, dims: [<class 'float'>], ax: ~mpl_toolkits.mplot3d.axes3d.Axes3D, c: str = 'grey', a: float = 0.1)[source]

Deprecated alias for drawRectangle().

basic_robotics.plotting.vis_matplotlib.DrawRRT(listPoints, ax: Axes3D)[source]

Deprecated alias for drawRRT().

basic_robotics.plotting.vis_matplotlib.DrawRRTPath(listPoints, ax: Axes3D, col: str = 'red')[source]

Deprecated alias for drawRRTPath().

basic_robotics.plotting.vis_matplotlib.DrawObstructions(listObs, ax: Axes3D, col: str = 'red', a: float = 0.1)[source]

Deprecated alias for drawObstructions().

basic_robotics.plotting.vis_matplotlib.DrawWrench(wrench, weight: float, ax: Axes3D)[source]

Deprecated alias for drawWrench().

basic_robotics.plotting.vis_matplotlib.DrawTube(T: tm, height: float, r: float, ax: Axes3D, c: str = 'blue', res: int = 12)[source]

Deprecated alias for drawTube().