{"id":8300,"date":"2015-07-22T09:15:04","date_gmt":"2015-07-22T16:15:04","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=8300"},"modified":"2021-06-16T16:13:27","modified_gmt":"2021-06-16T23:13:27","slug":"jousting-robots-wiring-and-labview-code","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/jousting-robots-wiring-and-labview-code\/","title":{"rendered":"Jousting Robots &#8211; Wiring and LabVIEW Code"},"content":{"rendered":"<p>In preparation for NI week, Josh and I decided to create jousting robots! We used\u00a0<a href=\"http:\/\/www.ni.com\/labview\/\" target=\"_blank\" rel=\"noopener\">LabVIEW<\/a>, <a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?NavPath=2,892,1193&amp;Prod=CHIPKIT-WF32\" target=\"_blank\" rel=\"noopener\">chipKIT WF32<\/a>, <a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=libraries:linx:start\" target=\"_blank\" rel=\"noopener\">LabVIEW MakerHub LINX<\/a>, a force sensor, a <a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?Prod=PMOD-ACL\" target=\"_blank\" rel=\"noopener\">PmodACL <\/a>to read acceleration values, a <a href=\"https:\/\/digilent.com\/blog\/Products\/Detail.cfm?Prod=PMOD-JSTK\" target=\"_blank\" rel=\"noopener\">PmodJSTK <\/a>to control the angle of the mini servo, a mini servo that holds the lance, and two continuous servos for the wheels. \u00a0The general\u00a0idea for this project\u00a0was to create a robot that could be controlled over WiFi and send data back to LabVIEW. \u00a0The <a href=\"https:\/\/digilent.com\/shop\/labview-physical-computing-kit-with-chipkit-wf32\/\" target=\"_blank\" rel=\"noopener\">LabVIEW Physical Computing Kit<\/a> which includes <a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\" target=\"_blank\" rel=\"noopener\">LabVIEW Home Bundle<\/a> and chipKIT WF32 can be used for this project. \u00a0Behold our brave knight:<\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-8331 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot-600x448.png\" alt=\"JoustingRobot\" width=\"600\" height=\"448\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot-600x448.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot-1024x765.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot-225x168.png 225w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot-800x598.png 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>I created an Instructable on wiring all of the parts of the robot and an Instructable that provides in-depth LabVIEW code walk-through while Josh created an Instructable on assembling the different parts of the robots.<\/p>\n<p>&nbsp;<\/p>\n<p>In my wiring guide, I go over how I received an analog reading from the force sensor using a voltage divider, how I wired <a href=\"https:\/\/learn.blog.digilentinc.com\/Documents\/405\" target=\"_blank\" rel=\"noopener\">I2C communication<\/a> between the PmodACL and the WF32, how I wired <a href=\"https:\/\/learn.blog.digilentinc.com\/Documents\/403\" target=\"_blank\" rel=\"noopener\">SPI communication<\/a> between the PmodJSTK and the WF32, and how I wired all of the different servos to the WF32. \u00a0Once everything is connected, the robot looks like this:<\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/IMG_1086.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-8330 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/IMG_1086-600x448.jpg\" alt=\"IMG_1086\" width=\"600\" height=\"448\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/IMG_1086-600x448.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/IMG_1086-1024x765.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/IMG_1086-225x168.jpg 225w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>My other Instructable is a step-by-step explanation of my LabVIEW code. \u00a0Basically, there is\u00a0a setup state where you set the angle of the &#8220;lance&#8221; mounted on the mini\u00a0servo using the Pmod Joystick. Once a button on the PmodJSTK was pushed, the robot enters a running state. In this state the servo motors run until a force is sensed or if the robot is\u00a0picked up. Once the robot is\u00a0picked up, the state resets back to the setup state unless there have been 3 jousting rounds, in which case, the jousting session ends.<\/p>\n<p>&nbsp;<\/p>\n<p>Each\u00a0robot has three hit-points to start with and each time during the running state if the force goes over a certain value, the hit-points decrease by one. If the hit-points decrease to zero, the jousting session will end. \u00a0Below is a picture of my completed LabVIEW code. \u00a0Check out the Instructable to see how the other states are coded.<\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/servojoustd.png\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-8304 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/servojoustd-600x212.png\" alt=\"servojoustd\" width=\"600\" height=\"212\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/servojoustd-600x212.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/servojoustd-1024x363.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/servojoustd-225x80.png 225w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Interested in our jousting robots? Check out all three of our Instructables (<a href=\"http:\/\/www.instructables.com\/id\/Building-Jousting-Robots\/\" target=\"_blank\" rel=\"noopener\">1<\/a>, <a href=\"http:\/\/www.instructables.com\/id\/Jousting-Robot-Wiring-Tutorial\/\" target=\"_blank\" rel=\"noopener\">2<\/a>, <a href=\"http:\/\/www.instructables.com\/id\/Jousting-Robot-LabVIEW-Code\/\" target=\"_blank\" rel=\"noopener\">3<\/a>) to see how to assemble the parts, wire the robots, and control them with the LabVIEW code given in my coding Instructable. \u00a0Feel free to explore what other functionalities you can add by adding to the LabVIEW code and\/or adding more Pmods.<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-8300 jlk' data-task='like' data-post_id='8300' data-nonce='d8c4d58d14' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-8300 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-8300 jlk' data-task='unlike' data-post_id='8300' data-nonce='d8c4d58d14' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-8300 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-8300 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Long for the knights of old, but with the technology of new? Well trifle no longer, for in preparation for NI week, Josh and I decided to create jousting robots!<\/p>\n","protected":false},"author":33,"featured_media":8331,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[38,4323,1561],"tags":[144],"ppma_author":[4481],"class_list":["post-8300","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-expansion-modules","category-software","category-applications","tag-tutorial-2"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2015\/07\/JoustingRobot.png","jetpack_sharing_enabled":true,"authors":[{"term_id":4481,"user_id":33,"is_guest":0,"slug":"sudharsan-sukumar","display_name":"Sudharsan Sukumar","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/a14d4c855a4738a3b7d04f48ab9936a38ea5a056ea75b4761a407b53dac5597b?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/8300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=8300"}],"version-history":[{"count":0,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/8300\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/8331"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=8300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=8300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=8300"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=8300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}