robot jousting - ptolemy project...sparkfun xbee explorer usb arduino uno microcontroller tenergy...
TRANSCRIPT
![Page 1: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/1.jpg)
Robot JoustingAlexander Cruz, En Lei, Sunil Srinivasan, Darrel Weng
A two-player interactive jousting game involving wheeled robots
![Page 2: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/2.jpg)
Project Goal● Create a physical, interactive ‘jousting’ game using
wheeled robots○ Meet our ‘knights’○ Player knight (Sir Trap of Zoid)○ AI knight (Sir Tri of Angle)
![Page 3: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/3.jpg)
The Game● Two knights constrained to a Game Field will
fight for honor● Each robot has a hitbox, a joust, and 3 ‘lives’
● Last robot standing wins the game!
![Page 4: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/4.jpg)
ImplementationVision
‘Sense’ game field
AI ControlGreedy algorithm
Wiimote ControlBluetooth
AI Bot(User-control option)
Player BotWiimote only
Jousting Robots
![Page 5: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/5.jpg)
Our Setup
Vision
User Control
User Robot
AI/Vision Center
AI Robot
![Page 6: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/6.jpg)
Part I - Robot Knights
![Page 7: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/7.jpg)
Robots: Design● Main Design:
○ Each robot requires a joust and a hitbox (shield)● Modeling game mechanics
○ Power-ups: detection & usehall sensor + magnets
○ Hit box & Life: implementation and actuationpush button + RGB LED on a “shield”
● Control & Hardware○ PWM, serial communication
![Page 8: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/8.jpg)
Robots: State Machine
Hittick’(t) = 1
Playtick’(t) = 0
PwrUPtick’(t) = 1
Inputs: Hit, Pwr: Pure
Outputs: redLED: Pure
Variables: tick, lifeLED
hit/redLEDlifeLED--, tick = 0
tick = 2/!redLED
Pwr/redLEDtick = 0
tick = 4/!redLED
![Page 9: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/9.jpg)
Robots: Hardware Layout
Source: Basic Layout Created using Paintbrush
● Player Knight:○ CZ-HC-05 gomcu Bluetooth boards○ PL2303HX USB To TTL To UART Converter○ FRDM KL25Z mBed○ Radio Shack AA’s
● AI Knight:○ XBee Series 1 radio by DigiKey○ Sparkfun XBee Explorer USB○ Arduino Uno microcontroller○ Tenergy 7.4V 2200mAh Li-Ion Battery
● Shared Hardware:○ Pololu DRV8833 Dual Motor Driver Carrier○ Pololu Adjustable Step-Up/Step-Down Voltage
Regulator S7V8A○ Sunkhee Hall Effect Sensor○ Motors+chassis from Emgreat Motor Robot Kit
● Different hardware because we wanted to explore using mBed and Bluetooth (vs. Arduino experience)
![Page 10: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/10.jpg)
● DC motors from kit produced an unexpectedly huge magnetic field○ rendered “power-up” mechanic infeasible, as hall
sensors would respond to motors○ created significant interference with HC05
communication (mostly resolved)● We originally wanted to use a WiiMote, but it turns out
that the HC05 is programmed to use only SSP...
Robots: Pitfalls
![Page 11: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/11.jpg)
Robot KnightsPlayer Knight AI Knight
![Page 12: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/12.jpg)
Part II - Vision
![Page 13: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/13.jpg)
Vision: Motivation● Our AI knight needs to be able to see!● Forward-mounted camera doesn’t provide
enough information● Overhead camera as part of the field● Shape tracking (markers) to determine robot
position
![Page 14: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/14.jpg)
Vision: System● Image stream from Phillips webcam attached to laptop● OpenCV Python bindings
○ Get contours and orientations of templates○ Grayscale image, thresholded to black/white○ Detect contours in B/W image○ matchShapes to ‘score’ contours for matches○ Relative orientation (from template) by angle subtraction modulo
360 (orientation of a contour determined by vector from centroid to center of minimal enclosing circle)
○ Accounts for noise and tiny shape match errors● “ShapeTracker” class/interface for use by other components● Here’s an example of what the system sees…
![Page 15: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/15.jpg)
Vision: ExampleTemplates, B/W image
Source: Images generated by hand, ShapeTracker program
![Page 16: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/16.jpg)
Vision: Issues● 180° problem
○ Moments - shape descriptors○ Can only determine orientation of major axis of shape○ Naive method worked better (centroid to enclosing
circle center)● Contour parents matching incorrectly
○ Discarded any contours with children (only the children were examined) - works for our simple shapes
![Page 17: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/17.jpg)
Part III - AI
![Page 18: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/18.jpg)
AI: Greedy Algorithm● Our AI uses a greedy/aggressive behavior
algorithm that directs the AI knight to actively pursue and try to hit the player knight
● We model our algorithm using a state machine framework coded in Python
![Page 19: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/19.jpg)
AI: Inputs● The vector orientations of both robots (from
vision module)● The relative angles of the vector orientations
of the robots (calculated)● The distance between the two robots
(calculated)
![Page 20: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/20.jpg)
AI: Output● The next move command for the AI knight● Possible moves
○ “Go Forward”○ “Rotate/Turn Left in Place”○ “Rotate/Turn Right in Place”○ “Stop”
![Page 21: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/21.jpg)
AI: Evaluation ● Use the given inputs to calculate the relative
position and orientation of the player knight with respect to the AI knight
● In general, pursue the player knight○ E.g. if the user is to the left, AI turns left; if the user is
in front, AI goes forward
![Page 22: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/22.jpg)
AI: Evaluation● The one special case is when the AI bot is in
the potential hit zone of the user bot
Source: Created using Paintbrush
![Page 23: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/23.jpg)
AI: Evaluation - If the AI finds itself in the hit zone, it adjusts
its orientation so its joust is pointing towards the scoring region.
Source: Created using Paintbrush
![Page 24: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/24.jpg)
AI: State Machine Diagram
Source: Created using LaTex, TikZ package
![Page 25: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/25.jpg)
AI: Demonstration● Determine desired
location○ Path to location○ Position joust
appropriately
![Page 26: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/26.jpg)
Full Demonstration● We’ll have a demo
later today!● Here’s a video in
the meantime● Try not to snicker
![Page 27: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/27.jpg)
References● OpenCV
○ http://opencv.org/● Python
○ http://python.org/● Anaconda by Continuum Analytics
○ http://store.continuum.io/cshop/anaconda/○ Python distribution, NumPy
● ARM mBed○ http://developer.mbed.org/
● Arduino○ http://arduino.cc/
![Page 28: Robot Jousting - Ptolemy Project...Sparkfun XBee Explorer USB Arduino Uno microcontroller Tenergy 7.4V 2200mAh Li-Ion Battery Shared Hardware: Pololu DRV8833 Dual Motor Driver Carrier](https://reader036.vdocuments.mx/reader036/viewer/2022062610/611621c9239429349049d13b/html5/thumbnails/28.jpg)
Questions/Comments?