Пример #1
0
int TestCoordMotion()
{
	
//	NMCSERVO Servo;
	int iError;
	int iModule;
	double dX, dY, dZ;
	iError=InitNMCModule3Axis (iModule);
	if (iModule < 3)
		return -1;
//	g_stage.ResetPos();
//	InitPathParam(P_30HZ, 75, 
//		          66845.7447, 66845.7447, 2*66845.7447,
//				  0.001,
//				  0.001);
	InitPathParam(P_60HZ, 75, 
		          6684.57447, 6684.57447, 6684.57447,
				  1.0,
				  1.0);

	iError=CreatePath1();
	ExecutePath3Axis();
	iError=CreatePath1_2();
	ExecutePath3Axis();
	
	iError=CreatePath1();
	ExecutePath3Axis();
	iError=CreatePath1_2();
	ExecutePath3Axis();
	ResetModules(iModule);
	return 0;
};
Пример #2
0
int TestGCodeClass()
{
	int iError;
	int res;
	int iModule;
	millCmdCtrl millcmdCtrl;
	Stage & _stage = Singleton<Stage>::Instance();
	Path  & _path = Singleton<Path>::Instance();

	_path.SetPathParams(P_60HZ,   //path frequency = 30 Hz
					75,       //Store a minimum of 45 points in the path point buffer
					15000.0,  //X scale - 20000.0 counts per inch
					15000.0,  //Y scale - 20000.0 counts per inch
					15000.0,      //Z scale - 1.0 counts per inch - not used
					0.200);     //acceleration = 1.0 inch/second/second
//	InitServoPathParams(P_30HZ,1, 2, 3);

	_path.SetOrigin(0.0, 0.0, 0.0); //set the origin to X = 0, Y = 0, Z = 0
	_path.SetFeedrate(0.200);         //feedrate = 1.0 inches/second
	_path.SetTangentTolerance(10.0);  //continuous path tangent tolerence = 10 degrees	
	iError=InitNMCModule3AxisStatic (iModule, _stage, _path);
	if (iModule < 3)
		return -1;

//	millcmdCtrl.SetStage(&_stage);
//	millcmdCtrl.SetPath(&_path);
	millcmdCtrl.ProcessGCode("C:\\Program Files (x86)\\Mill1A\\input\\CircleAtOrigin.nc");
//	millcmdCtrl.RunGCode();

	int numberCmds=millcmdCtrl.Count();
	int itype=0;
	millcmdCtrl.InitRun();
	double x1,y1,z1;
	double x2,y2,z2;
	double x3,y3,z3;
	for(int i=0; i < numberCmds; i++)
	{
		millcmdCtrl.RunCommand(i);
		itype=millcmdCtrl.GetCommand();
		if (itype == 0)
		{
			millcmdCtrl.GetStart(x1,y1,z1);
			millcmdCtrl.GetEnd(x2,y2,z2);
			millcmdCtrl.GetCenter(x3,y3,z3);
		}
		millcmdCtrl.Iter();

		
	}

	ResetModules(iModule);
	return 0;
}
Пример #3
0
int TestCoordMotionShortPath()
{
	
	int iError;
	int res;
	int iModule;
	Path vPath;

	iError=InitNMCModule3Axis (iModule, vPath);
	if (iModule < 3)
		return -1;
	
	g_stage.Rotate(180.0);
	g_stage.SetVel(3.0, 3.0, 3.0);
	g_stage.SetAccel(1.0, 1.0, 1.0);

	vPath.SetPathParams(P_60HZ,   //path frequency = 30 Hz
					75,       //Store a minimum of 45 points in the path point buffer
					6684.57447,  //X scale - 20000.0 counts per inch
					6684.57447,  //Y scale - 20000.0 counts per inch
					2*6684.57447,      //Z scale - 1.0 counts per inch - not used
					1.0);     //acceleration = 1.0 inch/second/second

	vPath.SetOrigin(0.0, 0.0, 0.0); //set the origin to X = 0, Y = 0, Z = 0
	vPath.SetFeedrate(1.0);         //feedrate = 1.0 inches/second
	vPath.SetTangentTolerance(10.0);  //continuous path tangent tolerence = 10 degrees	
	g_stage.InitPathMode(vPath);
	
	double x,y,z;
//	g_stage.GetPos(x,y,z);
//	InitPathParam(P_60HZ, 60, 
//		          6684.57447, 6684.57447, 2*6684.57447,
//				  1.0,
//				  1.0);

	g_stage.GetPos(x,y,z);
	g_stage.ResetPos();
//Clear the segment list and set the starting point for the path
//  at X = 0, Y = 1, Z = 0
	vPath.ClearSegListA(0,0,0);    

//Add a segment to move to x=0, y=2, z=0
	res = vPath.AddLineSegA(0.0, 1.0, 0.0);    
	if (res<0) return -1;
	
	res = vPath.AddArcSegA( 1.0, 2.0, 0.0,     //end point of arc: x=1, y=2, z=0
							 1.0, 1.0, 0.0,     //center point of arc: x=1, y=1, z = 0
							 0.0, 0.0, -1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;
	g_stage.ExecuteCoordMotion(vPath);
	
	vPath.ClearSegListA(1.0, 2.0, 0.0);    
	g_stage.GetPos(x,y,z);
	
	res = vPath.AddLineSegA(2.0, 2.0, 0.0);    //line segment endpoint: x=4, y=3, z=0
	if (res<0) return -1;
	
	res = vPath.AddArcSegA( 3.0, 1.0, 0.0,     //end point of arc: x=5, y=2, z=0
							 2.0, 1.0, 0.0,     //center point of arc: x=4, y=2, z = 0
							 0.0, 0.0, -1.0 );   //normal vector to arc plane: x = 0, y = 0, z = -1
	if (res<0) return -1;
	
//line segment endpoint: x=5, y=0, z=0
	res = vPath.AddLineSegA(3.0, 0.0, 0.0);    
	if (res<0) return -1;

//line segment endpoint: x=5, y=0, z=0
	g_stage.ExecuteCoordMotion(vPath);

	vPath.ClearSegListA(3.0, 0.0, 0.0);    
	if (res<0) return -1;

//line segment endpoint: x=5, y=0, z=0
	res = vPath.AddLineSegA(0.0, 0.0, 0.0);    
	if (res<0) return -1;
	g_stage.ExecuteCoordMotion(vPath);
	
	ResetModules(iModule);
	return 0;
};
Пример #4
0
int TestGCode()
{
	int iError;
	int res;
	int iModule;

	Stage & _stage = Singleton<Stage>::Instance();
	Path  & _path = Singleton<Path>::Instance();

	iError=InitNMCModule3AxisStatic (iModule, _stage, _path);
	if (iModule < 3)
		return -1;
	double x,y,z;
	_stage.GetPos(x,y,z);

	_stage.Rotate(180.0);
	_stage.SetVel(3.0, 3.0, 3.0);
	_stage.SetAccel(1.0, 1.0, 1.0);

	_stage.EnableAmp();
	_stage.ResetPos();
	_stage.GetPos(x,y,z);

//	g_stage.SetPathStatus();
	_path.SetPathParams(P_60HZ,   //path frequency = 30 Hz
					75,       //Store a minimum of 45 points in the path point buffer
					15000.0,  //X scale - 20000.0 counts per inch
					15000.0,  //Y scale - 20000.0 counts per inch
					15000.0,      //Z scale - 1.0 counts per inch - not used
					0.175);     //acceleration = 1.0 inch/second/second
//	InitServoPathParams(P_30HZ,1, 2, 3);

	_path.SetOrigin(0.0, 0.0, 0.0); //set the origin to X = 0, Y = 0, Z = 0
	_path.SetFeedrate(0.175);         //feedrate = 1.0 inches/second
	_path.SetTangentTolerance(10.0);  //continuous path tangent tolerence = 10 degrees	
	_stage.InitPathMode(_path);

	fstream filestr;

	filestr.open ("C:\\Program Files (x86)\\Mill1A\\input\\CircleAtOrigin.nc", fstream::in | fstream::out | fstream::app);

  // >> i/o operations here <<
	std::string line;
	int parenIndex=0;
	int spaceIndex=0;
	int cmdLine=0;
	string cmd;
	vector<string> cmdlist;
	millCmd millCmdC;
	ParseCNC ParseCNC;
//	ParseCNC.SetStage(_stage);
//	ParseCNC.SetPath(_path);
//	ParseCNC.SetStage(static_cast<Stage *>(&vStage));
//	ParseCNC.SetPath(static_cast<Path *>(&vPath));

	while(filestr){
		std::getline(filestr, line);
		parenIndex=line.find("(",0);
		if (parenIndex == string::npos)
		{
			ParseCNC.ParseLine(line, cmdlist);
			vector<string>::iterator it = cmdlist.begin();

			while (it != cmdlist.end())
			{
				ParseCNC.SetCommand1 (it, cmdlist);
			}
			cmdlist.clear();
		}
	}

	filestr.close();
	ParseCNC.GetCmd(millCmdC);
	int numberOfCommands =millCmdC.GetNumberOfCommands(); 
	for (int i=0; i <= numberOfCommands-1;i++)
	{
		millCmdC.execute(i);

	}


	ResetModules(iModule);
	return 0;
}
Пример #5
0
void CGameAISystem::Reset(bool bUnload)
{
	ResetModules(bUnload);
	ResetSubSystems(bUnload);
}
CEpgData::~CEpgData()
{
	ResetModules();
}