The function initially renders the object pose (location and rotation) according to the provided input, but after a few images, the object returns to its default state, lying flat on the surface.
Minimal code example
# Define a function that samples 6-DoF poses
def sample_pose_func(obj: bproc.types.MeshObject):
# min = np.random.uniform([-0.2, -0.2, 0], [-0.1, -0.1, 0])
# max = np.random.uniform([0.1, 0.1, 0.4], [0.2, 0.2, 0.5])
#obj.set_location(np.random.uniform(min, max))
min_position = [0, 0, 0] # Example minimum position
max_position = [0.1, 0.1, 0.1] # Example maximum position
position = np.random.uniform(min_position, max_position)
obj.set_location(position)
min_pitch, max_pitch = np.radians(-45), np.radians(45) # Pitch range
min_roll, max_roll = np.radians(-90), np.radians(90) # Roll range
min_yaw, max_yaw = np.radians(-180), np.radians(180) # Yaw range
# Sample Euler angles within defined ranges
pitch = np.random.uniform(min_pitch, max_pitch)
roll = np.random.uniform(min_roll, max_roll)
yaw = np.random.uniform(min_yaw, max_yaw)
obj.set_rotation_euler([1.57, 1.57, 1.57])
#rotation = bproc.sampler.uniformSO3()
for obj in (sampled_target_bop_objs):
obj.enable_rigidbody(active=True)
# The ground should only act as an obstacle and is therefore marked passive.
# To let the object fall into the valleys of the ground, make the collision shape MESH instead of CONVEX_HULL.
plane.enable_rigidbody(active=False, collision_shape="MESH")
# Physics Positioning
bproc.object.simulate_physics(min_simulation_time=3,
max_simulation_time=20,
check_object_interval=1,
substeps_per_frame = 20,
solver_iters=40)
Describe the issue
The function initially renders the object pose (location and rotation) according to the provided input, but after a few images, the object returns to its default state, lying flat on the surface.
Minimal code example
Files required to run the code
No response
Expected behavior
First few frames (pose applied)
Next frames (pose not applied)
BlenderProc version
v2.5.0