Minor fixes and geom module documentation
This commit is contained in:
@@ -34,9 +34,6 @@ def test_world_modify():
|
||||
color=[0.8, 0.0, 0.0, 1.0],
|
||||
)
|
||||
|
||||
# describe a mesh obstacle
|
||||
# import a mesh file:
|
||||
|
||||
mesh_file = join_path(get_assets_path(), "scene/nvblox/srl_ur10_bins.obj")
|
||||
|
||||
obstacle_2 = Mesh(
|
||||
@@ -170,3 +167,70 @@ def test_batch_collision():
|
||||
)
|
||||
|
||||
assert d[0] == 0.2 and d[1] == 0.0
|
||||
|
||||
|
||||
def test_world_modify_cpu():
|
||||
tensor_args = TensorDeviceType()
|
||||
obstacle_1 = Cuboid(
|
||||
name="cube_1",
|
||||
pose=[0.0, 0.0, 0.0, 0.043, -0.471, 0.284, 0.834],
|
||||
dims=[0.2, 1.0, 0.2],
|
||||
color=[0.8, 0.0, 0.0, 1.0],
|
||||
)
|
||||
|
||||
mesh_file = join_path(get_assets_path(), "scene/nvblox/srl_ur10_bins.obj")
|
||||
|
||||
obstacle_2 = Mesh(
|
||||
name="mesh_1",
|
||||
pose=[0.0, 2, 0.5, 0.043, -0.471, 0.284, 0.834],
|
||||
file_path=mesh_file,
|
||||
scale=[0.5, 0.5, 0.5],
|
||||
)
|
||||
|
||||
obstacle_3 = Capsule(
|
||||
name="capsule",
|
||||
radius=0.2,
|
||||
base=[0, 0, 0],
|
||||
tip=[0, 0, 0.5],
|
||||
pose=[0.0, 5, 0.0, 0.043, -0.471, 0.284, 0.834],
|
||||
# pose=[0.0, 5, 0.0, 1,0,0,0],
|
||||
color=[0, 1.0, 0, 1.0],
|
||||
)
|
||||
|
||||
obstacle_4 = Cylinder(
|
||||
name="cylinder_1",
|
||||
radius=0.2,
|
||||
height=0.5,
|
||||
pose=[0.0, 6, 0.0, 0.043, -0.471, 0.284, 0.834],
|
||||
color=[0, 1.0, 0, 1.0],
|
||||
)
|
||||
|
||||
obstacle_5 = Sphere(
|
||||
name="sphere_1",
|
||||
radius=0.2,
|
||||
pose=[0.0, 7, 0.0, 0.043, -0.471, 0.284, 0.834],
|
||||
color=[0, 1.0, 0, 1.0],
|
||||
)
|
||||
|
||||
world_model = WorldConfig(
|
||||
mesh=[obstacle_2],
|
||||
cuboid=[obstacle_1],
|
||||
capsule=[obstacle_3],
|
||||
cylinder=[obstacle_4],
|
||||
sphere=[obstacle_5],
|
||||
)
|
||||
world_model.randomize_color(r=[0.2, 0.7], g=[0.4, 0.8], b=[0.0, 0.4])
|
||||
|
||||
collision_support_world = WorldConfig.create_collision_support_world(world_model)
|
||||
|
||||
world_collision_config = WorldCollisionConfig(tensor_args, world_model=collision_support_world)
|
||||
world_ccheck = WorldMeshCollision(world_collision_config)
|
||||
|
||||
world_ccheck.enable_obstacle("sphere_1", False)
|
||||
|
||||
w_pose = Pose.from_list([0, 0, 1, 1, 0, 0, 0], tensor_args)
|
||||
world_ccheck.update_obstacle_pose(
|
||||
name="cylinder_1", w_obj_pose=w_pose, update_cpu_reference=True
|
||||
)
|
||||
|
||||
assert world_ccheck.world_model.get_obstacle("cylinder_1").pose[2] == 1
|
||||
|
||||
Reference in New Issue
Block a user