{"id":74,"date":"2015-08-31T21:48:27","date_gmt":"2015-08-31T21:48:27","guid":{"rendered":"http:\/\/www.hardwarehacker.co.uk\/blog\/?p=74"},"modified":"2015-09-01T13:49:18","modified_gmt":"2015-09-01T13:49:18","slug":"manual-control","status":"publish","type":"post","link":"https:\/\/www.hardwarehacker.co.uk\/blog\/manual-control\/","title":{"rendered":"Manual Control"},"content":{"rendered":"<p>I saw recantha&#8217;s <a href=\"http:\/\/www.recantha.co.uk\/blog\/?p=13245\">post<\/a>\u00a0pointing people at Brian Corteil&#8217;s <a href=\"http:\/\/www.corteil.co.uk\/Blog\/raspberry-pi\/methods-for-controlling-your-robot\/\">post<\/a> on how to control your robot and was surprised to see that the method I used\u00a0for Metabot last year\u00a0wasn&#8217;t\u00a0listed. \u00a0So the obvious thing to do is to document it\u00a0here, right? \ud83d\ude42<\/p>\n<p><strong>Our method: <\/strong><\/p>\n<ul>\n<li>Connect a cheap USB wifi dongle to the Pi<\/li>\n<li><a href=\"http:\/\/elinux.org\/RPI-Wireless-Hotspot\">Set the Pi up as a WiFi access point<\/a><\/li>\n<li>Connect a laptop to the Pi&#8217;s access point<\/li>\n<li>Connect an <a href=\"http:\/\/www.ebay.co.uk\/sch\/Controllers-\/117042\/i.html?_nkw=xbox%20360%20wired%20controller&amp;rt=nc&amp;LH_BIN=1&amp;_trksid=p2045573.m1684\">xbox 360 joypad<\/a>\u00a0to the laptop<\/li>\n<li>Write the\u00a0robot&#8217;s controlling python script &#8211; it listens for TCP on a port<\/li>\n<li>The laptop runs a very simple pygame script which listens for joystick inputs:\n<ul>\n<li>These come into the script from the Pygame library as a dictionary.<\/li>\n<li>The script then converts this dictionary to JSON (using the python json library)<\/li>\n<li>and sends the JSON\u00a0over TCP to the IP address\/port that\u00a0the robot is listening on<\/li>\n<li>The robot then converts the JSON back into a dictionary and reads the joystick values out of it.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Note that if you want an easy control method, I do NOT\u00a0recommend our one &#8211; it can be a pain to set up the wifi access point and the method you use depends on the chipset of the WiFi dongle you have.<\/p>\n<p>Instead, <strong>I recommend the bluetooth\/wiimote method<\/strong>:\u00a0<a style=\"line-height: 1.6471;\" href=\"https:\/\/www.cl.cam.ac.uk\/projects\/raspberrypi\/tutorials\/robot\/wiimote\/\">this tutorial<\/a><span style=\"line-height: 1.6471;\"> explains it better than I can and with code examples too. \u00a0My experience with bluetooth dongles and wiimotes is that Genuine Nintendo wiimotes are required &#8211; I tried using a cheap knockoff wiimote and it wouldn&#8217;t pair with the dongle, but my genuine ones worked fine.<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I saw recantha&#8217;s post\u00a0pointing people at Brian Corteil&#8217;s post on how to control your robot and was surprised to see that the method I used\u00a0for Metabot last year\u00a0wasn&#8217;t\u00a0listed. \u00a0So the obvious thing to do is to document it\u00a0here, right? \ud83d\ude42 Our method: Connect a cheap USB wifi dongle to the Pi Set the Pi up &hellip; <a href=\"https:\/\/www.hardwarehacker.co.uk\/blog\/manual-control\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Manual Control<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[2],"_links":{"self":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts\/74"}],"collection":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":2,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hardwarehacker.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}