1 / 38

Introduction to Player and Create Robots

Introduction to Player and Create Robots. Monica Anderson, The University of Alabama Jeff Forbes, Duke University. Agenda. Intro to player Create a client program Richard Tapia Competition Camera information. Objectives. Exposure to Player/Stage Practice programming Creates

orli
Download Presentation

Introduction to Player and Create Robots

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Player and Create Robots Monica Anderson, The University of Alabama Jeff Forbes, Duke University

  2. Agenda • Intro to player • Create a client program • Richard Tapia Competition • Camera information

  3. Objectives • Exposure to Player/Stage • Practice programming Creates • Head start on Tapia competition • Teaching resources for your students • Knowledge of additional resources

  4. Demo of Competition Capable Robots • SmURV platform (instructions on Tapia site) • Capability • Camera • Touch sensors • Cost • Original version ~ $8i00 • Mac version ~ $900 • Laser is $2500 • IPRE Scribbler $150! • Camera • IR range sensors

  5. Demo of Competition Capable Robots • TideBot (instructions on robotics.cs.ua.edu) • Capability – 4 range sensors • Cost • UMPC (Asus eee PC) $300+ • Ultrasonic sensors - $125 • Camera - $100

  6. Workshop Requirements • Laptop with VMPlayer or booted from live CD • Internet access for player documentation and to download sample code • Create wired to laptop either via serial or usb • Copy of slides in powerpoint or pdf format • USB drive  virtual machines do not save data after turned off; save to USB drive

  7. Introduction to Player • System of programs designed to control a real or simulated robot • Open source • Compiles on X Windows computers (Linux, Mac OS X, etc)

  8. Player • Player interfaces directly with robots to create a common interface • Parameter file (cfg) tells player what a robot can do Player simple.cfg

  9. Player cfg file • Robot name – robot type driver ( name "roomba" provides ["position2d:0" "power:0" "bumper:0"] port "/dev/ttyUSB0" safe 1 )

  10. Player cfg file • Provides list tells the hardware available on robot driver ( name "roomba" provides ["position2d:0" "power:0" "bumper:0"] port "/dev/ttyUSB0" safe 1 )

  11. Player cfg file • Position2d – interface that moves the robot • Takes robot movement commands in forward speed (meters per second) and turn speed (radians per second) • Gives estimate of position in x, y, and θ position relative to where the robot was when it was turned on driver ( name "roomba" provides ["position2d:0" "power:0" "bumper:0"] port "/dev/ttyUSB0" safe 1 )

  12. Player cfg file • Bumper – gives the state of the bumpers • Left and/or right can be triggered driver ( name "roomba" provides ["position2d:0" "power:0" "bumper:0"] port "/dev/ttyUSB0" safe 1 )

  13. Run player (15 minutes) • Exercise – • Load the virtual machine that runs player • Connect the robot to the computer via usb or serial • Start player • Run playerjoy (program to use keyboard as a joystick) • Run playerprint to see the bumper information

  14. Load the virtual machine • Option 1: If your laptop can boot from a DVD, boot from the DVD • Option 2: Use VMPlayer to load the DVD image • You will need to download VMPlayer • You will need the file livecd.vmx and livecd.iso in the same directory • Install VMPlayer and open the livecd.vmx. It will find the livecd.iso and load it in a window • Userid: tapia Password: Bubbah0+ep

  15. Connect robot to computer • Option 1: If your computer has a serial connection, connect the white cable to the serial port and the other end to the create • Option 2: If your computer does not have a serial port, use the blue usb to serial cable to connect the white cable to your computer.

  16. Connect robot to virtual machine Mouse over the USB symbols at the bottom of the screen. Select the symbol that represents your robot connection to connect the device to the virtual machine

  17. Determine connection name Double-click terminal on Desktop to get command prompt. Enter sudo dmesg|tail Look for the device name at the bottom. Should be ttyUSBn where n is a number. ** Edit roomba.cfg so that this name appears gedit realworld/roomba.cfg

  18. Start player Double-click terminal on Desktop to get command prompt. Enter player realworld/roomba.cfg.

  19. Run playerjoy and move the robot Double-click terminal on Desktop to get command prompt. Enter playerjoy.

  20. Run playerprint to see bumpers change -h localhost //current computer -p 6665 //6665 is the default port -i 0 //index of the device; can have multiple devices of the same type bumper //name of the device to print

  21. Notes • We ran two programs • player interfaces with the robot; takes commands from the client program • playerjoy is the client program that has the logic • We used one configuration file, roomba.cfg **Need to make programs allow the robot to react to data autonomously

  22. Creating C++ client programs Program structure Setup connection to robot Initialize interfaces to hardware while keep_going Read state of sensors Think about reaction Send commands to the motors

  23. Program initialization • Create instances of robot and its sensors #include <iostream> #include <libplayerc++/playerc++.h> int main(int argc, char *argv[]) { using namespace PlayerCc; PlayerClient robot("localhost"); // BumperProxy bp(&robot,0); Position2dProxy pp(&robot,0); pp.SetMotorEnable(true);

  24. Control Loop for(;;) { double turnrate, speed; robot.Read(); // read from the proxies std::cout << bp << std::endl; // print out bumpers for fun std::cout << pp << std::endl; // print out bumpers for fun if(bp[0] || bp[1]) { //at least one of the bumpers is pressed speed=-.1; if (bp[0] && !bp[1]) turnrate=dtor(-10); if (!bp[0] && bp[1]) turnrate=dtor(10); if (bp[0] && bp[1]) turnrate=dtor(-10); } else { turnrate = 0; // turn 20 degrees per second speed=.1; } pp.SetSpeed(speed, turnrate); }//end of for loop }//end of main function

  25. Interfaces – Position http://playerstage.sourceforge.net/doc/Player-2.0.0/player/classPlayerCc_1_1Position2dProxy.html

  26. Interfaces – Bumper • bp[n]=0 when not pressed; bp[n]=1 when pressed • Other methods from http://playerstage.sourceforge.net/doc/Player-2.0.0/player/classPlayerCc_1_1BumperProxy.html

  27. Compiling programs • Needs to have access to player client libraries g++ -o example `pkg-config --cflags playerc++` example.cc `pkg-config --libs playerc++` Note that there is a difference between ` and ‘. The symbol in the command above is the tick that is slanted, not the tick on the key with the double quotes.

  28. Create a client program (15 minutes) • Grab the sample file from the website or type it in http://robotics.cs.ua.edu/media/example.cc • Compile the program and test it • Run player using player realworld/roomba.cfg • Run the client program using ./example • Make changes to the program so the robot does a better job with avoiding obstacles • To edit program: gedit example.cc

  29. Tapia Robotics Competition • Qualification is in simulation • Competition is on the actual robots

  30. Player with Stage • Stage is a simulation environment that can be used with player • Different cfg file

  31. Player with Stage • Stage is a simulation environment that can be used with player • Additional file to describe simulated world • Includes physical model and capabilities of robot(s) • Includes a bitmap for determining where obstacles are • Includes scaling factors for bitmap (meters per pixel) • Includes other items in environment • Look at Sim_2_1_1/tapia_sample.world

  32. Run tapia simulation (10 minutes) • Load player with new cfg file player Sim_2_1_1/tapia_sample.cfg • Load sample program designed to work with simulation .Sim_2_1_1/sonar • Look at the client code gedit Sim_2_1_1/sonarobstacleavoid.cc Bumper proxy is not implemented in stage yet

  33. Note: new sensor • New interface SonarProxy in simulation • Gives distance without contact • Can be added to robot for about $125 • Parts list and assembly instructions available http://robotics.cs.ua.edu/media/Roomba_Sonar.pdf

  34. Camera interface • Tapia competition requires identification of colored markers in the environment • Uses BlobfinderProxy • Simulated in stage through tapia_sample.cfg/tapia_sample.world • Try adding the initialization BlobfinderProxy bf(&robot,0); • Print using std::cout << bf << std::endl;

  35. Camera Interface • Real cameras supported in player • Recommend Logitech Quickcam Pro 9000 • Player will take the images from the camera and return color blob data to the client program

  36. References • Player/Stage documentation http://playerstage.sourceforge.net/index.php?src=doc • Live CD files • Document directory iRobot documentation • realworld directory programs/cfg for actual robot • Sim_2_1_1 Tapia cfg/sample code for qualification

  37. Competition hardware • Create provides movement and obstacle sensing via bump sensors • Other additions: • May want to add range sensing; better not to hit things • Need camera to identify markers

  38. Off Topic • CCLI project to integrate Alice with Creates • Program Creates using Alice • Stem tide of mass exodus from major after entry-level classes • Practice sequence, selection, iteration • Logic only; no syntax • Can be used with students with no programming

More Related