def convert_urdf_link(self, urdfLink, link_parent_index): print("converting link:", urdfLink.link_name) urdf_link = dp.TinyUrdfLink() urdf_link.parent_index = link_parent_index urdf_link.link_name = urdfLink.link_name #convert inertia urdf_inertial = dp.TinyUrdfInertial() urdf_inertial.mass = urdfLink.urdf_inertial.mass urdf_inertial.inertia_xxyyzz = self.convert_vec( urdfLink.urdf_inertial.inertia_xxyyzz) urdf_inertial.origin_rpy = self.convert_vec( urdfLink.urdf_inertial.origin_rpy) urdf_inertial.origin_xyz = self.convert_vec( urdfLink.urdf_inertial.origin_xyz) urdf_link.urdf_inertial = urdf_inertial urdf_link.urdf_inertial = urdf_inertial #convert visual shapes urdf_visual_shapes = [] for v in urdfLink.urdf_visual_shapes: visual = self.convert_visual(v) urdf_visual_shapes.append(visual) urdf_link.urdf_visual_shapes = urdf_visual_shapes #convert collision shapes urdf_collision_shapes = [] for c in urdfLink.urdf_collision_shapes: col = self.convert_collision(c) urdf_collision_shapes.append(col) urdf_link.urdf_collision_shapes = urdf_collision_shapes self.urdf_links.append(urdf_link)
def create_multi_body(mass, collision_shapes, is_floating, world): urdf = pd.TinyUrdfStructures() base_link = pd.TinyUrdfLink() base_link.link_name = "plane_link" inertial = pd.TinyUrdfInertial() inertial.mass = mass inertial.inertia_xxyyzz = pd.TinyVector3(mass, mass, mass) base_link.urdf_inertial = inertial base_link.urdf_collision_shapes = collision_shapes urdf.base_links = [base_link] mb = pd.TinyMultiBody(is_floating) urdf2mb = pd.UrdfToMultiBody2() res = urdf2mb.convert2(urdf, world, mb) return mb
def create_multi_body(link_name, mass, collision_shapes, visual_shapes, is_floating, mc, world): urdf = pd.TinyUrdfStructures() base_link = pd.TinyUrdfLink() base_link.link_name = link_name inertial = pd.TinyUrdfInertial() inertial.mass = mass inertial.inertia_xxyyzz = pd.TinyVector3(mass,mass,mass) base_link.urdf_inertial = inertial base_link.urdf_collision_shapes = collision_shapes base_link.urdf_visual_shapes = visual_shapes urdf.base_links = [base_link] mb = pd.TinyMultiBody(is_floating) urdf2mb = pd.UrdfToMultiBody2() res = urdf2mb.convert2(urdf, world, mb) b2vis = meshcat_utils_dp.convert_visuals(urdf, None, vis) return mb, b2vis