Demo entry 6729660

ss

   

Submitted by ss on Apr 03, 2018 at 14:29
Language: C++. Code size: 2.0 kB.

int _tmain(int argc, _TCHAR* argv[])
{ 
	SR7IF_ETHERNET_CONFIG SREthernetConFig;
	SREthernetConFig.abyIpAddress[0] = 192;
	SREthernetConFig.abyIpAddress[1] = 168;
	SREthernetConFig.abyIpAddress[2] = 0;
	SREthernetConFig.abyIpAddress[3] = 122;
	const int DEVICE_ID = 0;   
    SR7IF_Data DataObject = NULL;     
	//连接相机
	SR7IF_EthernetOpen(DEVICE_ID, &SREthernetConFig);
	//开始批处理---------IO触发时调用函数 SR7IF_StartTriggerBatch(DEVICE_ID, 20000)
	SR7IF_StartMeasure(DEVICE_ID, 20000);        
	//获取轮廓宽度
	int m_DataWidth = SR7IF_ProfileDataWidth(DEVICE_ID, DataObject);
	bool b_stop =  true;											   //循环停止标志
	int* HeightData = new int[1000 * m_DataWidth];                      //当前批次高度数据缓存
	unsigned char* GrayData = new unsigned char[1000 * m_DataWidth];     //当前批次灰度数据缓存
	long long BatchPoint_CurNo = 0;                                   //当前批处理编号
	unsigned int* FrameLoss =  new unsigned int [1000];                  //批处理过快掉帧数量数据缓存
    long long *FrameId = new long long[1000];                           //帧编号数据缓存
	unsigned int* Encoder = new unsigned int [1000];                      //编码器数据缓存
	long long OverFlowStartId = 0;                                        //溢出起始帧号
	int FrameLossID = 0;												  //丢帧数                       
	int EncoderID = 0;													  //编码器值
	//循环接收数据
	do
	{
		/****循环跳出条件设置***/
		/***********************/
		//数据接收
		//当前批次高度数据、灰度数据、编码器数据、帧编号、掉帧数量数据
		int m_curBatchPoint = SR7IF_GetBatchRollData(DEVICE_ID, DataObject, HeightData, GrayData, Encoder, FrameId, FrameLoss, 500);
		if(m_curBatchPoint == 0)
            continue;
		int TmpID = m_curBatchPoint - 1;
        OverFlowStartId = FrameId[TmpID];
		FrameLossID = FrameLoss[TmpID];
		EncoderID = Encoder[TmpID];
		BatchPoint_CurNo += m_curBatchPoint;
		Sleep(50);
	}while(b_stop);
	//内存释放
	delete[] HeightData;
	delete[] GrayData;
	delete[] FrameLoss;
	delete[] Encoder;
	delete[] FrameId;
	//停止批处理
	SR7IF_StopMeasure(DEVICE_ID);
	//关闭设备
	SR7IF_CommClose(DEVICE_ID);
	return 0;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).