View Single Post
  #2   Spotlight this post!  
Unread 22-04-2012, 18:28
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,062
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Encoder function calls reporting inf

Quote:
Originally Posted by trilogy2826 View Post
GetPeriod(): Reports inf no matter the speed of the encoder physically turning. This is odd because this function is necessary for GetDistance() to work according to the encoder.c file
GetDistance does not use GetPeriod(). It uses GetRaw()

Code:
/**
 * Get the distance the robot has driven since the last reset.
 * 
 * @return The distance driven since the last reset as scaled by the value from SetDistancePerPulse().
 */
double Encoder::GetDistance()
{
	if (StatusIsFatal()) return 0.0;
	return GetRaw() * DecodingScaleFactor() * m_distancePerPulse;
}
Reply With Quote