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


C++ Finger::move方法代码示例

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


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

示例1: main

int main( int argc, char **argv, char **envp)
{
	readDrawPoints();
	//readTrace();
	bool run =true;//
	if(run){
	init_LuoLita_1();

	LitaHand.GripperMove_Abs_To(75.0f, 1);

    // for periodic timer code
    LARGE_INTEGER  liPeriod_1ms;   // timer period
    HANDLE         hTimer1;     // timer handle
	//LARGE_INTEGER  liPeriod_10ms;   // timer period
    //HANDLE         hTimer2;     // timer handle

    //  RTX periodic timer code:
    //  TO DO: Set default timer period to your desired time.
    //         The period needs to be an even multiple of the HAL
    //         period found in the control panel.
    //         This example uses a period of 500 micro seconds.

    liPeriod_1ms.QuadPart  = 10000;
	//liPeriod_10ms.QuadPart = 100000;

	Init_IMPCard();
	// clear timer
	//RtDeleteTimer( hTimer1 );
	//RtDeleteTimer( hTimer2 );

    // Create a periodic timer
    if (! (hTimer1 = RtCreateTimer(
                                   NULL,            // security
                                   0,               // stack size - 0 uses default
                                   TimerHandler1,    // timer handler
                                   NULL,            // NULL context (argument to handler)
                                   RT_PRIORITY_MAX, // priority
                                   CLOCK_2) ))      // RTX HAL timer
    {
        //
        // TO DO:  exception code here
        // RtWprintf(L"RtCreateTimer error = %d\n",GetLastError());
        ExitProcess(1);
    }

    if (! RtSetTimerRelative( hTimer1, &liPeriod_1ms, &liPeriod_1ms ))
    {
        //RtWprintf(L"RtSetTimerRelative error = %d\n",GetLastError());
		// TO DO: exception code here
        ExitProcess(1);
    }
	
	init_LuoLita_2();
	LitaHand.GripperMove_Abs_To( 55.0f, 200);

	/////////////////////////////////////////
	kbCmd = 'j';
	MainLoop_keyboard();

	//Initial finger pose
	finger.init();
	finger.open();
	finger.setMode('p');
	finger.move(80);
	setDefaultArmSpeed(0.5);
	kbCmd = ' ';
	while(!initialDone)
	{
		if ( _kbhit() )
			 kbCmd = _getche();

		if ( kbCmd == kb_ESC )
			break;
		InitialPose_keyboard();
		Sleep(29);
		system("cls");
		DisplayLoop(speed);
		cout<<endl<<"first_x: "<<first_x<<"first_y: "<<first_y<<"first_z: "<<first_z<<endl;
	}
	cout<< endl << " Initialization is done . " <<endl;
	Sleep(2000);

	T <<  -1.0f,  0.0f,  0.0f,  first_x, //
			0.0f,  1.0f,  0.0f,  first_y+0.1, //
			0.0f,  0.0f, -1.0f,  first_z+0.13, //-0.2726
			0.0f,  0.0f,  0.0f,  1.0f;
	Move_L_Abs(T,0);
	while(MOVL){system("cls");	DisplayLoop(speed);}

	T <<  -1.0f,  0.0f,  0.0f,  centerX, //
			0.0f,  1.0f,  0.0f,  centerY, //
			0.0f,  0.0f, -1.0f,  0.0f, //
			0.0f,  0.0f,  0.0f,  1.0f;
	Move_L_Abs(T,0);
	while(MOVL){};

	kbCmd = ' ';
	while(1)
	{
		if ( _kbhit() )
//.........这里部分代码省略.........
开发者ID:momentchan,项目名称:Drawing-Robot-Arm-Control,代码行数:101,代码来源:LuoLitaArm.cpp

示例2: InitialPose_keyboard

//***
void InitialPose_keyboard(){
	switch( kbCmd ){
		case '-':
			if(speed>0.2) speed-=(float)0.1;
			setDefaultArmSpeed(speed);
			break;
		case '+':
			if(speed<1.2) speed+=(float)0.1;
			setDefaultArmSpeed(speed);
			break;
		case 'a':
			t << -0.001f,0,0,0,0,0;
			Move_L_Rel(t,0);
			first_x = T07Cmd(0,3);
			break;
		case 'd':
			t << 0.001f,0,0,0,0,0;
			Move_L_Rel(t,0);
			first_x = T07Cmd(0,3);
			break;
		case 'w':
			t << 0,0.001f,0,0,0,0;
			Move_L_Rel(t,0);
			first_y = T07Cmd(1,3);
			break;
		case 's':
			t << 0,-0.001f,0,0,0,0;
			Move_L_Rel(t,0);
			first_y = T07Cmd(1,3);
			break;
		case 'r':
			t << 0,0,0.01f,0,0,0;
			Move_L_Rel(t,0);
			while(MOVL){};
			first_z = T07Cmd(2,3);
			break;
		case 'f':
			t << 0,0,-0.01f,0,0,0;
			Move_L_Rel(t,0);
			while(MOVL){};
			first_z = T07Cmd(2,3);
			break;
		case 'z':
			
			T <<  -1.0f,  0.0f,  0.0f,  first_x, //
				   0.0f,  1.0f,  0.0f,  first_y, //
				   0.0f,  0.0f, -1.0f,  first_z, //-0.2726
				   0.0f,  0.0f,  0.0f,  1.0f;
			Move_L_Abs(T,0);
			
			while(MOVL){system("cls");
					DisplayLoop(speed);}
			break;
		case 'j':
			t << -0.11f,0,0,0,0,0;
			Move_L_Rel(t,0);
			break;
		case 'l':
			t << 0.11f,0,0,0,0,0;
			Move_L_Rel(t,0);
			break;
		case 'i':
			t << 0,0.08f,0,0,0,0;
			Move_L_Rel(t,0);
			break;
		case 'k':
			t << 0,-0.08f,0,0,0,0;
			Move_L_Rel(t,0);
			break;
		case 'b':
			t << 0,0,-0.12f,0,0,0;
			Move_L_Rel(t,0);
			while(MOVL){};
			finger.close();
			t << 0,0,0.12f,0,0,0;
			Move_L_Rel(t,0);
			break;
		case 'n':
			finger.move(80);
			break;
		case 'o':
			outputFile.open("trace.txt");
			write=true;
			t << 0.10f,0,0,0,0,0;
			Move_L_Rel(t,0);
			while(MOVL){};
			write=false;
			outputFile.close();
			break;
		case 'm':
			Move_Contour();
			break;
		case 'p':
			z_axis_black = -0.20;
			//draw edge
			T <<  -1.0f,  0.0f,  0.0f,  sketchPositionXY[sketchIndex][0](0), //
					0.0f,  1.0f,  0.0f,  sketchPositionXY[sketchIndex][0](1), //
					0.0f,  0.0f, -1.0f,  z_axis_black+(float)0.01, //
					0.0f,  0.0f,  0.0f,  1.0f;
//.........这里部分代码省略.........
开发者ID:momentchan,项目名称:Drawing-Robot-Arm-Control,代码行数:101,代码来源:LuoLitaArm.cpp

示例3: MyLoop_keyboard


//.........这里部分代码省略.........
			}
			break;
		case 'p':
			// fill every areas
			if(fillIndex < fillNumbers){
				Vector2f dxy = ColorPosition(fillIndex+1);
				// Go to position of pen
				T <<  -1.0f,  0.0f,  0.0f,  first_x+dxy(0), //
				   0.0f,  1.0f,  0.0f,  first_y+dxy(1), //
				   0.0f,  0.0f, -1.0f,  first_z, //-0.2726
				   0.0f,  0.0f,  0.0f,  1.0f;
				Move_L_Abs(T,0);
				while(MOVL){system("cls");	DisplayLoop(speed);}

				// Grasp pen
				t << 0,0,-0.12f,0,0,0;
				Move_L_Rel(t,0);
				while(MOVL){};
				finger.close();
				t << 0,0,0.20f,0,0,0;
				Move_L_Rel(t,0);
				while(MOVL){};

				// Move to via point position
				T <<  -cos(0.25*M_PI),  sin(0.25*M_PI),  0.0f,  first_x, //
					sin(0.25*M_PI),  cos(0.25*M_PI),  0.0f,  first_y+0.1, //
					0.0f,  0.0f, -1.0f,  first_z+0.13, //-0.2726
					0.0f,  0.0f,  0.0f,  1.0f;
				Move_L_Abs(T,0);
				while(MOVL){system("cls");	DisplayLoop(speed);}

				// Go to center
				T <<  -cos(0.25*M_PI),  sin(0.25*M_PI),  0.0f,  centerX, //
				   sin(0.25*M_PI),  cos(0.25*M_PI),  0.0f,  centerY, //
				   0.0f,  0.0f, -1.0f,  0.0f, //
				   0.0f,  0.0f,  0.0f,  1.0f;
				Move_L_Abs(T,0);
				while(MOVL){system("cls"); DisplayLoop(speed);}
								
				T <<  -cos(0.25*M_PI),  sin(0.25*M_PI),  0.0f,  fill_pos_x[fillIndex][0][0], //
					   sin(0.25*M_PI),  cos(0.25*M_PI),  0.0f,  fill_pos_y[fillIndex][0][0], //
					   0.0f,  0.0f, -1.0f,  z_axis_color+(float)0.01, //
					   0.0f,  0.0f,  0.0f,  1.0f;
				Move_L_Abs(T,0);
				while(MOVL){system("cls"); DisplayLoop(speed);}

				for(unsigned int i=0;i<fill_pos_x[fillIndex].size();i++){
					// move to the top of first point of every area
					T <<  -cos(0.25*M_PI),  sin(0.25*M_PI),  0.0f,  fill_pos_x[fillIndex][i][0], //
					      sin(0.25*M_PI),  cos(0.25*M_PI),  0.0f,  fill_pos_y[fillIndex][i][0], //
					       0.0f,  0.0f, -1.0f,  z_axis_color+(float)0.005, //
					       0.0f,  0.0f,  0.0f,  1.0f;
					Move_L_Abs(T,0);
					while(MOVL){system("cls"); DisplayLoop(speed);};
					
					for(unsigned int j=0;j<fill_pos_x[fillIndex][i].size();j++){ 
					  T <<  -cos(0.25*M_PI),  sin(0.25*M_PI),  0.0f,  fill_pos_x[fillIndex][i][j], //
						   sin(0.25*M_PI),  cos(0.25*M_PI),  0.0f,  fill_pos_y[fillIndex][i][j], //
						   0.0f,  0.0f, -1.0f,  z_axis_color, //
						   0.0f,  0.0f,  0.0f,  1.0f;
					  Move_L_Abs(T,0);
					  while(MOVL){system("cls"); DisplayLoop(speed);}
					}
				}
				T <<  -cos(0.25*M_PI),  sin(0.25*M_PI),  0.0f,  fill_pos_x[fillIndex][fill_pos_x[fillIndex].size()-1][0], //
				      sin(0.25*M_PI),  cos(0.25*M_PI),  0.0f,  fill_pos_y[fillIndex][fill_pos_x[fillIndex].size()-1][0], //
				       0.0f,  0.0f, -1.0f,  z_axis_color+(float)0.01, //
					   0.0f,  0.0f,  0.0f,  1.0f;
				Move_L_Abs(T,0);
				while(MOVL){system("cls");	DisplayLoop(speed);}
				fillIndex++;

				// Move to pen box position
				T <<  -1.0f,  0.0f,  0.0f,  first_x, //
					0.0f,  1.0f,  0.0f,  first_y+0.13, //
					0.0f,  0.0f, -1.0f,  first_z+0.13, //-0.2726
					0.0f,  0.0f,  0.0f,  1.0f;
				Move_L_Abs(T,0);
				while(MOVL){system("cls");	DisplayLoop(speed);}
				
				// Drop pen
				t << 0,0,-0.11f,0,0,0;
				Move_L_Rel(t,0);
				while(MOVL){};
				finger.move(80);
				t << 0,0,0.11f,0,0,0;
				Move_L_Rel(t,0);
			}
			break;
		case 'b':
			finger.close();
			break;
		case 'n':
			finger.move(80);
			break;
	}

	kbCmd_3 = kbCmd;
	kbCmd = ' ';
}
开发者ID:momentchan,项目名称:Drawing-Robot-Arm-Control,代码行数:101,代码来源:LuoLitaArm.cpp


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