View Single Post
  #8   Spotlight this post!  
Unread 15-02-2009, 20:11
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Ultrasonics / Sonar

Quote:
Originally Posted by Shira View Post
In the constructor:
Code:
m_ultra = new Ultrasonic(pingChannel, echoChannel);	
m_ultra->SetAutomaticMode(true);
range = m_ultra->GetRangeInches();
But when I print out the range I get only zeros.
Are you ever setting range anywhere else? The assignment in the constructor most likely occurs before any echoes have been received, so it won't be a valid value. I believe calling m_ultra->GetRangeInches() later should give you the current range.
Reply With Quote