@@ -432,6 +432,18 @@ extended_object_detection::ComplexObject ros_msg_from_complex(ExtendedObjectInfo
432432 else
433433 current_object.transform .translation = getUnitTranslation (complex ->getCenter ());
434434
435+ // if (complex->rvec.size() > 0 ){
436+ // double quaternion[4];
437+ // Mat rotMat;
438+ // Rodrigues(complex->rvec, rotMat);
439+ // getQuaternion( rotMat, quaternion);
440+ // current_object.transform.rotation.x = quaternion[0];
441+ // current_object.transform.rotation.y = quaternion[1];
442+ // current_object.transform.rotation.z = quaternion[2];
443+ // current_object.transform.rotation.w = quaternion[3];
444+ // }
445+ current_object.transform .rotation .w = 1 ;
446+
435447 if ( inner_simples.size () > 0 ){
436448 for ( size_t i = 0 ; i < inner_simples.size (); i++ ){
437449 current_object.objects .push_back (ros_msg_from_extended (&(inner_simples.at (i))));
@@ -767,7 +779,7 @@ void video_process_cb(const ros::TimerEvent&){
767779 array_objects.objects .push_back (current_object);
768780 }
769781 }
770- #ifdef IGRAPH
782+ #ifdef USE_IGRAPH
771783 // COMPLEX OBJECTS
772784 extended_object_detection::ComplexObjectArray array_co_msg;
773785 for ( size_t i = 0 ; i < selected_to_detect_complex_objects.size (); i++){
@@ -798,9 +810,23 @@ void video_process_cb(const ros::TimerEvent&){
798810 vector<ExtendedObjectInfo> DetectedComplexObjects;
799811
800812 DetectedComplexObjects = selected_to_detect_complex_objects.at (i)->Identify (last_image, last_depth, seq);
813+ vector<ExtendedObjectInfo> DetectedObjects;
814+
815+ for (size_t j = 0 ; j < DetectedComplexObjects.size (); j++){
816+ extended_object_detection::ComplexObject co_msg;
817+
818+ co_msg = ros_msg_from_complex (&DetectedComplexObjects[j], DetectedObjects);
819+
820+ co_msg.type_id = selected_to_detect_complex_objects[i]->ID ;
821+ co_msg.type_name = selected_to_detect_complex_objects[i]->name ;
822+
823+ array_co_msg.complex_objects .push_back (co_msg);
824+ }
801825
802826 if ( screenOutputFlag || publishImage)
803827 selected_to_detect_complex_objects.at (i)->drawAll (image2draw, Scalar (255 , 255 , 0 ), 2 );
828+
829+
804830 }
805831#endif
806832 seq++;
@@ -821,7 +847,7 @@ void video_process_cb(const ros::TimerEvent&){
821847 }
822848 array_objects.objects .clear ();
823849 }
824- #ifdef IGRAPH
850+ #ifdef USE_IGRAPH
825851 if ( array_co_msg.complex_objects .size () > 0 ){
826852 array_co_msg.header .stamp = ros::Time::now ();
827853 array_co_msg.header .frame_id = image_frame_id;
0 commit comments