From MCP Robot -- UMass Lowell Computer Science

Main: LRF

Laser Range Finder (LRF)

#include <iostream>
#include <libplayerc++/playerc++.h>

/*
 g++ -o try_laser `pkg-config --cflags playerc++` try_laser.cpp `pkg-config --libs playerc++`

*/

int
main(int argc, char *argv[])
 {
  using namespace PlayerCc;
  double r1, r2, r3;

  PlayerClient    robot("localhost");
 //  SonarProxy      sp(&robot,0);
 //  Position2dProxy pp(&robot,0);
  LaserProxy lsp(&robot,0);

  for(;;)
  {
    // read from the proxies
    robot.Read();
    r1 = lsp.GetRange(100);
    r2 = lsp.GetRange(200);
    r3 = lsp.GetRange(300);
    // print out data
    std::cout << r1 << " " << r2 << " " << r3 << std::endl;
  }
 }
Retrieved from http://www.cs.uml.edu/mcprobot/pmwiki.php/Main/LRF
Page last modified on April 11, 2007, at 01:08 AM