Esempio n. 1
0
void initnative() 
{
	corners.erase();

	the_corners.set_max_size(16);
	the_corner_scores.set_max_size(16);
	the_max_corners.set_max_size(16);
	the_max_corner_descriptors.set_max_size(16);
	
	drone_xy_lookup = Image<TooN::Vector<2, float> >(ImageRef(WIDTH, HEIGHT));

	std::ifstream is;
	is.open("dronecamparameters.txt");
	drone_camera_model.load(is);
	is.close();
	
	//TooN::Vector<6> cam_params = drone_camera_model.get_parameters();
	//printf("cam params: %f %f %f %f %f %f\n", cam_params[0], cam_params[1], cam_params[2], cam_params[3], cam_params[4], cam_params[5]);
	generate_xy_lookup(drone_camera_model, drone_xy_lookup);

	client_socket.create(serverip, serverport);
	
	log_file = fopen("udp_logX.csv", "wb");
	if(log_file==NULL)
	{
		printf("File 2 open failed\n");
	}
	fprintf(log_file,"Time,X (m),Y (m),Z (m),Yaw (rad)\n");
	
	/*log_file2 = fopen("udp_log2.csv", "wb");
	if(log_file2==NULL)
	{
		printf("File 3 open failed\n");
	}
	fprintf(log_file2,"Time,Corners\n");*/
	
	//init front camera
	while(video_init((char*) "/dev/video1", WIDTH, HEIGHT, 30))
	{
		printf("Camera initialisation failed. Retry in 2 seconds...\n");
		sleep(2);
	}
	printf("video_init completed\n");
	
	sleep(2);
	
	int rc = pthread_create(&native_thread, NULL, native_thread_main, NULL);
	if (rc)
		printf("ctl_Init: Return code from pthread_create(native_thread) is %d\n", rc);
	
	last_good_location.x = 0.0;	
	last_good_location.y = 0.0;
	last_good_location.z = 0.0;
	last_good_location.yaw = 0.0;
	
	printf("native_init completed\n");
}
Esempio n. 2
0
int main(int argc, char* argv[])
{
	ClientSocket client;
	bool succ; 
	if(argc > 1)
		succ = client.create(argv[1], 27016, NULL);
	else
		succ = client.create("127.0.0.1", 27016, NULL);
	if(!succ)
		printf("connent failed");

	int i = 0;
	while(true)
	{
		std::stringstream ss;
		ss << client.get_id() << "|" << i++ ;
		client.send(ss.str().c_str());
		Sleep(100);
	}
}