Beispiel #1
0
void rc_features::changeCallback(const std_msgs::StringConstPtr msg) {

	if (strcmp(msg->data.c_str(), "imes") == 0) {
		changeReference(1);
	}
	else {
		if (strcmp(msg->data.c_str(), "tq") == 0) {
			changeReference(2);
			} else {
				ROS_WARN("The User requested an invalid object");
			}
	}
}
Beispiel #2
0
int main(){
  int x = 0;
  int y = 1;

  int& r = x; // r = &x;
  r = y; // *r = y;

  int *p2 = &x;
  p2 = &y;

  point p;

  point *ptp = &p;
  ptp->x = 1; // (*ptp).x = 1;
  ptp->y = 2;

  point& rp = p;
  rp.x = 1;
  rp.y = 2;

  changePointer(p2);
  std::cout << "x: " << x << "\n";
  changeReference(x);
  std::cout << "x: " << x << "\n";

  return 0;
}
Beispiel #3
0
bool rc_features::Service(imes_vision::FeatureDetectorReference::Request &req,
											imes_vision::FeatureDetectorReference::Response &res) {

    if (req.refNum !=1 && req.refNum !=2) {
        ROS_WARN("Client asked for invalid object!");
        res.response = 0;
    } else {
        ROS_INFO("Client changed reference to %d", (int)req.refNum);
        changeReference(req.refNum);
        res.response = -1;
    }

	return true;
}
Beispiel #4
0
rc_features::rc_features(std::string cameraTopic, bool showCVwindows) : it(nh), my_feature_matcher() {


	/* Say hello */
	ROS_INFO("Object Finder initializing");
	ROS_INFO("looking for picture stream from webcam..");


	// Objects
	// getting path of product files:
	std::string fPath, tmp;
	fPath= ros::package::getPath("imes_vision");
	tmp= fPath;

	// initialize some Objects:
	if (true) {
		tmp= fPath;
		tmp.append("/resources/FeatureDetector/IMES-logo");
		imes_logo.featurePath = tmp;
		imes_logo.numOfPics = 4;
		tmp= fPath;
		tmp.append("");
		imes_logo.shapePath = tmp;
		imes_logo.shapeHeight = 235;
		imes_logo.shapeWidth = 60;

		tmp= fPath;
		tmp.append("/resources/FeatureDetector/TQ-logo");
		tq_logo.featurePath = tmp;
		tq_logo.numOfPics = 4;
		tmp= fPath;
		tmp.append("");
		tq_logo.shapePath = tmp;
		tq_logo.shapeHeight = 235;
		tq_logo.shapeWidth = 60;
	}

	// Default object to find
	tstObj= tq_logo;
	minFeatures = 5;
	match = false;

	roscv_outImage.header.seq = 0;

	if (showCVwindows == true) {
		ROS_INFO("ObjectFinder will show image-windows.");
		this->showWindows = true;
		my_feature_matcher.showWindows = true;
		cv::namedWindow("Cam_Stream", CV_WINDOW_AUTOSIZE);
		cv::startWindowThread();
	} else {
		ROS_WARN("ObjectFinder will not show any image-windows!");
		this->showWindows=false;
		my_feature_matcher.showWindows=false;
	}

	/* Registering callback and service */
	this->image_sub = it.subscribe(cameraTopic,   1, &rc_features::imageCallback, this);
	this->change_sub = nh.subscribe("/change_referece", 1, &rc_features::changeCallback, this);
	this->image_pub = it.advertise("/imes_vision/image_detect", 1);
	this->rev_service = nh.advertiseService("/imes_vision/change_reference", &rc_features::Service, this);

	/* setting feature matcher settings */
	changeReference(2);

	/* INIT DONE */
	ROS_INFO("Object Finder Service started!");
}