Пример #1
0
	void GetAcceleration(double &ax, double &ay)
	{
		double axH = countXhi.GetPeriod();
		double axL = countXlow.GetPeriod();
		double ayH = countYhi.GetPeriod();
		double ayL = countYlow.GetPeriod();
				
		//axH = axH - fmod(axH, 0.00001);
		//ayH = ayH - fmod(ayH, 0.00001);
				
				// convert to m/s^2 -- 50% duty cycle is 0g
		ax = (((axH / (axH + axL)) - .5) * 8.0) * 9.81;
		ay = (((ayH / (ayH + ayL)) - .5) * 8.0) * 9.81;
	}
Пример #2
0
/*
 * Get the Period of the most recent count.
 * Returns the time interval of the most recent count. This can be used for velocity calculations
 * to determine shaft speed.
 * @param channel The channel of the digital input used with this counter
 * @returns The period of the last two pulses in units of seconds.
 */
double GetCounterPeriod(UINT32 channel)
{
    Counter *counter = AllocateCounter(channel);
    if (counter != NULL)
        return counter->GetPeriod();
    else
        return 0;
}