00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "ArExport.h"
00027 #include "ariaOSDef.h"
00028 #include "ArActionGroup.h"
00029 #include "ArActionGroups.h"
00030 #include "ArActionLimiterTableSensor.h"
00031 #include "ArActionLimiterForwards.h"
00032 #include "ArActionLimiterBackwards.h"
00033 #include "ArActionInput.h"
00034 #include "ArActionStop.h"
00035 #include "ArActionStallRecover.h"
00036 #include "ArActionBumpers.h"
00037 #include "ArActionAvoidFront.h"
00038 #include "ArActionConstantVelocity.h"
00039 #include "ArActionJoydrive.h"
00040 #include "ArActionKeydrive.h"
00041 #include "ArActionDeceleratingLimiter.h"
00042 #include "ArActionRatioInput.h"
00043 #include "ArRatioInputKeydrive.h"
00044 #include "ArRatioInputJoydrive.h"
00045 #include "ArRatioInputRobotJoydrive.h"
00046
00047 AREXPORT ArActionGroupInput::ArActionGroupInput(ArRobot *robot)
00048 : ArActionGroup(robot)
00049 {
00050 addAction(new ArActionLimiterTableSensor, 100);
00051 addAction(new ArActionLimiterForwards("Speed Limiter Near",
00052 300, 600, 250),
00053 90);
00054 addAction(new ArActionLimiterForwards("Speed Limiter Far",
00055 300, 1100, 400),
00056 89);
00057 addAction(new ArActionLimiterBackwards, 80);
00058 myInput = new ArActionInput;
00059 addAction(myInput, 70);
00060 }
00061
00062 AREXPORT ArActionGroupInput::~ArActionGroupInput()
00063 {
00064 removeActions();
00065 deleteActions();
00066 }
00067
00068 AREXPORT void ArActionGroupInput::setVel(double vel)
00069 {
00070 myInput->setVel(vel);
00071 }
00072
00073 AREXPORT void ArActionGroupInput::setRotVel(double rotVel)
00074 {
00075 myInput->setRotVel(rotVel);
00076 }
00077
00078 AREXPORT void ArActionGroupInput::deltaHeadingFromCurrent(double delta)
00079 {
00080 myInput->deltaHeadingFromCurrent(delta);
00081 }
00082
00083 AREXPORT void ArActionGroupInput::setHeading(double heading)
00084 {
00085 myInput->setHeading(heading);
00086 }
00087
00088 AREXPORT void ArActionGroupInput::clear(void)
00089 {
00090 myInput->clear();
00091 }
00092
00093 AREXPORT ArActionInput *ArActionGroupInput::getActionInput(void)
00094 {
00095 return myInput;
00096 }
00097
00098 AREXPORT ArActionGroupStop::ArActionGroupStop(ArRobot *robot)
00099 : ArActionGroup(robot)
00100 {
00101 addAction(new ArActionStop, 100);
00102 }
00103
00104 AREXPORT ArActionGroupStop::~ArActionGroupStop()
00105 {
00106 removeActions();
00107 deleteActions();
00108 }
00109
00110
00111 AREXPORT ArActionGroupTeleop::ArActionGroupTeleop(ArRobot *robot)
00112 : ArActionGroup(robot)
00113 {
00114 addAction(new ArActionLimiterTableSensor, 100);
00115 addAction(new ArActionLimiterForwards("Speed Limiter Near",
00116 300, 600, 250),
00117 90);
00118 addAction(new ArActionLimiterForwards("Speed Limiter Far",
00119 300, 1100, 400),
00120 89);
00121 addAction(new ArActionLimiterBackwards, 80);
00122 myJoydrive = new ArActionJoydrive;
00123 myJoydrive->setStopIfNoButtonPressed(false);
00124 addAction(myJoydrive, 70);
00125 addAction(new ArActionKeydrive, 69);
00126 }
00127
00128 AREXPORT ArActionGroupTeleop::~ArActionGroupTeleop()
00129 {
00130 removeActions();
00131 deleteActions();
00132 }
00133
00134 AREXPORT void ArActionGroupTeleop::setThrottleParams(int lowSpeed,
00135 int highSpeed)
00136 {
00137 myJoydrive->setThrottleParams(lowSpeed, highSpeed);
00138 }
00139
00140 AREXPORT ArActionGroupUnguardedTeleop::ArActionGroupUnguardedTeleop(ArRobot *robot)
00141 : ArActionGroup(robot)
00142 {
00143 myJoydrive = new ArActionJoydrive;
00144 myJoydrive->setStopIfNoButtonPressed(false);
00145 addAction(myJoydrive, 70);
00146 addAction(new ArActionKeydrive, 69);
00147 }
00148
00149 AREXPORT ArActionGroupUnguardedTeleop::~ArActionGroupUnguardedTeleop()
00150 {
00151 removeActions();
00152 deleteActions();
00153 }
00154
00155 AREXPORT void ArActionGroupUnguardedTeleop::setThrottleParams(int lowSpeed,
00156 int highSpeed)
00157 {
00158 myJoydrive->setThrottleParams(lowSpeed, highSpeed);
00159 }
00160
00161 AREXPORT ArActionGroupWander::ArActionGroupWander(ArRobot *robot, int forwardVel, int avoidFrontDist, int avoidVel, int avoidTurnAmt)
00162 : ArActionGroup(robot)
00163 {
00164 addAction(new ArActionBumpers, 100);
00165 addAction(new ArActionStallRecover, 90);
00166
00167 addAction(new ArActionAvoidFront("Avoid Front", avoidFrontDist, avoidVel, avoidTurnAmt), 79);
00168 addAction(new ArActionConstantVelocity("Constant Velocity",
00169 forwardVel),
00170 50);
00171
00172 }
00173
00174 AREXPORT ArActionGroupWander::~ArActionGroupWander()
00175 {
00176 removeActions();
00177 deleteActions();
00178 }
00179
00180
00181 AREXPORT ArActionGroupColorFollow::ArActionGroupColorFollow(ArRobot *robot, ArACTS_1_2 *acts, ArPTZ *camera)
00182 : ArActionGroup(robot)
00183 {
00184
00185 addAction(new ArActionLimiterTableSensor, 100);
00186 addAction(new ArActionLimiterForwards("Speed Limiter Near",
00187 300, 600, 250),
00188 90);
00189 addAction(new ArActionLimiterForwards("Speed Limiter Far",
00190 300, 1100, 400),
00191 89);
00192 addAction(new ArActionLimiterBackwards, 80);
00193
00194
00195 myColorFollow = new ArActionColorFollow("Follow a color.", acts, camera);
00196 addAction(myColorFollow, 70);
00197 }
00198
00199
00200 AREXPORT ArActionGroupColorFollow::~ArActionGroupColorFollow()
00201 {
00202 removeActions();
00203 deleteActions();
00204 }
00205
00206
00207 AREXPORT void ArActionGroupColorFollow::setChannel(int channel)
00208 {
00209 myColorFollow->setChannel(channel);
00210 }
00211
00212
00213 AREXPORT void ArActionGroupColorFollow::setCamera(ArPTZ *camera)
00214 {
00215 myColorFollow->setCamera(camera);
00216 }
00217
00218
00219 AREXPORT void ArActionGroupColorFollow::startMovement()
00220 {
00221 myColorFollow->startMovement();
00222 }
00223
00224
00225 AREXPORT void ArActionGroupColorFollow::stopMovement()
00226 {
00227 myColorFollow->stopMovement();
00228 }
00229
00230
00231
00232 AREXPORT void ArActionGroupColorFollow::setAcquire(bool acquire)
00233 {
00234 myColorFollow->setAcquire(acquire);
00235 }
00236
00237
00238 AREXPORT int ArActionGroupColorFollow::getChannel()
00239 {
00240 return myColorFollow->getChannel();
00241 }
00242
00243
00244
00245 AREXPORT bool ArActionGroupColorFollow::getAcquire()
00246 {
00247 return myColorFollow->getAcquire();
00248 }
00249
00250
00251 AREXPORT bool ArActionGroupColorFollow::getMovement()
00252 {
00253 return myColorFollow->getMovement();
00254 }
00255
00256
00257 AREXPORT bool ArActionGroupColorFollow::getBlob()
00258 {
00259 return myColorFollow->getBlob();
00260 }
00261
00262 AREXPORT ArActionGroupRatioDrive::ArActionGroupRatioDrive(ArRobot *robot)
00263 : ArActionGroup(robot)
00264 {
00265
00266
00267
00268
00269 myInput = new ArActionRatioInput;
00270 addAction(myInput, 50);
00271
00272 myKeydrive = new ArRatioInputKeydrive(robot, myInput);
00273 myJoydrive = new ArRatioInputJoydrive(robot, myInput);
00274 myRobotJoydrive = new ArRatioInputRobotJoydrive(robot, myInput);
00275
00276 myDeceleratingLimiterForward = new ArActionDeceleratingLimiter(
00277 "DeceleratingLimiterForward", true);
00278 addAction(myDeceleratingLimiterForward, 40);
00279
00280 myDeceleratingLimiterBackward = new ArActionDeceleratingLimiter(
00281 "DeceleratingLimiterBackward", false);
00282 addAction(myDeceleratingLimiterBackward, 39);
00283
00284
00285 }
00286
00287 AREXPORT ArActionGroupRatioDrive::~ArActionGroupRatioDrive()
00288 {
00289 removeActions();
00290 deleteActions();
00291 }
00292
00293
00294 AREXPORT ArActionRatioInput *ArActionGroupRatioDrive::getActionRatioInput(void)
00295 {
00296 return myInput;
00297 }
00298
00299 AREXPORT void ArActionGroupRatioDrive::addToConfig(ArConfig *config,
00300 const char *section)
00301 {
00302 myInput->addToConfig(config, section);
00303 myDeceleratingLimiterForward->addToConfig(config, section, "Forward");
00304 myDeceleratingLimiterBackward->addToConfig(config, section, "Backward");
00305 }
00306
00307 AREXPORT ArActionGroupRatioDriveUnsafe::ArActionGroupRatioDriveUnsafe(ArRobot *robot)
00308 : ArActionGroup(robot)
00309 {
00310
00311
00312
00313
00314 myInput = new ArActionRatioInput;
00315 addAction(myInput, 50);
00316
00317 myKeydrive = new ArRatioInputKeydrive(robot, myInput);
00318 myJoydrive = new ArRatioInputJoydrive(robot, myInput);
00319 myRobotJoydrive = new ArRatioInputRobotJoydrive(robot, myInput);
00320 }
00321
00322 AREXPORT ArActionGroupRatioDriveUnsafe::~ArActionGroupRatioDriveUnsafe()
00323 {
00324 removeActions();
00325 deleteActions();
00326 }
00327
00328
00329 AREXPORT ArActionRatioInput *ArActionGroupRatioDriveUnsafe::getActionRatioInput(void)
00330 {
00331 return myInput;
00332 }
00333
00334 AREXPORT void ArActionGroupRatioDriveUnsafe::addToConfig(ArConfig *config,
00335 const char *section)
00336 {
00337 myInput->addToConfig(config, section);
00338 }