View Single Post
  #3   Spotlight this post!  
Unread 29-01-2011, 14:32
kwfinken kwfinken is offline
Registered User
FRC #2246 (Army of Sum)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Lewiston, MI
Posts: 1
kwfinken is an unknown quantity at this point
Cool Re: VEX Ultrasonic Sensor

We are having the same problems and error, the sensor is not showing any distance changes but is staying at 0. The error appears on the driver's station diagnostic tab.
==================ERROR====================
Assertion Failed: "m_downSource!=NULL" in clearDownSource() in c:/windriver/workspace/wpilib/counter.cpp at line 337.

================Source Code=================

#include "WPILib.h"

DriverStationLCD *dsLCD = DriverStationLCD::GetInstance();

class ArmyOfSumRobot : public IterativeRobot
{
/*Initialize interaction with Hardware*/
RobotDrive *MyRobot; //Robot Drive
DriverStation *Ds; //Driver Station

Ultrasonic *USleft;

public:

ArmyOfSumRobot(void)
{
Ds = DriverStation::GetInstance();

MyRobot = new RobotDrive(1,2,3,4);// create robot drive base with 4 motors

USleft = new Ultrasonic(4,5); // create ultra sonic on digital IO 4,5 in inches
}

void AutonomousContinuous(void)
{
GetWatchdog().Feed();
}
void TeleopContinuous(void)
{
GetWatchdog().Feed();

dsLCD->Printf(DriverStationLCD::kUser_Line1, 1, "ultra sonic left: %g", USleft->GetRangeInches());
}

void DisabledPeriodic(void)
{
GetWatchdog().Feed(); // feed the user watchdog at every period when disabled
}

void TeleopPeriodic(void)
{
GetWatchdog().Feed(); // feed the user watchdog at every period when in autonomous

}

void DisabledContinuous(void)
{
GetWatchdog().Feed(); //do nothing
}

void AutonomousPeriodic(void)
{
GetWatchdog().Feed(); //do nothing
}
/********************************** Init Routines *************************************/
void DisabledInit(void)
{
}

void AutonomousInit(void)
{
}

void TeleopInit(void)
{
}

void RobotInit(void)
{

//initialize ultrasonics
USleft->SetDistanceUnits(Ultrasonic::kInches);
USleft->SetAutomaticMode(TRUE);


}
};

START_ROBOT_CLASS(ArmyOfSumRobot);
Reply With Quote