/usr/src/rpm/BUILD/libirobot-create-0.1/tests/drive-direct-command-test.cc File Reference

#include "common.hh"

Include dependency graph for drive-direct-command-test.cc:


Functions

int run_test (iRobot::Create &robot, std::stringstream &)

Function Documentation

int run_test ( iRobot::Create robot,
std::stringstream &   
)

00022 {
00023   using namespace iRobot;
00024 
00025   // Test Mode.
00026   CHECK_FAILURE
00027     (CommandNotAvailable,
00028      robot.sendDriveDirectCommand
00029      (Create::VELOCITY_MIN, Create::VELOCITY_MIN));
00030 
00031   // Switch to full mode and test a command.
00032   robot.sendFullCommand ();
00033   robot.sendDriveDirectCommand (Create::VELOCITY_MIN, Create::VELOCITY_MIN);
00034 
00035   // Switch to safe mode for the rest of the test.
00036   robot.sendSafeCommand ();
00037 
00038   // Test valid commands (bounds)
00039   int vmean = (Create::VELOCITY_MAX - Create::VELOCITY_MIN) / 2;
00040   robot.sendDriveCommand (vmean, vmean);
00041   robot.sendDriveDirectCommand (Create::VELOCITY_MIN, Create::VELOCITY_MIN);
00042   robot.sendDriveDirectCommand (Create::VELOCITY_MIN, Create::VELOCITY_MAX);
00043   robot.sendDriveDirectCommand (Create::VELOCITY_MAX, Create::VELOCITY_MIN);
00044   robot.sendDriveDirectCommand (Create::VELOCITY_MAX, Create::VELOCITY_MAX);
00045 
00046   // Check velocity minimum - 1.
00047   CHECK_FAILURE
00048     (InvalidArgument,
00049      robot.sendDriveDirectCommand (Create::VELOCITY_MIN - 1,
00050                                    Create::VELOCITY_MAX / 4));
00051 
00052   // Check velocity maximum + 1.
00053   CHECK_FAILURE
00054     (InvalidArgument,
00055      robot.sendDriveDirectCommand (Create::VELOCITY_MAX + 1,
00056                              Create::VELOCITY_MAX / 4));
00057 
00058   // Check radius minimum - 1.
00059   CHECK_FAILURE
00060     (InvalidArgument,
00061      robot.sendDriveDirectCommand (Create::VELOCITY_MAX / 4,
00062                              Create::VELOCITY_MIN - 1));
00063 
00064   // Check radius maximum + 1.
00065   CHECK_FAILURE
00066     (InvalidArgument,
00067      robot.sendDriveDirectCommand (Create::VELOCITY_MAX / 4,
00068                              Create::VELOCITY_MAX + 1));
00069 
00070   return TEST_SUCCEED;
00071 }


Generated on Thu Aug 28 14:38:07 2008 for iRobot Create library by  doxygen 1.5.4