How to use the math3d.Transform function in math3d

To help you get started, we’ve selected a few math3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SintefManufacturing / python-urx / urx / robot.py View on Github external
def __init__(self, host, use_rt=False):
        URRobot.__init__(self, host, use_rt)
        self.csys = m3d.Transform()
github SintefManufacturing / python-urx / urx / robot.py View on Github external
def rz_t(self, val):
        t = m3d.Transform()
        t.orient.rotate_zb(val)
        self.add_pose_tool(t)
github SintefManufacturing / python-urx / urx / robot.py View on Github external
def translate_tool(self, vect, acc=0.01, vel=0.01, wait=True, threshold=None):
        """
        move tool in tool coordinate, keeping orientation
        """
        t = m3d.Transform()
        if not isinstance(vect, m3d.Vector):
            vect = m3d.Vector(vect)
        t.pos += vect
        return self.add_pose_tool(t, acc, vel, wait=wait, threshold=threshold)
github SintefManufacturing / python-urx / urx / robot.py View on Github external
def get_pose(self, wait=False, _log=True):
        """
        get current transform from base to to tcp
        """
        pose = URRobot.getl(self, wait, _log)
        trans = self.csys.inverse * m3d.Transform(pose)
        if _log:
            self.logger.debug("Returning pose to user: %s", trans.pose_vector)
        return trans
github SintefManufacturing / python-urx / examples / spnav_control.py View on Github external
self.robot.speedl_tool(speeds, acc=0.10, min_time=2)
                else:
                    self.robot.speedl(speeds, acc=0.10, min_time=2)
                btn_event = None
                speeds = cmd.get_speeds()
                #if speeds != [0 for _ in speeds]:
                print(event)
                print("Sending", speeds)


if __name__ == '__main__':
    spnav.spnav_open()
    robot = urx.Robot("192.168.0.90")
    #robot = urx.Robot("localhost")
    robot.set_tcp((0, 0, 0.27, 0, 0, 0))
    trx = m3d.Transform()
    trx.orient.rotate_zb(pi/4)
    robot.set_csys("mycsys", trx)
    service = Service(robot)
    try:
        service.loop()
    finally:
        robot.close()
        spnav.spnav_close()
github SintefManufacturing / python-urx / urx / robot.py View on Github external
def set_pos(self, vect, acc=0.01, vel=0.01, wait=True, threshold=None):
        """
        set tool to given pos, keeping constant orientation
        """
        if not isinstance(vect, m3d.Vector):
            vect = m3d.Vector(vect)
        trans = m3d.Transform(self.get_orientation(), m3d.Vector(vect))
        return self.set_pose(trans, acc, vel, wait=wait, threshold=threshold)
github SintefManufacturing / python-urx / urx / tracker.py View on Github external
def _save_data(self):
        result = np.zeros(len(self._data), dtype=[ ('timestamp', 'float64') , ('pose', '6float64'), ('joints', '6float64') ])
        for idx, data in enumerate(self._data):
            if MATH3D:
                trf = self.inverse * math3d.Transform(data[1])
            else:
                trf = data[1]
            result[idx] = (data[0], trf.pose_vector, data[2] )
        self._queue.put(result)
github SintefManufacturing / python-urx / urx / robot.py View on Github external
def set_pose(self, trans, acc=0.01, vel=0.01, wait=True, command="movel", threshold=None):
        """
        move tcp to point and orientation defined by a transformation
        UR robots have several move commands, by default movel is used but it can be changed
        using the command argument
        """
        self.logger.debug("Setting pose to %s", trans.pose_vector)
        t = self.csys * trans
        pose = URRobot.movex(self, command, t.pose_vector, acc=acc, vel=vel, wait=wait, threshold=threshold)
        if pose is not None:
            return self.csys.inverse * m3d.Transform(pose)