18 #ifndef FAKE_OBJECT_RECOGNITION_H 19 #define FAKE_OBJECT_RECOGNITION_H 22 #include <sensor_msgs/Image.h> 24 #include <asr_fake_object_recognition/GetRecognizer.h> 25 #include <asr_fake_object_recognition/ReleaseRecognizer.h> 26 #include <asr_fake_object_recognition/GetAllRecognizers.h> 27 #include <asr_fake_object_recognition/ClearAllRecognizers.h> 30 #include <asr_msgs/AsrObject.h> 31 #include <visualization_msgs/Marker.h> 32 #include <dynamic_reconfigure/server.h> 33 #include <asr_fake_object_recognition/FakeObjectRecognitionConfig.h> 35 #include <std_msgs/ColorRGBA.h> 36 #include <geometry_msgs/Point.h> 38 #include <Eigen/Geometry> 40 #include <visualization_msgs/MarkerArray.h> 47 const static std::string
NODE_NAME(
"asr_fake_object_recognition");
146 std::map<std::string, std::vector<geometry_msgs::Point>>
normals_;
174 bool parsePoseString(std::string pose_in, geometry_msgs::Pose &pose_out, std::string delim, std::string
angles);
182 bool processGetRecognizerRequest(GetRecognizer::Request &req, GetRecognizer::Response &res);
190 bool processReleaseRecognizerRequest(ReleaseRecognizer::Request &req, ReleaseRecognizer::Response &res);
198 bool processGetAllRecognizersRequest(GetAllRecognizers::Request &req, GetAllRecognizers::Response &res);
206 bool processClearAllRecognizers(ClearAllRecognizers::Request &req, ClearAllRecognizers::Response &res);
222 void configCallback(FakeObjectRecognitionConfig &config, uint32_t level);
227 void doRecognition();
236 bool objectIsVisible(
const geometry_msgs::Pose &pose_left,
const geometry_msgs::Pose &pose_right);
249 bool objectIsVisible(
const std::array<geometry_msgs::Point, 8> &bb_left,
const std::array<geometry_msgs::Point, 8> &bb_right,
const geometry_msgs::Pose &pose_left,
const geometry_msgs::Pose &pose_right,
250 const std::vector<geometry_msgs::Point> &normals_left,
const std::vector<geometry_msgs::Point> &normals_right);
260 geometry_msgs::Pose transformFrame(
const geometry_msgs::Pose &pose,
const std::string &frame_from,
const std::string &frame_to);
270 asr_msgs::AsrObjectPtr createAsrMessage(
const ObjectConfig &object_config,
const geometry_msgs::Pose &pose,
const std::string &frame_id);
281 visualization_msgs::Marker createMarker(
const asr_msgs::AsrObjectPtr &
object,
int id,
int lifetime,
bool use_col_init =
false);
289 static std_msgs::ColorRGBA getMeshColor(std::string observed_id);
300 static std_msgs::ColorRGBA createColorRGBA(
float red,
float green,
float blue,
float alpha);
309 std::vector<geometry_msgs::Point> transformPoints(std::vector<geometry_msgs::Point> points_list, Eigen::Quaterniond rotation, Eigen::Vector3d translation);
318 std::array<geometry_msgs::Point, 8> transformPoints(std::array<geometry_msgs::Point, 8> points_list, Eigen::Quaterniond rotation, Eigen::Vector3d translation);
327 visualization_msgs::MarkerArray::Ptr createNormalMarker(
const ObjectConfig &
object,
int id,
int lifetime);
334 std::vector<geometry_msgs::Point> getNormals(
const ObjectConfig &
object);
342 bool getBBfromFile(std::array<geometry_msgs::Point, 8> &result, std::string object_type);
349 std::array<geometry_msgs::Point, 8> calculateBB(
const ObjectConfig &
object);
358 geometry_msgs::Point createPoint(
double x,
double y,
double z);
double rating_threshold_x_
static const std::string GET_ALL_RECOGNIZERS_SERVICE_NAME("get_all_recognizers")
This class is used to simulate typical errors of an object recognition system.
std::string output_normals_topic_
ros::ServiceServer clear_all_recognizers_service_
std::string config_file_path_
FakeObjectRecognitionConfig config_
ros::ServiceServer release_recognizer_service_
bool recognition_released_
std::string object_database_name_
ros::ServiceServer get_recognizer_service_
std::map< std::string, std::vector< geometry_msgs::Point > > normals_
std::string bb_corners_file_name_
std::vector< std::string > objects_to_rec_
std::map< std::string, std::array< geometry_msgs::Point, 8 > > bounding_box_corners_
static const std::string CLEAR_ALL_RECOGNIZERS_SERVICE_NAME("clear_all_recognizers")
double rating_threshold_d_
std::string frame_camera_left_
std::vector< ObjectConfig > objects_
static const std::string RELEASE_RECOGNIZER_SERVICE_NAME("release_recognizer")
ros::Publisher object_normals_pub_
ros::Publisher generated_constellation_marker_pub_
std::string output_rec_objects_topic_
std::string output_rec_markers_topic_
dynamic_reconfigure::Server< FakeObjectRecognitionConfig > reconfigure_server_
static const std::string GET_RECOGNIZER_SERVICE_NAME("get_recognizer")
This class is used to save information about an available object.
double rating_threshold_y_
std::string frame_camera_right_
ros::ServiceClient object_metadata_service_client_
static const std::string NODE_NAME("asr_fake_object_recognition")
std::string output_constellation_marker_topic_
ros::Publisher recognized_objects_pub_
The central class of the recognition system used for managing the ros subscriptions, configuration changes, loading of the objects, the recognition itself and the visualisation of the results.
tf::TransformListener listener_
ros::ServiceServer get_all_recognizers_service_
ros::Publisher recognized_objects_marker_pub_