Skip to content

Commit eb8acdf

Browse files
Fix computation of Camera recognition object relative orientation (#6100)
* Fix computation of relative orientation * Update changelog * Adjust test
1 parent 50e74d6 commit eb8acdf

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

docs/reference/changelog-r2023.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Released on ??
6161
- Fixed generation of moment of inertia matrix based on bounding box ([#6048](https://github.com/cyberbotics/webots/pull/6048)).
6262
- Fixed the loading of remote mesh bounding objects ([#6047](https://github.com/cyberbotics/webots/pull/6047)).
6363
- Fixed crash during conversion of PROTO to base nodes in case of Mesh nodes with invalid scale values ([#6088](https://github.com/cyberbotics/webots/pull/6088)).
64+
- Fixed object's relative orientation returned by the [Recognition](recognition.md) functionality ([#6100](https://github.com/cyberbotics/webots/pull/6100)).
6465

6566
## Webots R2023a
6667
Released on November 29th, 2022.

src/webots/nodes/WbCamera.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ bool WbCamera::computeObject(const WbVector3 &cameraPosition, const WbMatrix3 &c
822822

823823
// compute object relative orientation
824824
WbRotation relativeRotation;
825-
relativeRotation.fromMatrix3(recognizedObject->object()->rotationMatrix() * cameraInverseRotation);
825+
relativeRotation.fromMatrix3(cameraInverseRotation * recognizedObject->object()->rotationMatrix());
826826
relativeRotation.normalize();
827827
recognizedObject->setRelativeOrientation(relativeRotation);
828828

tests/api/controllers/camera_recognition/camera_recognition.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ int main(int argc, char **argv) {
217217

218218
// test spherical camera
219219
const double invisible_capsule_position[3] = {0.369, 1.650, 0.899};
220-
const double invisible_capsule_orientation[4] = {-0.014153, 0.447164, -0.894340, 2.094391};
220+
const double invisible_capsule_orientation[4] = {0.577350, -0.577350, -0.577350, 2.094390};
221221
const double invisible_capsule_size[2] = {0.1, 0.1};
222222
object_number = wb_camera_recognition_get_number_of_objects(camera_spherical);
223223
ts_assert_int_equal(object_number, 4,
@@ -235,7 +235,7 @@ int main(int argc, char **argv) {
235235
objects[i].position[0], objects[i].position[1], objects[i].position[2], expected_position[0], expected_position[1],
236236
expected_position[2]);
237237
// orientation
238-
double expected_orientation[4] = {-0.014153, 0.447166, -0.894339, 2.094390};
238+
double expected_orientation[4] = {0.577350, -0.577350, -0.577350, 2.094390};
239239
ts_assert_doubles_in_delta(
240240
4, objects[i].orientation, expected_orientation, 0.001,
241241
"Orientation of 'occluded box' is not correct for spherical camera: found=(%f, %f, %f, %f), expected=(%f, %f, %f, %f).",

0 commit comments

Comments
 (0)