main.cc

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <libplayerc++/playerc++.h>
00003 
00004 #include <scorpion.h>
00005 
00006 int
00007 main(int argc, char *argv[])
00008 {
00009    using namespace PlayerCc;
00010 
00011    PlayerClient robot("localhost");
00012    BumperProxy bp(&robot, 1);
00013 
00014    while (true) {
00015       robot.Read();
00016 
00017       if (!bp.IsAnyBumped()) {
00018          printf("None of the %d sensors were bumped\n",
00019                bp.GetCount());
00020          continue;
00021       }
00022 
00023       bool first = true;
00024       for (size_t i = 0; i < bp.GetCount(); i++) {
00025          const char *name;
00026 
00027          if (!bp.IsBumped(i))
00028             continue;
00029 
00030          printf("%s%s", first ? "" : ", ",
00031                scorpion_ir_range_name(i));
00032          first = false;
00033       }
00034 
00035       printf(" was bumped\n");
00036    }
00037 }

Generated on Sat Jan 13 03:11:09 2007 for ERSP Player driver by  doxygen 1.5.1