Exemplo n.º 1
0
    def compressed_centroid_plane(self):
        """Get plane at middle of compressed bullet.

        Returns
        -------
        :class:`Rhino.Geometry.Plane`
        """
        return cgframe_to_rgplane(self.centroid_frame)
Exemplo n.º 2
0
    def trajectory_from_planes(self):
        """:class:`Rhino.Geometry.Plane` representations of trajectory_from frames.

        Returns
        -------
        :class:`list` of :class:`Rhino.Geometry.Plane`
        """
        return [cgframe_to_rgplane(frame) for frame in self.trajectory_from]
Exemplo n.º 3
0
    def placement_plane(self):
        """:class:`Rhino.Geometry.Plane` representation of placement frame.

        Returns
        -------
        :class:`Rhino.Geometry.Plane`
        """
        return cgframe_to_rgplane(self.placement_frame)
Exemplo n.º 4
0
    def location_plane(self):
        """:class:`Rhino.Geometry.Plane` representation of location frame.

        Returns
        -------
        :class:`Rhino.Geometry.Plane`
        """
        return cgframe_to_rgplane(self.location)
Exemplo n.º 5
0
def visualize_urscript(script):
    M = [
        [-1000, 0, 0, 0],
        [0, 1000, 0, 0],
        [0, 0, 1000, 0],
        [0, 0, 0, 1],
    ]
    rgT = matrix_to_rgtransform(M)
    cgT = Transformation.from_matrix(M)

    robot = Robot()

    viz_planes = []

    movel_matcher = re.compile(r"^\s*move([lj]).+((-?\d+\.\d+,?\s?){6}).*$")
    for line in script.splitlines():
        mo = re.search(movel_matcher, line)
        if mo:
            if mo.group(1) == "l":  # movel
                ptX, ptY, ptZ, rX, rY, rZ = mo.group(2).split(",")

                pt = Point(float(ptX), float(ptY), float(ptZ))
                pt.transform(cgT)
                frame = Frame(pt, [1, 0, 0], [0, 1, 0])

                R = Rotation.from_axis_angle_vector(
                    [float(rX), float(rY), float(rZ)], pt)
                T = matrix_to_rgtransform(R)

                plane = cgframe_to_rgplane(frame)
                plane.Transform(T)

                viz_planes.append(plane)
            else:  # movej
                joint_values = mo.group(2).split(",")
                configuration = Configuration.from_revolute_values(
                    [float(d) for d in joint_values])
                frame = robot.forward_kinematics(configuration)

                plane = cgframe_to_rgplane(frame)
                plane.Transform(rgT)

                viz_planes.append(plane)

    return viz_planes
Exemplo n.º 6
0
    def get_location_plane(self):
        from compas_rcf.rhino import cgframe_to_rgplane

        return cgframe_to_rgplane(self.location)
Exemplo n.º 7
0
 def tcp_plane(self):
     """TCP represented as a :class:`Rhino.Geometry.Plane`."""
     return cgframe_to_rgplane(self.tcp_frame)