Skip to content

Commit

Permalink
Modified the chatterbox device names to match those used in stage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash Charles committed Oct 14, 2010
1 parent 2bb7748 commit 2036797
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 63 deletions.
92 changes: 46 additions & 46 deletions librapichatterbox/cbrobot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ int CCBRobot::findDevice( ARangeFinder* &device, std::string devName )
return 0; // error
}

if (( devName != "CB:laser" ) &&
( devName != "CB:wall" ) &&
( devName != "CB:ir" ) ) {
if (( devName != "laser:0" ) &&
( devName != "wall:0" ) &&
( devName != "ir:0" ) ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
Expand All @@ -241,10 +241,10 @@ int CCBRobot::findDevice( ARangeFinder* &device, std::string devName )
//************************************
// Laser

if ( devName == "CB:laser" ) {
if ( devName == "laser:0" ) {
// check if device already exists
if ( mCBLaser == NULL ) {
mCBLaser = new CCBLaser( mCBDriver, "CB:laser" );
mCBLaser = new CCBLaser( mCBDriver, "laser:0" );
device = mCBLaser;
return mCBLaser->init();
}
Expand All @@ -256,10 +256,10 @@ int CCBRobot::findDevice( ARangeFinder* &device, std::string devName )

//************************************
// IR sensor
if ( devName == "CB:ir" ) {
if ( devName == "ir:0" ) {
// check if device already exists
if ( mCBIrSensor == NULL ) {
mCBIrSensor = new CCBIrSensor( mCBDriver, "CB:ir" );
mCBIrSensor = new CCBIrSensor( mCBDriver, "ir:0" );
device = mCBIrSensor;
return mCBIrSensor->init();
}
Expand All @@ -271,10 +271,10 @@ int CCBRobot::findDevice( ARangeFinder* &device, std::string devName )

//************************************
// Wall sensor
if ( devName == "CB:wall" ) {
if ( devName == "wall:0" ) {
// check if device already exists
if ( mCBWallSensor == NULL ) {
mCBWallSensor = new CCBWallSensor( mCBDriver, "CB:wall" );
mCBWallSensor = new CCBWallSensor( mCBDriver, "wall:0" );
device = mCBWallSensor;
return mCBWallSensor->init();
}
Expand All @@ -295,15 +295,15 @@ int CCBRobot::findDevice( ADrivetrain2dof* &device, std::string devName )
return 0; // error
}

if ( devName != "CB:drivetrain" ) {
if ( devName != "drivetrain:0" ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

// check if device already exists
if ( mCBDrivetrain == NULL ) {
mCBDrivetrain = new CCBDrivetrain2dof( mCBDriver, "CB:drivetrain" );
mCBDrivetrain = new CCBDrivetrain2dof( mCBDriver, "drivetrain:0" );
device = mCBDrivetrain;
return mCBDrivetrain->init();
}
Expand All @@ -321,15 +321,15 @@ int CCBRobot::findDevice( APowerPack* &device, std::string devName )
return 0; // error
}

if ( devName != "CB:powerpack" ) {
if ( devName != "powerpack:0" ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

// check if device already exists
if ( mCBPowerPack == NULL ) {
mCBPowerPack = new CCBPowerPack( mCBDriver, "CB:powerpack" );
mCBPowerPack = new CCBPowerPack( mCBDriver, "powerpack:0" );
device = mCBPowerPack;
return mCBPowerPack->init();
}
Expand All @@ -347,19 +347,19 @@ int CCBRobot::findDevice( AFiducialFinder* &device, std::string devName )
return 0; // error
}

if (( devName != "CB:front_fiducial" ) &&
( devName != "CB:top_fiducial" ) ) {
if (( devName != "fiducial:0" ) &&
( devName != "fiducial:1" ) ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

//************************************
// Front fiducial finder
if ( devName == "CB:front_fiducial" ) {
if ( devName == "fiducial:0" ) {
// check if device already exists
if ( mCBFrontFiducial == NULL ) {
mCBFrontFiducial = new CCBFrontFiducialFinder( mCBDriver, "CB:front_fiducial" );
mCBFrontFiducial = new CCBFrontFiducialFinder( mCBDriver, "fiducial:0" );
device = mCBFrontFiducial;
return mCBFrontFiducial->init();
}
Expand All @@ -371,10 +371,10 @@ int CCBRobot::findDevice( AFiducialFinder* &device, std::string devName )

//************************************
// Top fiducial finder
if ( devName == "CB:top_fiducial" ) {
if ( devName == "fiducial:0" ) {
// check if device already exists
if ( mCBTopFiducial == NULL ) {
mCBTopFiducial = new CCBTopFiducialFinder( mCBDriver, "CB:top_fiducial" );
mCBTopFiducial = new CCBTopFiducialFinder( mCBDriver, "fiducial:0" );
device = mCBTopFiducial;
return mCBTopFiducial->init();
}
Expand All @@ -395,15 +395,15 @@ int CCBRobot::findDevice( ALights* &device, std::string devName )
return 0; // error
}

if ( devName != "CB:lights" ) {
if ( devName != "lights:0" ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

// check if device already exists
if ( mCBLights == NULL ) {
mCBLights = new CCBLights( mCBDriver, "CB:lights" );
mCBLights = new CCBLights( mCBDriver, "lights:0" );
device = mCBLights;
return mCBLights->init();
}
Expand All @@ -421,15 +421,15 @@ int CCBRobot::findDevice( ATextDisplay* &device, std::string devName )
return 0; // error
}

if ( devName != "CB:textdisplay" ) {
if ( devName != "textdisplay:0" ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

// check if device already exists
if ( mCBTextDisplay == NULL ) {
mCBTextDisplay = new CCBTextDisplay( mCBDriver, "CB:textdisplay" );
mCBTextDisplay = new CCBTextDisplay( mCBDriver, "textdisplay:0" );
device = mCBTextDisplay;
return mCBTextDisplay->init();
}
Expand All @@ -447,15 +447,15 @@ int CCBRobot::findDevice( ASwitchArray* &device, std::string devName )
return 0; // error
}

if ( devName != "CB:lowsidedriver" ) {
if ( devName != "lowsidedriver:0" ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

// check if device already exists
if ( mCBLowSideDriver == NULL ) {
mCBLowSideDriver = new CCBLowSideDriver( mCBDriver, "CB:lowsidedriver" );
mCBLowSideDriver = new CCBLowSideDriver( mCBDriver, "lowsidedriver:0" );
device = mCBLowSideDriver;
return mCBLowSideDriver->init();
}
Expand All @@ -468,7 +468,7 @@ int CCBRobot::findDevice( ASwitchArray* &device, std::string devName )
int CCBRobot::findDevice( ABlobFinder* &device, std::string devName )
{
device = NULL;
ERROR0( "Device not implementated for chatterbox" );
ERROR0( "Device not implemented for chatterbox" );
return 0;
}
//-----------------------------------------------------------------------------
Expand All @@ -480,15 +480,15 @@ int CCBRobot::findDevice( AAnalogSensorArray* &device, std::string devName )
return 0; // error
}

if ( devName != "CB:photosensor" ) {
if ( devName != "photosensor:0" ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

// check if device already exists
if ( mCBPhotoSensor == NULL ) {
mCBPhotoSensor = new CCBPhotoSensor( mCBDriver, "CB:photosensor" );
mCBPhotoSensor = new CCBPhotoSensor( mCBDriver, "photosensor:0" );
device = mCBPhotoSensor;
return mCBPhotoSensor->init();
}
Expand All @@ -506,23 +506,23 @@ int CCBRobot::findDevice( ABinarySensorArray* &device, std::string devName )
return 0; // error
}

if (( devName != "CB:bumper" ) &&
( devName != "CB:virtualwall" ) &&
( devName != "CB:cliff" ) &&
( devName != "CB:overcurrent" ) &&
( devName != "CB:button" ) &&
( devName != "CB:wheeldrop" ) ) {
if (( devName != "bumper:0" ) &&
( devName != "virtualwall:0" ) &&
( devName != "cliff:0" ) &&
( devName != "overcurrent:0" ) &&
( devName != "button:0" ) &&
( devName != "wheeldrop:0" ) ) {
ERROR1( "No such device: %s", devName.c_str() );
device = NULL;
return 0; // error
}

//************************************
// Bumper
if ( devName == "CB:bumper" ) {
if ( devName == "bumper:0" ) {
// check if device already exists
if ( mCBBumper == NULL ) {
mCBBumper = new CCBBumper( mCBDriver, "CB:bumper" );
mCBBumper = new CCBBumper( mCBDriver, "bumper:0" );
device = mCBBumper;
return mCBBumper->init();
}
Expand All @@ -534,10 +534,10 @@ int CCBRobot::findDevice( ABinarySensorArray* &device, std::string devName )

//************************************
// Virtual wall
if ( devName == "CB:virtualwall" ) {
if ( devName == "virtualwall:0" ) {
// check if device already exists
if ( mCBVirtualWall == NULL ) {
mCBVirtualWall = new CCBVirtualWallSensor( mCBDriver, "CB:virtualwall" );
mCBVirtualWall = new CCBVirtualWallSensor( mCBDriver, "virtualwall:0" );
device = mCBVirtualWall;
return mCBVirtualWall->init();
}
Expand All @@ -549,10 +549,10 @@ int CCBRobot::findDevice( ABinarySensorArray* &device, std::string devName )

//************************************
// Button
if ( devName == "CB:button" ) {
if ( devName == "button:0" ) {
// check if device already exists
if ( mCBCreateButton == NULL ) {
mCBCreateButton = new CCBCreateButton( mCBDriver, "CB:button" );
mCBCreateButton = new CCBCreateButton( mCBDriver, "button:0" );
device = mCBCreateButton;
return mCBCreateButton->init();
}
Expand All @@ -564,11 +564,11 @@ int CCBRobot::findDevice( ABinarySensorArray* &device, std::string devName )

//************************************
// Wheel drop sensor
if ( devName == "CB:wheeldrop" ) {
if ( devName == "wheeldrop:0" ) {
// check if device already exists
if ( mCBWheelDropSensor == NULL ) {
mCBWheelDropSensor =
new CCBWheelDropSensor( mCBDriver, "CB:wheeldrop" );
new CCBWheelDropSensor( mCBDriver, "wheeldrop:0" );
device = mCBWheelDropSensor;
return mCBWheelDropSensor->init();
}
Expand All @@ -580,10 +580,10 @@ int CCBRobot::findDevice( ABinarySensorArray* &device, std::string devName )

//************************************
// Cliff sensor
if ( devName == "CB:cliff" ) {
if ( devName == "cliff:0" ) {
// check if device already exists
if ( mCBCliffSensor == NULL ) {
mCBCliffSensor = new CCBCliffSensor( mCBDriver, "CB:cliff" );
mCBCliffSensor = new CCBCliffSensor( mCBDriver, "cliff:0" );
device = mCBCliffSensor;
return mCBCliffSensor->init();
}
Expand All @@ -595,10 +595,10 @@ int CCBRobot::findDevice( ABinarySensorArray* &device, std::string devName )

//************************************
// Overcurrent sensor
if ( devName == "CB:overcurrent" ) {
if ( devName == "overcurrent:0" ) {
// check if device already exists
if ( mCBOverCurrentSensor == NULL ) {
mCBOverCurrentSensor = new CCBOverCurrentSensor( mCBDriver, "CB:overcurrent" );
mCBOverCurrentSensor = new CCBOverCurrentSensor( mCBDriver, "overcurrent:0" );
device = mCBOverCurrentSensor;
return mCBOverCurrentSensor->init();
}
Expand Down
34 changes: 17 additions & 17 deletions librapichatterbox/cbrobot.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ namespace Rapi

/**
* A Rapi based implementation for a chatterbox robot. Possible devices:
* CB:laser Urg laser
* CB:ir IR distance sensors on base board
* CB:wall ICreate wall sensor on front right side
* CB:drivetrain ICreate drive train
* CB:powerpack ICreate power pack
* CB:front_fiducial ICreate omni IR led in front of robot
* CB:top_fiducial IR fiducial led on base board
* CB:lights RGB leds on base board
* CB:textdisplay 7seg display on top of base board
* CB:lowsidedriver ICreate low side driver
* CB:photosensor Photo sensor on top of base board
* CB:bumper ICreate bumpers
* CB:virtualwall ICreate virtual wall sensors, based on the omni ir
* CB:cliff ICreate cliff sensor
* CB:overcurrent ICreate overcurrent sensors
* CB:button ICreate top control buttons
* CB:wheeldrop ICreate wheel drop sensor
* laser:0 Urg laser
* ir:0 IR distance sensors on base board
* wall:0 ICreate wall sensor on front right side
* drivetrain:0 ICreate drive train
* powerpack:0 ICreate power pack
* fiducial:0 ICreate omni IR led in front of robot
* fiducial:1 IR fiducial led on base board
* lights:0 RGB leds on base board
* textdisplay:0 7seg display on top of base board
* lowsidedriver:0 ICreate low side driver
* photosensor:0 Photo sensor on top of base board
* bumper:0 ICreate bumpers
* virtualwall:0 ICreate virtual wall sensors, based on the omni ir
* cliff:0 ICreate cliff sensor
* overcurrent:0 ICreate overcurrent sensors
* button:0 ICreate top control buttons
* wheeldrop:0 ICreate wheel drop sensor
* @author Jens Wawerla <[email protected]>
*/
class CCBRobot : public ARobot
Expand Down

0 comments on commit 2036797

Please sign in to comment.