当前位置: 首页>>代码示例>>C++>>正文


C++ Proxy::get方法代码示例

本文整理汇总了C++中Proxy::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Proxy::get方法的具体用法?C++ Proxy::get怎么用?C++ Proxy::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Proxy的用法示例。


在下文中一共展示了Proxy::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DPRINTF

// Main function of the task
int CameraServo::Main(int a2, int a3, int a4, int a5,
			int a6, int a7, int a8, int a9, int a10)
{
	Proxy *proxy;				// Handle to proxy
	Robot *lHandle;            // Local handle
	CameraServoLog sl;                   // log
#if 0
	unsigned timer = 0;					// Timer to only do certain things so often
	int largestParticleIndex = 0;
#endif
	
	// Let the world know we're in
	DPRINTF(LOG_DEBUG,"In the 166 Template task\n");
	
	// Wait for Robot go-ahead (e.g. entering Autonomous or Tele-operated mode)
	WaitForGoAhead();
	
	// Register our logger
	lHandle = Robot::getInstance();
	lHandle->RegisterLogger(&sl);
	
	// Register the proxy
	proxy = Proxy::getInstance();
	float CamJoystickX = 0.0;
	float CamJoystickY = 0.0;
	float CamX = 0.5;
	float CamY = 0.5;
	#define DEADBAND (0.2)
	#define CAMMOVE (.5 / (1000/CAMERA_SERVO_CYCLE_TIME))
    // General main loop (while in Autonomous or Tele mode)
	while (true) {
		if(!proxy->get("Joy3BT")) {
			CamJoystickX = proxy->get("Joy3X");
			CamJoystickY = proxy->get("Joy3Y");
			if(CamJoystickX >= DEADBAND) {
				CamX += CAMMOVE;
			} else if(CamJoystickX <= -DEADBAND) {
				CamX -= CAMMOVE;
			}
			if(CamJoystickY >= DEADBAND) {
				CamY -= CAMMOVE;
			} else if(CamJoystickY <= -DEADBAND) {
				CamY += CAMMOVE;
			}
			if(CamX > 1.0) {
				CamX = 1.0;
			} else if(CamX < .0) {
				CamX = .0;
			}
			if(CamY > 1.0) {
				CamY = 1.0;
			} else if(CamY < .0) {
				CamY = .0;
			}
		} else {
			CamX = CamY = 0.5;
		}
#if 0
		if ((++timer) % (500/CAMERA_SERVO_CYCLE_TIME) == 0 && camera.IsFreshImage()) {
			timer = 0;
			camera.GetImage(srcimage);
			frcColorThreshold(destimage, srcimage, IMAQ_HSL, &Hue_Range, &Sat_Range, &Lum_Range);
			GetLargestParticle(destimage,&largestParticleIndex);
			if(largestParticleIndex != 0) {
				frcParticleAnalysis(destimage, largestParticleIndex, &Particle_Report);
				printf("\tLargest Area: %f\n", Particle_Report.particleArea);
			} else {
				printf("No particle found...\n");
			}
		}
#endif
        cameraX.Set(CamX);
		cameraY.Set(CamY);
		// Logging any values
		sl.PutOne();
		
		// Wait for our next lap
		WaitForNextLoop();		
	}
	return (0);
	
};
开发者ID:chopshop-166,项目名称:frc-2011,代码行数:83,代码来源:cameraServo.cpp


注:本文中的Proxy::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。