|
| 1 | +# CozmoLetsRobot |
| 2 | +Host Anki Cozmo on LetsRobot.tv |
| 3 | + |
| 4 | +## Pre-setup |
| 5 | + |
| 6 | +### install socketIO-client for python3 |
| 7 | +pip3 install socketIO-client configparser |
| 8 | + |
| 9 | +## Setup instructions: |
| 10 | + |
| 11 | +Setup the Cozmo SDK on your computer using their instructions: |
| 12 | + |
| 13 | +* http://cozmosdk.anki.com/docs/initial.html#installation |
| 14 | + |
| 15 | +Clone Nocturnal's fork of the runmyrobot scripts: |
| 16 | + |
| 17 | +* git clone https://github.com/Nocturnal42/runmyrobot.git |
| 18 | + |
| 19 | +Edit runmyrobot/letsrobot.sample.conf: |
| 20 | + |
| 21 | +* Enter your owner, robot_id, camera_id from LetsRobot.tv |
| 22 | +* change [robot] `type=none` to `type=cozmo` |
| 23 | +* change [tts] `type=none` to `type=cozmo_tts` |
| 24 | +* Save file as letsrobot.conf |
| 25 | + |
| 26 | +## Extra Mac setup instructions: |
| 27 | +## install ffmpeg: |
| 28 | +brew install ffmpeg |
| 29 | + |
| 30 | +## Starting Cozmo: |
| 31 | + |
| 32 | +* Using the Cozmo app enter SDK mode and connect your mobile device to the host machine. |
| 33 | +* Execute the LetsRobot controller using `python3 controller.py` |
| 34 | +* For audio streaming execute python send_video.py YOURCAMERAID 0 --no-camera & |
| 35 | + |
| 36 | +## Update the Let's Robot robot configuration to have these custom controls: |
| 37 | +Please see [Customizing Your UI](https://letsrobot.readme.io/docs/customizing-your-ui) for more help |
| 38 | +``` |
| 39 | +[ |
| 40 | + { |
| 41 | + "button_panels":[ |
| 42 | + { |
| 43 | + "button_panel_label":"movement controls", |
| 44 | + "buttons":[ |
| 45 | + { |
| 46 | + "label":"Left", |
| 47 | + "command":"L" |
| 48 | + }, |
| 49 | + { |
| 50 | + "label":"Right", |
| 51 | + "command":"R" |
| 52 | + }, |
| 53 | + { |
| 54 | + "label":"Forward", |
| 55 | + "command":"F" |
| 56 | + }, |
| 57 | + { |
| 58 | + "label":"Backward", |
| 59 | + "command":"B" |
| 60 | + }, |
| 61 | + { |
| 62 | + "label":"LookUp", |
| 63 | + "command":"Q" |
| 64 | + }, |
| 65 | + { |
| 66 | + "label":"LookDown", |
| 67 | + "command":"A" |
| 68 | + }, |
| 69 | + { |
| 70 | + "label":"LiftUp", |
| 71 | + "command":"W" |
| 72 | + }, |
| 73 | + { |
| 74 | + "label":"LiftDown", |
| 75 | + "command":"S" |
| 76 | + }, |
| 77 | + { |
| 78 | + "label":"LightToggle", |
| 79 | + "command":"V" |
| 80 | + } |
| 81 | + ] |
| 82 | + }, |
| 83 | + { |
| 84 | + "button_panel_label":"animation controls", |
| 85 | + "buttons":[ |
| 86 | + { |
| 87 | + "label":"drat", |
| 88 | + "command":"0" |
| 89 | + }, |
| 90 | + { |
| 91 | + "label":"giggle", |
| 92 | + "command":"1" |
| 93 | + }, |
| 94 | + { |
| 95 | + "label":"wow", |
| 96 | + "command":"2" |
| 97 | + }, |
| 98 | + { |
| 99 | + "label":"tick tock", |
| 100 | + "command":"3" |
| 101 | + }, |
| 102 | + { |
| 103 | + "label":"ping pong", |
| 104 | + "command":"4" |
| 105 | + }, |
| 106 | + { |
| 107 | + "label":"meow", |
| 108 | + "command":"5" |
| 109 | + }, |
| 110 | + { |
| 111 | + "label":"wufwuf", |
| 112 | + "command":"6" |
| 113 | + }, |
| 114 | + { |
| 115 | + "label":"lookup", |
| 116 | + "command":"7" |
| 117 | + }, |
| 118 | + { |
| 119 | + "label":"excite", |
| 120 | + "command":"8" |
| 121 | + }, |
| 122 | + { |
| 123 | + "label":"backup", |
| 124 | + "command":"9" |
| 125 | + } |
| 126 | + ] |
| 127 | + }, |
| 128 | + { |
| 129 | + "button_panel_label":"say something cute", |
| 130 | + "buttons":[ |
| 131 | + { |
| 132 | + "label":"hello", |
| 133 | + "command":"sayhi" |
| 134 | + }, |
| 135 | + { |
| 136 | + "label":"watch this", |
| 137 | + "command":"saywatch" |
| 138 | + }, |
| 139 | + { |
| 140 | + "label":"love you", |
| 141 | + "command":"saylove" |
| 142 | + }, |
| 143 | + { |
| 144 | + "label":"bye", |
| 145 | + "command":"saybye" |
| 146 | + }, |
| 147 | + { |
| 148 | + "label":"happy", |
| 149 | + "command":"sayhappy" |
| 150 | + }, |
| 151 | + { |
| 152 | + "label":"sad", |
| 153 | + "command":"saysad" |
| 154 | + }, |
| 155 | + { |
| 156 | + "label":"howru", |
| 157 | + "command":"sayhowru" |
| 158 | + } |
| 159 | + ] |
| 160 | + }, |
| 161 | + { |
| 162 | + "button_panel_label":"more fun stuff", |
| 163 | + "buttons":[ |
| 164 | + { |
| 165 | + "label":"singsong", |
| 166 | + "command":"singsong", |
| 167 | + "premium":true, |
| 168 | + "price":1000000 |
| 169 | + }, |
| 170 | + { |
| 171 | + "label":"lightcubes", |
| 172 | + "command":"lightcubes", |
| 173 | + "premium":true, |
| 174 | + "price":0 |
| 175 | + }, |
| 176 | + { |
| 177 | + "label":"dimcubes", |
| 178 | + "command":"dimcubes", |
| 179 | + "premium":true, |
| 180 | + "price":0 |
| 181 | + } |
| 182 | + ] |
| 183 | + } |
| 184 | + ] |
| 185 | + } |
| 186 | +] |
| 187 | +``` |
| 188 | + |
| 189 | +## Cozmo Chat Commands |
| 190 | +In addition to the standard chat commands, Cozmo has several specific chat commands available to the owner. You can type these into the chat box on the robot page. |
| 191 | + |
| 192 | +* `.anim NAME` this will play the NAME animation. |
| 193 | +* `.forward_speed ###` this will allow you to adjust how fast Cozmo moves forward / backwards. |
| 194 | +* `.turn_speed ###` this will adjust how far Cozmo turns left and right. |
| 195 | +* `.vol ###` This turns Cozmos volume up or down [0...100]. |
| 196 | +* `.charge X' If Cozmo is on the dock, force the changin g state. If Cozmo is off the dock, mark the charging state to start as soon as Cozmo docks [on|off]. |
| 197 | +* `.stay X` Set Cozmo to stay locked in the dock, regardless of charge state [on|off]. |
| 198 | +* `.annotate` Enable / Disable the annotated view, to see what Cozmo is seeing. |
| 199 | +* `.color` or `.colour` Enable / Disable colour. Colour reduces the resolution of the video. |
| 200 | + |
| 201 | +## Note for audio streaming on MacOS: |
| 202 | + |
| 203 | +The `startAudioCaptureLinux` function in send_video.py calls ffmpeg with alsa input. If you want to stream audio from your mac use `-f avfoundation -i ":0"` in place of `-f alsa -ar 44100 -ac %d -i hw:%d`. |
| 204 | + |
| 205 | +For example: |
| 206 | + |
| 207 | +`audioCommandLine = '/usr/local/bin/ffmpeg -f avfoundation -i ":0" -f mpegts -codec:a mp2 -b:a 128k -muxdelay 0.001 http://%s:%s/%s/640/480/' % (audioHost, audioPort, robotSettings.stream_key)` |
0 commit comments