Ejemplo n.º 1
0
def get_environment():
    locate_resource_fn = SimpleResourceLocatorFn(_locate_resource)
    locator = SimpleResourceLocator(locate_resource_fn)
    env = Environment()
    tesseract_support = os.environ["TESSERACT_SUPPORT_DIR"]
    urdf_path = FilesystemPath(
        os.path.join(tesseract_support, "urdf/lbr_iiwa_14_r820.urdf"))
    srdf_path = FilesystemPath(
        os.path.join(tesseract_support, "urdf/lbr_iiwa_14_r820.srdf"))
    assert env.init(urdf_path, srdf_path, locator)
    manip_info = ManipulatorInfo()
    manip_info.manipulator = "manipulator"

    return env, manip_info
Ejemplo n.º 2
0
def get_environment():
    locate_resource_fn = SimpleResourceLocatorFn(_locate_resource)
    locator = SimpleResourceLocator(locate_resource_fn)
    env = Environment()
    tesseract_support = os.environ["TESSERACT_SUPPORT_DIR"]
    urdf_path = FilesystemPath(
        os.path.join(tesseract_support, "urdf/lbr_iiwa_14_r820.urdf"))
    srdf_path = FilesystemPath(
        os.path.join(tesseract_support, "urdf/lbr_iiwa_14_r820.srdf"))
    assert env.init(urdf_path, srdf_path, locator)
    manip_info = ManipulatorInfo()
    manip_info.manipulator = "manipulator"
    joint_names = env.getManipulatorManager().getFwdKinematicSolver(
        "manipulator").getJointNames()

    return env, manip_info, joint_names
Ejemplo n.º 3
0
                            os.path.normpath(url_match.group(1)))
    except:
        traceback.print_exc()


abb_irb2400_urdf_fname = FilesystemPath(
    os.path.join(TESSERACT_SUPPORT_DIR, "urdf", "abb_irb2400.urdf"))
abb_irb2400_srdf_fname = FilesystemPath(
    os.path.join(TESSERACT_SUPPORT_DIR, "urdf", "abb_irb2400.srdf"))

t_env = Environment()

# locator_fn must be kept alive by maintaining a reference
locator_fn = SimpleResourceLocatorFn(_locate_resource)
t_env.init(abb_irb2400_urdf_fname, abb_irb2400_srdf_fname,
           SimpleResourceLocator(locator_fn))

manip_info = ManipulatorInfo()
manip_info.manipulator = "manipulator"

viewer = TesseractViewer()

viewer.update_environment(t_env, [0, 0, 0])

joint_names = ["joint_%d" % (i + 1) for i in range(6)]
viewer.update_joint_positions(joint_names, np.array([1, -.2, .01, .3, -.5, 1]))

viewer.start_serve_background()

t_env.setState(joint_names, np.ones(6) * 0.1)
def _locate_resource(url):
    try:
        url_match = re.match(r"^package:\/\/tesseract_support\/(.*)$",url)
        if (url_match is None):
            return ""    
        if not "TESSERACT_SUPPORT_DIR" in os.environ:
            return ""
        tesseract_support = os.environ["TESSERACT_SUPPORT_DIR"]
        return os.path.join(tesseract_support, os.path.normpath(url_match.group(1)))
    except:
        traceback.print_exc()

t_env = Environment()

# locator_fn must be kept alive by maintaining a reference
locator_fn = SimpleResourceLocatorFn(_locate_resource)
t_env.init(shapes_urdf, SimpleResourceLocator(locator_fn))

viewer = TesseractViewer()

viewer.update_environment(t_env, [0,0,0])

viewer.start_serve_background()

if sys.version_info[0] < 3:
    raw_input("press enter")
else:
    input("press enter")

def GazeboModelResourceLocator():
    locator_fn = SimpleResourceLocatorFn(GazeboModelResourceLocatorFn())
    locator = SimpleResourceLocator(locator_fn)
    locator_fn.__disown__()
    return locator