Skip to content

Commit

Permalink
added new object to recognition test to see if objects perpendicular to
Browse files Browse the repository at this point in the history
camera, which are only partially visible are recognized
  • Loading branch information
FrederikBark committed Oct 4, 2023
1 parent 8b7d67f commit 0da04f9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/api/controllers/camera_recognition/camera_recognition.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
#include "../../../lib/ts_utils.h"

#define TIME_STEP 32
#define VISIBLE_SOLID_NUMBER 6
#define VISIBLE_SOLID_NUMBER 7

// This test is mainly testing the functionalities for a planar camera.
// Some basic tests for spherical and cylindrical cameras are also performed checking mainly
// the number of visible objects and the position on camera.

// objects visible in planar camera
static const char *visible_solid_models[VISIBLE_SOLID_NUMBER] = {
"visible sphere", "visible box", "sub solid", "visible capsule", "composed solid", "visible sphere without BO"};
"visible sphere", "visible box", "sub solid", "visible capsule", "composed solid", "visible sphere without BO", "perpendicular box"};

static const char *occcluded_solid_model = "occluded box";

Expand Down Expand Up @@ -45,12 +45,14 @@ int main(int argc, char **argv) {
VISIBLE_SOLID_NUMBER + 1, object_number);

object_number = wb_camera_recognition_get_number_of_objects(camera_spherical);
ts_assert_int_equal(object_number, 10, "The spherical camera should initially see %d objects and not %d (with occlusion).", 9,
object_number);
ts_assert_int_equal(object_number, VISIBLE_SOLID_NUMBER + 4,
"The spherical camera should initially see %d objects and not %d (with occlusion).", VISIBLE_SOLID_NUMBER + 4,
object_number);

object_number = wb_camera_recognition_get_number_of_objects(camera_cylindrical);
ts_assert_int_equal(object_number, 8, "The cylindrical camera should initially see %d objects and not %d (with occlusion).",
7, object_number);
ts_assert_int_equal(object_number, VISIBLE_SOLID_NUMBER + 2,
"The cylindrical camera should initially see %d objects and not %d (with occlusion).",
VISIBLE_SOLID_NUMBER + 2, object_number);

// enable occlusion
WbNodeRef recognition_node = wb_supervisor_node_get_from_def("RECOGNITION");
Expand Down
22 changes: 22 additions & 0 deletions tests/api/worlds/camera_recognition.wbt
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,28 @@ Solid {
0 0 1
]
}
Solid {
translation -1.0 1.6 -2.25
rotation 0.599079 0.531234 0.599078 -2.82327
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.756863 0.207843 0.207843
}
}
geometry DEF BOX Box {
size 0.9 1.9 0.1
}
}
]
name "solid(10)"
model "perpendicular box"
boundingObject USE BOX
recognitionColors [
0.756863 0.207843 0.207843
]
}
Robot {
translation -0.116489 0.196931 -0.132093
rotation 0.6457879227325559 0.5398879322844559 0.5398879322844559 1.36968
Expand Down

0 comments on commit 0da04f9

Please sign in to comment.