コード例 #1
0
ファイル: draw.py プロジェクト: vsamy/pymanoid
def 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 : openravepy.GraphHandle
        OpenRAVE graphical handle. Must be stored in some variable, otherwise
        the drawn object will vanish instantly.
    """
    if type(color) is str:
        color = matplotlib_to_rgb(color)
    env = get_openrave_env()
    return env.drawarrow(origin, end, linewidth=linewidth, color=color)
コード例 #2
0
ファイル: draw.py プロジェクト: vsamy/pymanoid
def draw_line(start_point, end_point, color='g', linewidth=1.):
    """
    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 : openravepy.GraphHandle
        OpenRAVE graphical handle. Must be stored in some variable, otherwise
        the drawn object will vanish instantly.
    """
    if type(color) is str:
        color = matplotlib_to_rgb(color)
    return get_openrave_env().drawlinelist(
        array([start_point, end_point]), linewidth=linewidth, colors=color)
コード例 #3
0
ファイル: drawers.py プロジェクト: vsamy/pymanoid
 def __init__(self, contact_set=None, z=0., color=None):
     if color is None:
         color = (0., 0.5, 0., 0.5)
     if type(color) is str:
         color = matplotlib_to_rgb(color) + [0.5]
     super(SupportAreaDrawer, self).__init__()
     self.color = color
     self.contact_poses = {}
     self.contact_set = contact_set
     self.handle = None
     self.z = z
     if contact_set is not None:
         self.update_contact_poses()
         self.update_polygon()
コード例 #4
0
ファイル: robot.py プロジェクト: vsamy/pymanoid
    def set_color(self, color):
        """
        Set the color of the robot.

        Parameters
        ----------
        color : tuple or string
            RGB tuple, or color code in `matplotlib convention
            <http://matplotlib.org/api/colors_api.html>`_.
        """
        if type(color) is str:
            color = matplotlib_to_rgb(color)
        for link in self.rave.GetLinks():
            for geom in link.GetGeometries():
                geom.SetAmbientColor(color)
                geom.SetDiffuseColor(color)