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


C++ Movement::get_length_position方法代码示例

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


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

示例1: main

int main(int argc,char* argv[])
{

	
	
	int portNb=19997;
	int error;
	vector <double> xyz;
	int clientID = simxStart((simxChar*)"127.0.0.1",portNb,true,true,2000,5);
	cerr << clientID << endl;


	//===================================================================
	Motion_structure * estructura = new Motion_structure(argv[1], 0.001);
	//===================================================================

	xyz.push_back(0);
	xyz.push_back(0);
	xyz.push_back(0);
	simxStartSimulation(clientID, simx_opmode_oneshot_wait);

	if (clientID!=-1)
	{
		
		
		int handle[6];
		error = simxGetObjectHandle(clientID, "redundantRob_joint1", &handle[0], simx_opmode_oneshot_wait);
		if (error != 0) cerr << error << endl;
		error = simxGetObjectHandle(clientID, "redundantRob_joint2", &handle[1], simx_opmode_oneshot_wait);
		if (error != 0) cerr << error << endl;
		error = simxGetObjectHandle(clientID, "redundantRob_joint3", &handle[2], simx_opmode_oneshot_wait);
		if (error != 0) cerr << error << endl;
		error = simxGetObjectHandle(clientID, "redundantRob_joint4", &handle[3], simx_opmode_oneshot_wait);
		if (error != 0) cerr << error << endl;
		error = simxGetObjectHandle(clientID, "redundantRob_joint5", &handle[4], simx_opmode_oneshot_wait);
		if (error != 0) cerr << error << endl;
		error = simxGetObjectHandle(clientID, "redundantRob_joint6", &handle[5], simx_opmode_oneshot_wait);
		if (error != 0) cerr << error << endl;

		int tiempo_entre_puntos;
		double velocidad;

		while (simxGetConnectionId(clientID)!=-1)
		{
			char quit;
			cout << "Si desea mover el brazo aprete enter, si desea salir aprete q" << endl;
			cin >> quit;
			if(quit == 'q')break;

			cout << "\nIngrese la variacion de la position Xq" << endl;
			//fscanf(stdin, "%f %f %f %f", &xyz.at(0),&xyz.at(1),&xyz.at(2), &velocidad);
			cin >> xyz.at(0);
			cout << "\nusted ingreso " << xyz.at(0) << endl;
			cout << "\nIngrese la variacion de la position Y" << endl;
			cin >> xyz.at(1);
			cout << "\nusted ingreso " << xyz.at(1) << endl;
			cout << "\nIngrese la variacion de la position Z" << endl;
			cin >> xyz.at(2);
			cout << "\nusted ingreso " << xyz.at(2) << endl;
			cout << "\ningrese la velocidad del movimiento " << endl;
			cin >> velocidad;


			//========================================================================
			Movement movimiento;
			movimiento = estructura->move_delta_xyz_position(xyz,velocidad);
			tiempo_entre_puntos = movimiento.get_time_between_tw0_points_millisecons();
			//=========================================================================

			for (int i = 0; i < movimiento.get_length_position(); ++i)
			{
				//=========================================================================
				vector <double> posicion = movimiento.get_from_list_motor_angle_position(i);
				vector <double> velocidad = movimiento.get_from_list_motor_velocities(i);
				//=========================================================================


				simxPauseCommunication(clientID, 1);
				for (int j = 0; j < (int)posicion.size(); ++j)
				{
					error = simxSetJointTargetPosition(clientID, handle[j], posicion.at(j), simx_opmode_oneshot);
					error = simxSetJointTargetVelocity(clientID, handle[j], velocidad.at(j), simx_opmode_oneshot);
				}
				simxPauseCommunication(clientID, 0);
				extApi_sleepMs( tiempo_entre_puntos );

			}

		}
		
	}
开发者ID:psigelo,项目名称:motion_structure,代码行数:91,代码来源:brazo.cpp


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