Problem
SiteObject.in_box() does not correctly account for the orientation of a site. When a container such as a basket is rotated during a rollout, an object whose center is inside the visual contain_region can still be classified as outside, causing a false-negative task success result.
The relevant code is:
https://github.com/Lifelong-Robot-Learning/LIBERO/blob/master/libero/libero/envs/objects/site_object.py#L35-L56
total_size = np.abs(this_mat @ self.size)
ub = this_position + total_size
lb = this_position - total_size
lb[2] -= 0.01
return np.all(other_position > lb) and np.all(other_position < ub)
The source already notes that this size transformation np.abs(site_rotation @ site.size) is "hacky".
As an extreme case, for a box with equal x/y half-sizes (e.g. the basket in LIBERO_OBJECT), when it is rotated by 45 degrees, one of the computed world-space half-extents becomes 0.
Expected behavior
A box site represents an oriented box. Its containment result should remain unchanged if the site and the point are transformed by the same rigid-body pose.
For a site position c, orientation R, half-size s, and world point p, the point should first be transformed into site-local coordinates:
local_position = R.T @ (p - c)
Containment can then be tested against the local half-sizes:
size = np.asarray(self.size)
local_position = np.asarray(this_mat).T @ (
np.asarray(other_position) - np.asarray(this_position)
)
lower = -size.copy()
lower[2] -= 0.01 # preserve the existing lower-z tolerance
upper = size
return np.all(local_position > lower) and np.all(local_position < upper)
This preserves the current center-point approximation and the existing 1 cm lower-bound tolerance, while making the contain region follow arbitrary basket translation and rotation, including roll and pitch.
Problem
SiteObject.in_box()does not correctly account for the orientation of a site. When a container such as a basket is rotated during a rollout, an object whose center is inside the visualcontain_regioncan still be classified as outside, causing a false-negative task success result.The relevant code is:
https://github.com/Lifelong-Robot-Learning/LIBERO/blob/master/libero/libero/envs/objects/site_object.py#L35-L56
The source already notes that this size transformation
np.abs(site_rotation @ site.size)is "hacky".As an extreme case, for a box with equal x/y half-sizes (e.g. the basket in LIBERO_OBJECT), when it is rotated by 45 degrees, one of the computed world-space half-extents becomes 0.
Expected behavior
A box site represents an oriented box. Its containment result should remain unchanged if the site and the point are transformed by the same rigid-body pose.
For a site position
c, orientationR, half-sizes, and world pointp, the point should first be transformed into site-local coordinates:Containment can then be tested against the local half-sizes:
This preserves the current center-point approximation and the existing 1 cm lower-bound tolerance, while making the contain region follow arbitrary basket translation and rotation, including roll and pitch.