Beispiel #1
0
/************************************************
 * axis_position function
 * During milling time
 ***********************************************/
place axis_position(place positions)
{
	place pos_prov;

	pos_prov = check_position(positions);		//check if we invalidate the limits
	if(pos_prov.x_pos==0 && pos_prov.y_pos==0 && pos_prov.z_pos==0)
	{
		read_docs();//sd read
	}
	else if(pos_prov.x_pos!=0 || pos_prov.y_pos!=0 || pos_prov.z_pos!=0 )									//if does not
	{
		result=actual_to_previous(positions);	//actualize the positions & return the difference

		if(result.x_pos!=0)						//if x axis has changed
		{
			prove.axes=driverx;
			prove.step=mm_to_steps(result.x_pos);
			if(result.x_pos>0)	prove.direction=pos;
			else prove.direction=neg;
			move_motor(prove, 3000);
			result.x_pos=0;
		}
		if(result.y_pos!=0)
		{
			prove.axes=drivery;
			prove.step=mm_to_steps(result.y_pos);
			if(result.y_pos>0)	prove.direction=pos;
			else prove.direction=neg;
			move_motor(prove, 3000);
			result.y_pos=0;
		}
		if(result.z_pos!=0)
		{
			prove.axes=driverz;
			prove.step=mm_to_steps(result.z_pos);
			if(result.z_pos>0) prove.direction=pos;
			else prove.direction=neg;
			move_motor(prove, 3000);
			result.z_pos=0;
		}

		//aqui iniciar el timer GIE

	}
	return positions;
}
Beispiel #2
0
bool Clustering::initialize() {
	if (!m_conf.parse()) 
		EXIT_ERROR("Parse error in config.in!");

    m_threshold = atof(m_conf.get("threshold").c_str());
    if (m_threshold == -1)
        EXIT_ERROR("threshold is not set in config.in!");
    
    string data_pt = m_conf.get("data_pt");
    if (data_pt.empty()) 
		EXIT_ERROR("data_pt is not set in config.in!");
        
    read_docs(data_pt.c_str());
    if (m_docs.empty())
        EXIT_ERROR2("no queries read from ", data_pt.c_str());
    cout << "read queries, size = " << m_docs.size() <<endl;

    init_dims();
    if (m_dims.empty())
        EXIT_ERROR("Bad init cluster data format, feature dimension is zero!");
    cout << "DimArray initialized, size = " << m_dims.size() <<endl;
    
    return true;
}