| … | … | @@ -0,0 +1,7 @@ |
| 1 | version: 2 | |
| 2 | ||
| 3 | updates: | |
| 4 | - package-ecosystem: "github-actions" | |
| 5 | directory: "/" | |
| 6 | schedule: | |
| 7 | interval: "weekly" |
| … | … | @@ -0,0 +1,33 @@ |
| 1 | # Disabled, April 2024 | |
| 2 | # Both this and publish-images.yml build the same docker containers. | |
| 3 | # We don't need to do this twice. Since that one also publishes the | |
| 4 | # containers to dockerhub, disable this script by renaming it to | |
| 5 | # `ci.xxx-yml-xxx` and hopefully that is enough to do the trick. | |
| 6 | # Keep this here, for now, "just in case". -- Linas April 2024 | |
| 7 | ||
| 8 | name: CI | |
| 9 | ||
| 10 | on: | |
| 11 | pull_request: | |
| 12 | branches: [ "master" ] | |
| 13 | paths: | |
| 14 | - "opencog/**" | |
| 15 | - ".github/workflows/**" | |
| 16 | push: | |
| 17 | branches: [ "master" ] | |
| 18 | paths: | |
| 19 | - "opencog/**" | |
| 20 | - ".github/workflows/**" | |
| 21 | workflow_dispatch: | |
| 22 | ||
| 23 | jobs: | |
| 24 | build_opencog_images: | |
| 25 | name: Build opencog images | |
| 26 | runs-on: ubuntu-22.04 | |
| 27 | steps: | |
| 28 | - name: Checkout current repo | |
| 29 | uses: actions/checkout@v4 | |
| 30 | ||
| 31 | - name: Build all opencog images | |
| 32 | working-directory: opencog | |
| 33 | run: ./docker-build.sh -bsl |
| … | … | @@ -0,0 +1,152 @@ |
| 1 | name: Publish images | |
| 2 | ||
| 3 | on: | |
| 4 | pull_request: | |
| 5 | branches: [ "master" ] | |
| 6 | paths: | |
| 7 | - "opencog/**" | |
| 8 | - ".github/workflows/**" | |
| 9 | push: | |
| 10 | branches: [ "master" ] | |
| 11 | paths: | |
| 12 | - "opencog/**" | |
| 13 | - ".github/workflows/**" | |
| 14 | schedule: | |
| 15 | - cron: "37 2 * * 6" # Run 2:37 AM Saturday night. `man 5 crontab` | |
| 16 | workflow_dispatch: | |
| 17 | ||
| 18 | jobs: | |
| 19 | ||
| 20 | # The job is called "base-images". | |
| 21 | # The Dockerfile is located in the directory opencog/base | |
| 22 | # -- this is the "context" | |
| 23 | # The name of the docker image is opencog/opencog-deps:latest | |
| 24 | base-images: | |
| 25 | runs-on: ubuntu-24.04 | |
| 26 | steps: | |
| 27 | - name: Checkout current repo | |
| 28 | uses: actions/checkout@v6 | |
| 29 | ||
| 30 | - name: Set up Docker Buildx | |
| 31 | uses: docker/setup-buildx-action@v3 | |
| 32 | ||
| 33 | - name: Login to DockerHub | |
| 34 | uses: docker/login-action@v3 | |
| 35 | with: | |
| 36 | username: ${{ secrets.DOCKER_USERNAME }} | |
| 37 | password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| 38 | ||
| 39 | - name: Build and push opencog-deps to docker hub | |
| 40 | uses: docker/build-push-action@v6 | |
| 41 | with: | |
| 42 | context: opencog/base | |
| 43 | tags: ${{ secrets.DOCKER_NAMESPACE }}/opencog-deps:latest | |
| 44 | push: true | |
| 45 | ||
| 46 | # Needs is the name of the job, above. | |
| 47 | atomspace: | |
| 48 | needs: base-images | |
| 49 | runs-on: ubuntu-24.04 | |
| 50 | steps: | |
| 51 | - name: Checkout current repo | |
| 52 | uses: actions/checkout@v6 | |
| 53 | ||
| 54 | - name: Set up Docker Buildx | |
| 55 | uses: docker/setup-buildx-action@v3 | |
| 56 | ||
| 57 | - name: Login to DockerHub | |
| 58 | uses: docker/login-action@v3 | |
| 59 | with: | |
| 60 | username: ${{ secrets.DOCKER_USERNAME }} | |
| 61 | password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| 62 | ||
| 63 | - name: Build and push to docker hub | |
| 64 | uses: docker/build-push-action@v6 | |
| 65 | with: | |
| 66 | context: opencog/${{ github.job }} | |
| 67 | tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest | |
| 68 | push: true | |
| 69 | ||
| 70 | - name: This is the droid you are looking for! | |
| 71 | if: always() | |
| 72 | run: | | |
| 73 | echo "### Advice to the Lovelorn :rocket:" >> $GITHUB_STEP_SUMMARY | |
| 74 | echo "If the build failed, click on the job, then click on the gear icon and then click 'View raw logs'." >> $GITHUB_STEP_SUMMARY | |
| 75 | ||
| 76 | # This places a message at the top of the job page, but you have | |
| 77 | # to click through to see the message, so it seems useless... | |
| 78 | # - name: Testing! Testing! 1,2,3. | |
| 79 | # run: | | |
| 80 | # echo "::notice title=Your-name-here::check check" | |
| 81 | ||
| 82 | ||
| 83 | atomspace-py: | |
| 84 | needs: atomspace | |
| 85 | runs-on: ubuntu-24.04 | |
| 86 | steps: | |
| 87 | - name: Checkout current repo | |
| 88 | uses: actions/checkout@v6 | |
| 89 | ||
| 90 | - name: Set up Docker Buildx | |
| 91 | uses: docker/setup-buildx-action@v3 | |
| 92 | ||
| 93 | - name: Login to DockerHub | |
| 94 | uses: docker/login-action@v3 | |
| 95 | with: | |
| 96 | username: ${{ secrets.DOCKER_USERNAME }} | |
| 97 | password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| 98 | ||
| 99 | - name: Build and push to docker hub | |
| 100 | uses: docker/build-push-action@v6 | |
| 101 | with: | |
| 102 | context: opencog/${{ github.job }} | |
| 103 | tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest | |
| 104 | push: true | |
| 105 | ||
| 106 | learn: | |
| 107 | needs: atomspace | |
| 108 | runs-on: ubuntu-24.04 | |
| 109 | steps: | |
| 110 | - name: Checkout current repo | |
| 111 | uses: actions/checkout@v6 | |
| 112 | ||
| 113 | - name: Set up Docker Buildx | |
| 114 | uses: docker/setup-buildx-action@v3 | |
| 115 | ||
| 116 | - name: Login to DockerHub | |
| 117 | uses: docker/login-action@v3 | |
| 118 | with: | |
| 119 | username: ${{ secrets.DOCKER_USERNAME }} | |
| 120 | password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| 121 | ||
| 122 | - name: Build and push to docker hub | |
| 123 | uses: docker/build-push-action@v6 | |
| 124 | with: | |
| 125 | context: opencog/${{ github.job }} | |
| 126 | tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest | |
| 127 | push: true | |
| 128 | ||
| 129 | # TODO: Create dockerfile & publish an as-moses image. | |
| 130 | # as-moses: | |
| 131 | # needs: atomspace | |
| 132 | # runs-on: ubuntu-24.04 | |
| 133 | # steps: | |
| 134 | # - name: Checkout current repo | |
| 135 | # uses: actions/checkout@v6 | |
| 136 | # | |
| 137 | # - name: Set up Docker Buildx | |
| 138 | # uses: docker/setup-buildx-action@v3 | |
| 139 | # | |
| 140 | # - name: Login to DockerHub | |
| 141 | # uses: docker/login-action@v3 | |
| 142 | # with: | |
| 143 | # username: ${{ secrets.DOCKER_USERNAME }} | |
| 144 | # password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| 145 | # | |
| 146 | # - name: Build and push to docker hub | |
| 147 | # uses: docker/build-push-action@v6 | |
| 148 | # with: | |
| 149 | # XXX wrong context, fixme. | |
| 150 | # context: archive/${{ github.job }} | |
| 151 | # tags: ${{ secrets.DOCKER_NAMESPACE }}/${{ github.job }}:latest | |
| 152 | # push: true |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | *.swp | |
| 2 | *~ | |
| 3 | .tags | |
| 4 | tags | |
| 5 | ||
| 6 | # Just to avoid the removal of the README.md in buildbot/workspace/volume/ | |
| 7 | buildbot/workspace/volume/atomspace/ | |
| 8 | buildbot/workspace/volume/cogutil/ | |
| 9 | buildbot/workspace/volume/master/ | |
| 10 | buildbot/workspace/volume/moses/ | |
| 11 | buildbot/workspace/volume/opencog/ | |
| 12 | ||
| 13 | # For opencog/minecraft containers | |
| 14 | opencog/minecraft/data/ |
| … | … | @@ -0,0 +1,693 @@ |
| 1 | Unless indicated otherwise (a license reference in file headers, or a | |
| 2 | LICENSE file in a directory), all OpenCog source files use the AGPL | |
| 3 | with additional permissions to link OpenCog libraries with non-AGPL | |
| 4 | works; the text of the OpenCog linking excpetion is located at the end | |
| 5 | of this file. | |
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | GNU AFFERO GENERAL PUBLIC LICENSE | |
| 10 | Version 3, 19 November 2007 | |
| 11 | ||
| 12 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
| 13 | Everyone is permitted to copy and distribute verbatim copies | |
| 14 | of this license document, but changing it is not allowed. | |
| 15 | ||
| 16 | Preamble | |
| 17 | ||
| 18 | The GNU Affero General Public License is a free, copyleft license for | |
| 19 | software and other kinds of works, specifically designed to ensure | |
| 20 | cooperation with the community in the case of network server software. | |
| 21 | ||
| 22 | The licenses for most software and other practical works are designed | |
| 23 | to take away your freedom to share and change the works. By contrast, | |
| 24 | our General Public Licenses are intended to guarantee your freedom to | |
| 25 | share and change all versions of a program--to make sure it remains free | |
| 26 | software for all its users. | |
| 27 | ||
| 28 | When we speak of free software, we are referring to freedom, not | |
| 29 | price. Our General Public Licenses are designed to make sure that you | |
| 30 | have the freedom to distribute copies of free software (and charge for | |
| 31 | them if you wish), that you receive source code or can get it if you | |
| 32 | want it, that you can change the software or use pieces of it in new | |
| 33 | free programs, and that you know you can do these things. | |
| 34 | ||
| 35 | Developers that use our General Public Licenses protect your rights | |
| 36 | with two steps: (1) assert copyright on the software, and (2) offer | |
| 37 | you this License which gives you legal permission to copy, distribute | |
| 38 | and/or modify the software. | |
| 39 | ||
| 40 | A secondary benefit of defending all users' freedom is that | |
| 41 | improvements made in alternate versions of the program, if they | |
| 42 | receive widespread use, become available for other developers to | |
| 43 | incorporate. Many developers of free software are heartened and | |
| 44 | encouraged by the resulting cooperation. However, in the case of | |
| 45 | software used on network servers, this result may fail to come about. | |
| 46 | The GNU General Public License permits making a modified version and | |
| 47 | letting the public access it on a server without ever releasing its | |
| 48 | source code to the public. | |
| 49 | ||
| 50 | The GNU Affero General Public License is designed specifically to | |
| 51 | ensure that, in such cases, the modified source code becomes available | |
| 52 | to the community. It requires the operator of a network server to | |
| 53 | provide the source code of the modified version running there to the | |
| 54 | users of that server. Therefore, public use of a modified version, on | |
| 55 | a publicly accessible server, gives the public access to the source | |
| 56 | code of the modified version. | |
| 57 | ||
| 58 | An older license, called the Affero General Public License and | |
| 59 | published by Affero, was designed to accomplish similar goals. This is | |
| 60 | a different license, not a version of the Affero GPL, but Affero has | |
| 61 | released a new version of the Affero GPL which permits relicensing under | |
| 62 | this license. | |
| 63 | ||
| 64 | The precise terms and conditions for copying, distribution and | |
| 65 | modification follow. | |
| 66 | ||
| 67 | TERMS AND CONDITIONS | |
| 68 | ||
| 69 | 0. Definitions. | |
| 70 | ||
| 71 | "This License" refers to version 3 of the GNU Affero General Public License. | |
| 72 | ||
| 73 | "Copyright" also means copyright-like laws that apply to other kinds of | |
| 74 | works, such as semiconductor masks. | |
| 75 | ||
| 76 | "The Program" refers to any copyrightable work licensed under this | |
| 77 | License. Each licensee is addressed as "you". "Licensees" and | |
| 78 | "recipients" may be individuals or organizations. | |
| 79 | ||
| 80 | To "modify" a work means to copy from or adapt all or part of the work | |
| 81 | in a fashion requiring copyright permission, other than the making of an | |
| 82 | exact copy. The resulting work is called a "modified version" of the | |
| 83 | earlier work or a work "based on" the earlier work. | |
| 84 | ||
| 85 | A "covered work" means either the unmodified Program or a work based | |
| 86 | on the Program. | |
| 87 | ||
| 88 | To "propagate" a work means to do anything with it that, without | |
| 89 | permission, would make you directly or secondarily liable for | |
| 90 | infringement under applicable copyright law, except executing it on a | |
| 91 | computer or modifying a private copy. Propagation includes copying, | |
| 92 | distribution (with or without modification), making available to the | |
| 93 | public, and in some countries other activities as well. | |
| 94 | ||
| 95 | To "convey" a work means any kind of propagation that enables other | |
| 96 | parties to make or receive copies. Mere interaction with a user through | |
| 97 | a computer network, with no transfer of a copy, is not conveying. | |
| 98 | ||
| 99 | An interactive user interface displays "Appropriate Legal Notices" | |
| 100 | to the extent that it includes a convenient and prominently visible | |
| 101 | feature that (1) displays an appropriate copyright notice, and (2) | |
| 102 | tells the user that there is no warranty for the work (except to the | |
| 103 | extent that warranties are provided), that licensees may convey the | |
| 104 | work under this License, and how to view a copy of this License. If | |
| 105 | the interface presents a list of user commands or options, such as a | |
| 106 | menu, a prominent item in the list meets this criterion. | |
| 107 | ||
| 108 | 1. Source Code. | |
| 109 | ||
| 110 | The "source code" for a work means the preferred form of the work | |
| 111 | for making modifications to it. "Object code" means any non-source | |
| 112 | form of a work. | |
| 113 | ||
| 114 | A "Standard Interface" means an interface that either is an official | |
| 115 | standard defined by a recognized standards body, or, in the case of | |
| 116 | interfaces specified for a particular programming language, one that | |
| 117 | is widely used among developers working in that language. | |
| 118 | ||
| 119 | The "System Libraries" of an executable work include anything, other | |
| 120 | than the work as a whole, that (a) is included in the normal form of | |
| 121 | packaging a Major Component, but which is not part of that Major | |
| 122 | Component, and (b) serves only to enable use of the work with that | |
| 123 | Major Component, or to implement a Standard Interface for which an | |
| 124 | implementation is available to the public in source code form. A | |
| 125 | "Major Component", in this context, means a major essential component | |
| 126 | (kernel, window system, and so on) of the specific operating system | |
| 127 | (if any) on which the executable work runs, or a compiler used to | |
| 128 | produce the work, or an object code interpreter used to run it. | |
| 129 | ||
| 130 | The "Corresponding Source" for a work in object code form means all | |
| 131 | the source code needed to generate, install, and (for an executable | |
| 132 | work) run the object code and to modify the work, including scripts to | |
| 133 | control those activities. However, it does not include the work's | |
| 134 | System Libraries, or general-purpose tools or generally available free | |
| 135 | programs which are used unmodified in performing those activities but | |
| 136 | which are not part of the work. For example, Corresponding Source | |
| 137 | includes interface definition files associated with source files for | |
| 138 | the work, and the source code for shared libraries and dynamically | |
| 139 | linked subprograms that the work is specifically designed to require, | |
| 140 | such as by intimate data communication or control flow between those | |
| 141 | subprograms and other parts of the work. | |
| 142 | ||
| 143 | The Corresponding Source need not include anything that users | |
| 144 | can regenerate automatically from other parts of the Corresponding | |
| 145 | Source. | |
| 146 | ||
| 147 | The Corresponding Source for a work in source code form is that | |
| 148 | same work. | |
| 149 | ||
| 150 | 2. Basic Permissions. | |
| 151 | ||
| 152 | All rights granted under this License are granted for the term of | |
| 153 | copyright on the Program, and are irrevocable provided the stated | |
| 154 | conditions are met. This License explicitly affirms your unlimited | |
| 155 | permission to run the unmodified Program. The output from running a | |
| 156 | covered work is covered by this License only if the output, given its | |
| 157 | content, constitutes a covered work. This License acknowledges your | |
| 158 | rights of fair use or other equivalent, as provided by copyright law. | |
| 159 | ||
| 160 | You may make, run and propagate covered works that you do not | |
| 161 | convey, without conditions so long as your license otherwise remains | |
| 162 | in force. You may convey covered works to others for the sole purpose | |
| 163 | of having them make modifications exclusively for you, or provide you | |
| 164 | with facilities for running those works, provided that you comply with | |
| 165 | the terms of this License in conveying all material for which you do | |
| 166 | not control copyright. Those thus making or running the covered works | |
| 167 | for you must do so exclusively on your behalf, under your direction | |
| 168 | and control, on terms that prohibit them from making any copies of | |
| 169 | your copyrighted material outside their relationship with you. | |
| 170 | ||
| 171 | Conveying under any other circumstances is permitted solely under | |
| 172 | the conditions stated below. Sublicensing is not allowed; section 10 | |
| 173 | makes it unnecessary. | |
| 174 | ||
| 175 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. | |
| 176 | ||
| 177 | No covered work shall be deemed part of an effective technological | |
| 178 | measure under any applicable law fulfilling obligations under article | |
| 179 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or | |
| 180 | similar laws prohibiting or restricting circumvention of such | |
| 181 | measures. | |
| 182 | ||
| 183 | When you convey a covered work, you waive any legal power to forbid | |
| 184 | circumvention of technological measures to the extent such circumvention | |
| 185 | is effected by exercising rights under this License with respect to | |
| 186 | the covered work, and you disclaim any intention to limit operation or | |
| 187 | modification of the work as a means of enforcing, against the work's | |
| 188 | users, your or third parties' legal rights to forbid circumvention of | |
| 189 | technological measures. | |
| 190 | ||
| 191 | 4. Conveying Verbatim Copies. | |
| 192 | ||
| 193 | You may convey verbatim copies of the Program's source code as you | |
| 194 | receive it, in any medium, provided that you conspicuously and | |
| 195 | appropriately publish on each copy an appropriate copyright notice; | |
| 196 | keep intact all notices stating that this License and any | |
| 197 | non-permissive terms added in accord with section 7 apply to the code; | |
| 198 | keep intact all notices of the absence of any warranty; and give all | |
| 199 | recipients a copy of this License along with the Program. | |
| 200 | ||
| 201 | You may charge any price or no price for each copy that you convey, | |
| 202 | and you may offer support or warranty protection for a fee. | |
| 203 | ||
| 204 | 5. Conveying Modified Source Versions. | |
| 205 | ||
| 206 | You may convey a work based on the Program, or the modifications to | |
| 207 | produce it from the Program, in the form of source code under the | |
| 208 | terms of section 4, provided that you also meet all of these conditions: | |
| 209 | ||
| 210 | a) The work must carry prominent notices stating that you modified | |
| 211 | it, and giving a relevant date. | |
| 212 | ||
| 213 | b) The work must carry prominent notices stating that it is | |
| 214 | released under this License and any conditions added under section | |
| 215 | 7. This requirement modifies the requirement in section 4 to | |
| 216 | "keep intact all notices". | |
| 217 | ||
| 218 | c) You must license the entire work, as a whole, under this | |
| 219 | License to anyone who comes into possession of a copy. This | |
| 220 | License will therefore apply, along with any applicable section 7 | |
| 221 | additional terms, to the whole of the work, and all its parts, | |
| 222 | regardless of how they are packaged. This License gives no | |
| 223 | permission to license the work in any other way, but it does not | |
| 224 | invalidate such permission if you have separately received it. | |
| 225 | ||
| 226 | d) If the work has interactive user interfaces, each must display | |
| 227 | Appropriate Legal Notices; however, if the Program has interactive | |
| 228 | interfaces that do not display Appropriate Legal Notices, your | |
| 229 | work need not make them do so. | |
| 230 | ||
| 231 | A compilation of a covered work with other separate and independent | |
| 232 | works, which are not by their nature extensions of the covered work, | |
| 233 | and which are not combined with it such as to form a larger program, | |
| 234 | in or on a volume of a storage or distribution medium, is called an | |
| 235 | "aggregate" if the compilation and its resulting copyright are not | |
| 236 | used to limit the access or legal rights of the compilation's users | |
| 237 | beyond what the individual works permit. Inclusion of a covered work | |
| 238 | in an aggregate does not cause this License to apply to the other | |
| 239 | parts of the aggregate. | |
| 240 | ||
| 241 | 6. Conveying Non-Source Forms. | |
| 242 | ||
| 243 | You may convey a covered work in object code form under the terms | |
| 244 | of sections 4 and 5, provided that you also convey the | |
| 245 | machine-readable Corresponding Source under the terms of this License, | |
| 246 | in one of these ways: | |
| 247 | ||
| 248 | a) Convey the object code in, or embodied in, a physical product | |
| 249 | (including a physical distribution medium), accompanied by the | |
| 250 | Corresponding Source fixed on a durable physical medium | |
| 251 | customarily used for software interchange. | |
| 252 | ||
| 253 | b) Convey the object code in, or embodied in, a physical product | |
| 254 | (including a physical distribution medium), accompanied by a | |
| 255 | written offer, valid for at least three years and valid for as | |
| 256 | long as you offer spare parts or customer support for that product | |
| 257 | model, to give anyone who possesses the object code either (1) a | |
| 258 | copy of the Corresponding Source for all the software in the | |
| 259 | product that is covered by this License, on a durable physical | |
| 260 | medium customarily used for software interchange, for a price no | |
| 261 | more than your reasonable cost of physically performing this | |
| 262 | conveying of source, or (2) access to copy the | |
| 263 | Corresponding Source from a network server at no charge. | |
| 264 | ||
| 265 | c) Convey individual copies of the object code with a copy of the | |
| 266 | written offer to provide the Corresponding Source. This | |
| 267 | alternative is allowed only occasionally and noncommercially, and | |
| 268 | only if you received the object code with such an offer, in accord | |
| 269 | with subsection 6b. | |
| 270 | ||
| 271 | d) Convey the object code by offering access from a designated | |
| 272 | place (gratis or for a charge), and offer equivalent access to the | |
| 273 | Corresponding Source in the same way through the same place at no | |
| 274 | further charge. You need not require recipients to copy the | |
| 275 | Corresponding Source along with the object code. If the place to | |
| 276 | copy the object code is a network server, the Corresponding Source | |
| 277 | may be on a different server (operated by you or a third party) | |
| 278 | that supports equivalent copying facilities, provided you maintain | |
| 279 | clear directions next to the object code saying where to find the | |
| 280 | Corresponding Source. Regardless of what server hosts the | |
| 281 | Corresponding Source, you remain obligated to ensure that it is | |
| 282 | available for as long as needed to satisfy these requirements. | |
| 283 | ||
| 284 | e) Convey the object code using peer-to-peer transmission, provided | |
| 285 | you inform other peers where the object code and Corresponding | |
| 286 | Source of the work are being offered to the general public at no | |
| 287 | charge under subsection 6d. | |
| 288 | ||
| 289 | A separable portion of the object code, whose source code is excluded | |
| 290 | from the Corresponding Source as a System Library, need not be | |
| 291 | included in conveying the object code work. | |
| 292 | ||
| 293 | A "User Product" is either (1) a "consumer product", which means any | |
| 294 | tangible personal property which is normally used for personal, family, | |
| 295 | or household purposes, or (2) anything designed or sold for incorporation | |
| 296 | into a dwelling. In determining whether a product is a consumer product, | |
| 297 | doubtful cases shall be resolved in favor of coverage. For a particular | |
| 298 | product received by a particular user, "normally used" refers to a | |
| 299 | typical or common use of that class of product, regardless of the status | |
| 300 | of the particular user or of the way in which the particular user | |
| 301 | actually uses, or expects or is expected to use, the product. A product | |
| 302 | is a consumer product regardless of whether the product has substantial | |
| 303 | commercial, industrial or non-consumer uses, unless such uses represent | |
| 304 | the only significant mode of use of the product. | |
| 305 | ||
| 306 | "Installation Information" for a User Product means any methods, | |
| 307 | procedures, authorization keys, or other information required to install | |
| 308 | and execute modified versions of a covered work in that User Product from | |
| 309 | a modified version of its Corresponding Source. The information must | |
| 310 | suffice to ensure that the continued functioning of the modified object | |
| 311 | code is in no case prevented or interfered with solely because | |
| 312 | modification has been made. | |
| 313 | ||
| 314 | If you convey an object code work under this section in, or with, or | |
| 315 | specifically for use in, a User Product, and the conveying occurs as | |
| 316 | part of a transaction in which the right of possession and use of the | |
| 317 | User Product is transferred to the recipient in perpetuity or for a | |
| 318 | fixed term (regardless of how the transaction is characterized), the | |
| 319 | Corresponding Source conveyed under this section must be accompanied | |
| 320 | by the Installation Information. But this requirement does not apply | |
| 321 | if neither you nor any third party retains the ability to install | |
| 322 | modified object code on the User Product (for example, the work has | |
| 323 | been installed in ROM). | |
| 324 | ||
| 325 | The requirement to provide Installation Information does not include a | |
| 326 | requirement to continue to provide support service, warranty, or updates | |
| 327 | for a work that has been modified or installed by the recipient, or for | |
| 328 | the User Product in which it has been modified or installed. Access to a | |
| 329 | network may be denied when the modification itself materially and | |
| 330 | adversely affects the operation of the network or violates the rules and | |
| 331 | protocols for communication across the network. | |
| 332 | ||
| 333 | Corresponding Source conveyed, and Installation Information provided, | |
| 334 | in accord with this section must be in a format that is publicly | |
| 335 | documented (and with an implementation available to the public in | |
| 336 | source code form), and must require no special password or key for | |
| 337 | unpacking, reading or copying. | |
| 338 | ||
| 339 | 7. Additional Terms. | |
| 340 | ||
| 341 | "Additional permissions" are terms that supplement the terms of this | |
| 342 | License by making exceptions from one or more of its conditions. | |
| 343 | Additional permissions that are applicable to the entire Program shall | |
| 344 | be treated as though they were included in this License, to the extent | |
| 345 | that they are valid under applicable law. If additional permissions | |
| 346 | apply only to part of the Program, that part may be used separately | |
| 347 | under those permissions, but the entire Program remains governed by | |
| 348 | this License without regard to the additional permissions. | |
| 349 | ||
| 350 | When you convey a copy of a covered work, you may at your option | |
| 351 | remove any additional permissions from that copy, or from any part of | |
| 352 | it. (Additional permissions may be written to require their own | |
| 353 | removal in certain cases when you modify the work.) You may place | |
| 354 | additional permissions on material, added by you to a covered work, | |
| 355 | for which you have or can give appropriate copyright permission. | |
| 356 | ||
| 357 | Notwithstanding any other provision of this License, for material you | |
| 358 | add to a covered work, you may (if authorized by the copyright holders of | |
| 359 | that material) supplement the terms of this License with terms: | |
| 360 | ||
| 361 | a) Disclaiming warranty or limiting liability differently from the | |
| 362 | terms of sections 15 and 16 of this License; or | |
| 363 | ||
| 364 | b) Requiring preservation of specified reasonable legal notices or | |
| 365 | author attributions in that material or in the Appropriate Legal | |
| 366 | Notices displayed by works containing it; or | |
| 367 | ||
| 368 | c) Prohibiting misrepresentation of the origin of that material, or | |
| 369 | requiring that modified versions of such material be marked in | |
| 370 | reasonable ways as different from the original version; or | |
| 371 | ||
| 372 | d) Limiting the use for publicity purposes of names of licensors or | |
| 373 | authors of the material; or | |
| 374 | ||
| 375 | e) Declining to grant rights under trademark law for use of some | |
| 376 | trade names, trademarks, or service marks; or | |
| 377 | ||
| 378 | f) Requiring indemnification of licensors and authors of that | |
| 379 | material by anyone who conveys the material (or modified versions of | |
| 380 | it) with contractual assumptions of liability to the recipient, for | |
| 381 | any liability that these contractual assumptions directly impose on | |
| 382 | those licensors and authors. | |
| 383 | ||
| 384 | All other non-permissive additional terms are considered "further | |
| 385 | restrictions" within the meaning of section 10. If the Program as you | |
| 386 | received it, or any part of it, contains a notice stating that it is | |
| 387 | governed by this License along with a term that is a further | |
| 388 | restriction, you may remove that term. If a license document contains | |
| 389 | a further restriction but permits relicensing or conveying under this | |
| 390 | License, you may add to a covered work material governed by the terms | |
| 391 | of that license document, provided that the further restriction does | |
| 392 | not survive such relicensing or conveying. | |
| 393 | ||
| 394 | If you add terms to a covered work in accord with this section, you | |
| 395 | must place, in the relevant source files, a statement of the | |
| 396 | additional terms that apply to those files, or a notice indicating | |
| 397 | where to find the applicable terms. | |
| 398 | ||
| 399 | Additional terms, permissive or non-permissive, may be stated in the | |
| 400 | form of a separately written license, or stated as exceptions; | |
| 401 | the above requirements apply either way. | |
| 402 | ||
| 403 | 8. Termination. | |
| 404 | ||
| 405 | You may not propagate or modify a covered work except as expressly | |
| 406 | provided under this License. Any attempt otherwise to propagate or | |
| 407 | modify it is void, and will automatically terminate your rights under | |
| 408 | this License (including any patent licenses granted under the third | |
| 409 | paragraph of section 11). | |
| 410 | ||
| 411 | However, if you cease all violation of this License, then your | |
| 412 | license from a particular copyright holder is reinstated (a) | |
| 413 | provisionally, unless and until the copyright holder explicitly and | |
| 414 | finally terminates your license, and (b) permanently, if the copyright | |
| 415 | holder fails to notify you of the violation by some reasonable means | |
| 416 | prior to 60 days after the cessation. | |
| 417 | ||
| 418 | Moreover, your license from a particular copyright holder is | |
| 419 | reinstated permanently if the copyright holder notifies you of the | |
| 420 | violation by some reasonable means, this is the first time you have | |
| 421 | received notice of violation of this License (for any work) from that | |
| 422 | copyright holder, and you cure the violation prior to 30 days after | |
| 423 | your receipt of the notice. | |
| 424 | ||
| 425 | Termination of your rights under this section does not terminate the | |
| 426 | licenses of parties who have received copies or rights from you under | |
| 427 | this License. If your rights have been terminated and not permanently | |
| 428 | reinstated, you do not qualify to receive new licenses for the same | |
| 429 | material under section 10. | |
| 430 | ||
| 431 | 9. Acceptance Not Required for Having Copies. | |
| 432 | ||
| 433 | You are not required to accept this License in order to receive or | |
| 434 | run a copy of the Program. Ancillary propagation of a covered work | |
| 435 | occurring solely as a consequence of using peer-to-peer transmission | |
| 436 | to receive a copy likewise does not require acceptance. However, | |
| 437 | nothing other than this License grants you permission to propagate or | |
| 438 | modify any covered work. These actions infringe copyright if you do | |
| 439 | not accept this License. Therefore, by modifying or propagating a | |
| 440 | covered work, you indicate your acceptance of this License to do so. | |
| 441 | ||
| 442 | 10. Automatic Licensing of Downstream Recipients. | |
| 443 | ||
| 444 | Each time you convey a covered work, the recipient automatically | |
| 445 | receives a license from the original licensors, to run, modify and | |
| 446 | propagate that work, subject to this License. You are not responsible | |
| 447 | for enforcing compliance by third parties with this License. | |
| 448 | ||
| 449 | An "entity transaction" is a transaction transferring control of an | |
| 450 | organization, or substantially all assets of one, or subdividing an | |
| 451 | organization, or merging organizations. If propagation of a covered | |
| 452 | work results from an entity transaction, each party to that | |
| 453 | transaction who receives a copy of the work also receives whatever | |
| 454 | licenses to the work the party's predecessor in interest had or could | |
| 455 | give under the previous paragraph, plus a right to possession of the | |
| 456 | Corresponding Source of the work from the predecessor in interest, if | |
| 457 | the predecessor has it or can get it with reasonable efforts. | |
| 458 | ||
| 459 | You may not impose any further restrictions on the exercise of the | |
| 460 | rights granted or affirmed under this License. For example, you may | |
| 461 | not impose a license fee, royalty, or other charge for exercise of | |
| 462 | rights granted under this License, and you may not initiate litigation | |
| 463 | (including a cross-claim or counterclaim in a lawsuit) alleging that | |
| 464 | any patent claim is infringed by making, using, selling, offering for | |
| 465 | sale, or importing the Program or any portion of it. | |
| 466 | ||
| 467 | 11. Patents. | |
| 468 | ||
| 469 | A "contributor" is a copyright holder who authorizes use under this | |
| 470 | License of the Program or a work on which the Program is based. The | |
| 471 | work thus licensed is called the contributor's "contributor version". | |
| 472 | ||
| 473 | A contributor's "essential patent claims" are all patent claims | |
| 474 | owned or controlled by the contributor, whether already acquired or | |
| 475 | hereafter acquired, that would be infringed by some manner, permitted | |
| 476 | by this License, of making, using, or selling its contributor version, | |
| 477 | but do not include claims that would be infringed only as a | |
| 478 | consequence of further modification of the contributor version. For | |
| 479 | purposes of this definition, "control" includes the right to grant | |
| 480 | patent sublicenses in a manner consistent with the requirements of | |
| 481 | this License. | |
| 482 | ||
| 483 | Each contributor grants you a non-exclusive, worldwide, royalty-free | |
| 484 | patent license under the contributor's essential patent claims, to | |
| 485 | make, use, sell, offer for sale, import and otherwise run, modify and | |
| 486 | propagate the contents of its contributor version. | |
| 487 | ||
| 488 | In the following three paragraphs, a "patent license" is any express | |
| 489 | agreement or commitment, however denominated, not to enforce a patent | |
| 490 | (such as an express permission to practice a patent or covenant not to | |
| 491 | sue for patent infringement). To "grant" such a patent license to a | |
| 492 | party means to make such an agreement or commitment not to enforce a | |
| 493 | patent against the party. | |
| 494 | ||
| 495 | If you convey a covered work, knowingly relying on a patent license, | |
| 496 | and the Corresponding Source of the work is not available for anyone | |
| 497 | to copy, free of charge and under the terms of this License, through a | |
| 498 | publicly available network server or other readily accessible means, | |
| 499 | then you must either (1) cause the Corresponding Source to be so | |
| 500 | available, or (2) arrange to deprive yourself of the benefit of the | |
| 501 | patent license for this particular work, or (3) arrange, in a manner | |
| 502 | consistent with the requirements of this License, to extend the patent | |
| 503 | license to downstream recipients. "Knowingly relying" means you have | |
| 504 | actual knowledge that, but for the patent license, your conveying the | |
| 505 | covered work in a country, or your recipient's use of the covered work | |
| 506 | in a country, would infringe one or more identifiable patents in that | |
| 507 | country that you have reason to believe are valid. | |
| 508 | ||
| 509 | If, pursuant to or in connection with a single transaction or | |
| 510 | arrangement, you convey, or propagate by procuring conveyance of, a | |
| 511 | covered work, and grant a patent license to some of the parties | |
| 512 | receiving the covered work authorizing them to use, propagate, modify | |
| 513 | or convey a specific copy of the covered work, then the patent license | |
| 514 | you grant is automatically extended to all recipients of the covered | |
| 515 | work and works based on it. | |
| 516 | ||
| 517 | A patent license is "discriminatory" if it does not include within | |
| 518 | the scope of its coverage, prohibits the exercise of, or is | |
| 519 | conditioned on the non-exercise of one or more of the rights that are | |
| 520 | specifically granted under this License. You may not convey a covered | |
| 521 | work if you are a party to an arrangement with a third party that is | |
| 522 | in the business of distributing software, under which you make payment | |
| 523 | to the third party based on the extent of your activity of conveying | |
| 524 | the work, and under which the third party grants, to any of the | |
| 525 | parties who would receive the covered work from you, a discriminatory | |
| 526 | patent license (a) in connection with copies of the covered work | |
| 527 | conveyed by you (or copies made from those copies), or (b) primarily | |
| 528 | for and in connection with specific products or compilations that | |
| 529 | contain the covered work, unless you entered into that arrangement, | |
| 530 | or that patent license was granted, prior to 28 March 2007. | |
| 531 | ||
| 532 | Nothing in this License shall be construed as excluding or limiting | |
| 533 | any implied license or other defenses to infringement that may | |
| 534 | otherwise be available to you under applicable patent law. | |
| 535 | ||
| 536 | 12. No Surrender of Others' Freedom. | |
| 537 | ||
| 538 | If conditions are imposed on you (whether by court order, agreement or | |
| 539 | otherwise) that contradict the conditions of this License, they do not | |
| 540 | excuse you from the conditions of this License. If you cannot convey a | |
| 541 | covered work so as to satisfy simultaneously your obligations under this | |
| 542 | License and any other pertinent obligations, then as a consequence you may | |
| 543 | not convey it at all. For example, if you agree to terms that obligate you | |
| 544 | to collect a royalty for further conveying from those to whom you convey | |
| 545 | the Program, the only way you could satisfy both those terms and this | |
| 546 | License would be to refrain entirely from conveying the Program. | |
| 547 | ||
| 548 | 13. Remote Network Interaction; Use with the GNU General Public License. | |
| 549 | ||
| 550 | Notwithstanding any other provision of this License, if you modify the | |
| 551 | Program, your modified version must prominently offer all users | |
| 552 | interacting with it remotely through a computer network (if your version | |
| 553 | supports such interaction) an opportunity to receive the Corresponding | |
| 554 | Source of your version by providing access to the Corresponding Source | |
| 555 | from a network server at no charge, through some standard or customary | |
| 556 | means of facilitating copying of software. This Corresponding Source | |
| 557 | shall include the Corresponding Source for any work covered by version 3 | |
| 558 | of the GNU General Public License that is incorporated pursuant to the | |
| 559 | following paragraph. | |
| 560 | ||
| 561 | Notwithstanding any other provision of this License, you have | |
| 562 | permission to link or combine any covered work with a work licensed | |
| 563 | under version 3 of the GNU General Public License into a single | |
| 564 | combined work, and to convey the resulting work. The terms of this | |
| 565 | License will continue to apply to the part which is the covered work, | |
| 566 | but the work with which it is combined will remain governed by version | |
| 567 | 3 of the GNU General Public License. | |
| 568 | ||
| 569 | 14. Revised Versions of this License. | |
| 570 | ||
| 571 | The Free Software Foundation may publish revised and/or new versions of | |
| 572 | the GNU Affero General Public License from time to time. Such new versions | |
| 573 | will be similar in spirit to the present version, but may differ in detail to | |
| 574 | address new problems or concerns. | |
| 575 | ||
| 576 | Each version is given a distinguishing version number. If the | |
| 577 | Program specifies that a certain numbered version of the GNU Affero General | |
| 578 | Public License "or any later version" applies to it, you have the | |
| 579 | option of following the terms and conditions either of that numbered | |
| 580 | version or of any later version published by the Free Software | |
| 581 | Foundation. If the Program does not specify a version number of the | |
| 582 | GNU Affero General Public License, you may choose any version ever published | |
| 583 | by the Free Software Foundation. | |
| 584 | ||
| 585 | If the Program specifies that a proxy can decide which future | |
| 586 | versions of the GNU Affero General Public License can be used, that proxy's | |
| 587 | public statement of acceptance of a version permanently authorizes you | |
| 588 | to choose that version for the Program. | |
| 589 | ||
| 590 | Later license versions may give you additional or different | |
| 591 | permissions. However, no additional obligations are imposed on any | |
| 592 | author or copyright holder as a result of your choosing to follow a | |
| 593 | later version. | |
| 594 | ||
| 595 | 15. Disclaimer of Warranty. | |
| 596 | ||
| 597 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY | |
| 598 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT | |
| 599 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY | |
| 600 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, | |
| 601 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 602 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM | |
| 603 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF | |
| 604 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |
| 605 | ||
| 606 | 16. Limitation of Liability. | |
| 607 | ||
| 608 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING | |
| 609 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS | |
| 610 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY | |
| 611 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE | |
| 612 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF | |
| 613 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD | |
| 614 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), | |
| 615 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF | |
| 616 | SUCH DAMAGES. | |
| 617 | ||
| 618 | 17. Interpretation of Sections 15 and 16. | |
| 619 | ||
| 620 | If the disclaimer of warranty and limitation of liability provided | |
| 621 | above cannot be given local legal effect according to their terms, | |
| 622 | reviewing courts shall apply local law that most closely approximates | |
| 623 | an absolute waiver of all civil liability in connection with the | |
| 624 | Program, unless a warranty or assumption of liability accompanies a | |
| 625 | copy of the Program in return for a fee. | |
| 626 | ||
| 627 | END OF TERMS AND CONDITIONS | |
| 628 | ||
| 629 | How to Apply These Terms to Your New Programs | |
| 630 | ||
| 631 | If you develop a new program, and you want it to be of the greatest | |
| 632 | possible use to the public, the best way to achieve this is to make it | |
| 633 | free software which everyone can redistribute and change under these terms. | |
| 634 | ||
| 635 | To do so, attach the following notices to the program. It is safest | |
| 636 | to attach them to the start of each source file to most effectively | |
| 637 | state the exclusion of warranty; and each file should have at least | |
| 638 | the "copyright" line and a pointer to where the full notice is found. | |
| 639 | ||
| 640 | <one line to give the program's name and a brief idea of what it does.> | |
| 641 | Copyright (C) <year> <name of author> | |
| 642 | ||
| 643 | This program is free software: you can redistribute it and/or modify | |
| 644 | it under the terms of the GNU Affero General Public License as published by | |
| 645 | the Free Software Foundation, either version 3 of the License, or | |
| 646 | (at your option) any later version. | |
| 647 | ||
| 648 | This program is distributed in the hope that it will be useful, | |
| 649 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 650 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 651 | GNU Affero General Public License for more details. | |
| 652 | ||
| 653 | You should have received a copy of the GNU Affero General Public License | |
| 654 | along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 655 | ||
| 656 | Also add information on how to contact you by electronic and paper mail. | |
| 657 | ||
| 658 | If your software can interact with users remotely through a computer | |
| 659 | network, you should also make sure that it provides a way for users to | |
| 660 | get its source. For example, if your program is a web application, its | |
| 661 | interface could display a "Source" link that leads users to an archive | |
| 662 | of the code. There are many ways you could offer source, and different | |
| 663 | solutions will be better for different programs; see section 13 for the | |
| 664 | specific requirements. | |
| 665 | ||
| 666 | You should also get your employer (if you work as a programmer) or school, | |
| 667 | if any, to sign a "copyright disclaimer" for the program, if necessary. | |
| 668 | For more information on this, and how to apply and follow the GNU AGPL, see | |
| 669 | <http://www.gnu.org/licenses/>. | |
| 670 | ||
| 671 | ||
| 672 | Linking Exception | |
| 673 | ||
| 674 | Linking this library statically or dynamically with other modules is making a | |
| 675 | combined work based on this library. Thus, the terms and conditions of the GNU | |
| 676 | Affero General Public License cover the whole combination. | |
| 677 | ||
| 678 | As a special exception, the copyright holders of this library give you | |
| 679 | permission to link this library with independent modules to produce an | |
| 680 | executable, regardless of the license terms of these independent modules, | |
| 681 | and to copy and distribute the resulting executable under terms of your choice, | |
| 682 | provided that you also meet, for each linked independent module, the terms | |
| 683 | and conditions of the license of that module. An independent module is a | |
| 684 | module which is not derived from or based on this library. If you modify | |
| 685 | this library, you may extend this exception to your version of the library, | |
| 686 | but you are not obligated to do so. If you do not wish to do so, delete this | |
| 687 | exception statement from your version. | |
| 688 | ||
| 689 | As such, it can be used to run, create and distribute a large class of | |
| 690 | MindAgents and other applications. When OpenCog is used unmodified as the core | |
| 691 | class library for an OpenCog instance, compiler for the combo language, or for | |
| 692 | a program written in the combo programming language it does not affect the | |
| 693 | licensing for distributing those programs directly. |
| … | … | @@ -0,0 +1,106 @@ |
| 1 | [](https://github.com/opencog/docker/actions) | |
| 2 | ||
| 3 | # OpenCog Docker library | |
| 4 | This repository contains various docker images for demoing and using | |
| 5 | various parts of the OpenCog project. Using the docker images here is | |
| 6 | the easiest way to get interesting parts of OpenCog running. | |
| 7 | ||
| 8 | By using Docker, most of the difficulty of installing and configuring | |
| 9 | the large variety of required packages and dependencies is eliminated. | |
| 10 | The individual docker files specify exactly what is needed to run a | |
| 11 | system or demo. Using these is as simple as saying `./build.sh` and | |
| 12 | then `./run.sh`. | |
| 13 | ||
| 14 | The most sophisticated demo is Eva, an animated female head, capable | |
| 15 | of seeing you (via a webcam), talking to you (via a chatbot), and | |
| 16 | engaging you (and your guests) in social interaction. She will | |
| 17 | make eye contact, and express her pleasure with smiles and looks | |
| 18 | of surprise and happiness. | |
| 19 | ||
| 20 |    | |
| 21 | ||
| 22 | Another particularly interesting container is that for the OpenCog to | |
| 23 | MineCraft bridge, which allows OpenCog to operate an avatar running | |
| 24 | around in the MineCraft world. | |
| 25 | ||
| 26 | ## Dockerfiles for Robot Operating System (ROS) | |
| 27 | Dockerfiles for demoing and working with various different robot heads | |
| 28 | and bodies, mostly those from | |
| 29 | [Hanson Robotics](https://www.hansonrobotics.com/). Several of the | |
| 30 | heads are modeled with blender, and so can be usefully worked with | |
| 31 | and controlled even without a physical robot. | |
| 32 | ||
| 33 | Sadly, the Eva demo has bitrotted. There have been some valiant efforts | |
| 34 | to bring Eva back to life, to be found in the [noetic](noetic) folder, | |
| 35 | but they stand incomplete. The primary roadblock is that Eva requires | |
| 36 | an older version of [blender](https://www.blender.org/), version 2.79, | |
| 37 | which dates back to 2016. Perhaps a blender expert could port Eva to | |
| 38 | a newer version. | |
| 39 | ||
| 40 | The ROS dockerfiles are contained in the [hydro](hydro), | |
| 41 | [indigo](indigo), [noetic](noetic) directories. Eva came in | |
| 42 | two forms: a basic animation and social interaction demo, in the | |
| 43 | [indigo/eva-owyl](indigo/eva-owyl) folder, and a full-featured | |
| 44 | system in the [indigo/eva-opencig](indigo/eva-opencog) folder. | |
| 45 | These no longer work, due to bitrot; the "good stuff", the last | |
| 46 | attempt to get everything working, is in the [noetic](noetic) folder. | |
| 47 | ||
| 48 | ## Dockerfiles for OpenCog | |
| 49 | Opencog system dockerfiles can be found in the [opencog](opencog) | |
| 50 | directory. Up-to-date, current pre-built versions of these Docker | |
| 51 | containers can be downloaded from dockerhub. Simply go to the | |
| 52 | [opencog](opencog) directory, and run the `docker-build.sh` shell | |
| 53 | script. `docker-build.sh -h` for help, and `docker-build.sh -a` | |
| 54 | to download everything. | |
| 55 | ||
| 56 | ### Obsolete demos | |
| 57 | If you have been sent here, and cannot find what you were told about, | |
| 58 | look in the [archive](archive) directory. It contains copies of all of | |
| 59 | the unsupported, abandond and obsolete projects that were once a part of | |
| 60 | OpenCog. | |
| 61 | ||
| 62 | ### OpenCog demo | |
| 63 | The [lang-pairs](opencog/lang-pairs) container hosts a stand-alone | |
| 64 | word-pair visualization demo. If you have some files containing | |
| 65 | text, ideally more than a few thousand words and less than a few | |
| 66 | million, then this demo can process the files and extract the | |
| 67 | word-pair mutual information. This can then be viewed by aiming | |
| 68 | a web browser at the docker container. Just follow the directions | |
| 69 | in the README. | |
| 70 | ||
| 71 | ### Docker image dependency structure: | |
| 72 | ||
| 73 | ├─opencog/opencog-deps | |
| 74 | ├─opencog/atomspace | |
| 75 | ├─opencog/learn | |
| 76 | ├─opencog/lang-pairs | |
| 77 | ├─opencog/lang-mst | |
| 78 | ||
| 79 | ### Organizational Notes: | |
| 80 | Dockerhub's copies of opencog dockerfiles are here: | |
| 81 | https://hub.docker.com/search?q=opencog | |
| 82 | ||
| 83 | * `opencog/opencog-deps:latest`: Ubuntu 22.04 based image with all | |
| 84 | OpenCog's dependencies installed. This does not need to be rebuilt, | |
| 85 | except to pick up the latest version of the base OS and OS security | |
| 86 | patches. This is the base image for `opencog/atomspace`. | |
| 87 | ||
| 88 | * `opencog/atomspace`: This depends on the `opencog/opencog-deps:latest` | |
| 89 | image. It provides the AtomSpace, RocksDB, the Cogserver, and the | |
| 90 | network CogStorageNode, allowing complex AtomSpace networks to | |
| 91 | be built. | |
| 92 | ||
| 93 | * `opencog/learn`: This depends on the `opencog/atomspace:latest` | |
| 94 | image. It provides the basic development environment for the | |
| 95 | language learning project. | |
| 96 | ||
| 97 | ## Usage | |
| 98 | * To run the demos and other containers, docker must be installed. | |
| 99 | Instructions can be found [here](https://docs.docker.com/installation/). | |
| 100 | The "[Giving non-root access](https://docs.docker.com/installation/ubuntulinux/#giving-non-root-access)" | |
| 101 | section of the docker docs explains how to avoid having to use `sudo` | |
| 102 | all the time. | |
| 103 | ||
| 104 | * The `docker-build.sh` file in [opencog](opencog) directory can be used | |
| 105 | to build the containers mentioned above. Run `./docker-build.sh -h` | |
| 106 | for usage instructions. |
| … | … | @@ -0,0 +1,285 @@ |
| 1 | Obsolete OpenCog Docker Images | |
| 2 | ------------------------------ | |
| 3 | This directory contains all of the unmaintained, abandoned and | |
| 4 | obsolete docker configurations for some of OpenCog's older projects. | |
| 5 | The instructions below are a snapshot of the instructions, as they | |
| 6 | used to be, circa 2015, and so may feel anachronistic. The goal was | |
| 7 | to explain... *How to get started with using docker to deploy | |
| 8 | production servers, as well as for development.* ... and so on. | |
| 9 | ||
| 10 | Some of the notable containers include: | |
| 11 | ||
| 12 | * `opencog/cogserver` -- An empty CogServer container. | |
| 13 | * `opencog/opencog-dev` -- All supported OpenCog components. | |
| 14 | ||
| 15 | * `opencog/opencog-dev:cli`: This depends on the | |
| 16 | `opencog/atomspace:latest` image. It installs all supported opencog | |
| 17 | repos and tools, including `as-moses`. | |
| 18 | ||
| 19 | * `opencog/opencog-dev:ide`: To be used for developing using IDEs. | |
| 20 | QtCreator is installed. | |
| 21 | ||
| 22 | * `opencog/opencog-jupyter`: Above, plus a Jupyter notebook. | |
| 23 | ||
| 24 | All of the containers above are "empty", in that they contain no data, | |
| 25 | and thus, they don't "do anything". | |
| 26 | ||
| 27 | ## Table of Contents | |
| 28 | 1. [Common Initial Setup](#common-initial-setup) | |
| 29 | 1. [Linux and UNIX-like Systems](#linux-and-unix-like-systems) | |
| 30 | 2. [Windows](#windows) | |
| 31 | 2. [Running Production Servers](#running-production-servers) | |
| 32 | 3. [Steps for OpenCog development](#steps-for-opencog-development) | |
| 33 | 4. [Steps for RelEx development](#steps-for-relex-development) | |
| 34 | RelEx is deprecated/obsolete. | |
| 35 | 5. [Steps for opencog-to-minecraft development](#steps-for-opencog-to-minecraft-development) | |
| 36 | Minecraft is obsolete. | |
| 37 | ||
| 38 | ## Common Initial Setup | |
| 39 | The following sub-sections describe the steps required to configure docker on | |
| 40 | your OS, regardless of which project you are working on. | |
| 41 | ||
| 42 | ### Linux and UNIX-like Systems | |
| 43 | 1. Follow the instructions [here](https://docs.docker.com/engine/installation/) | |
| 44 | for setting up docker. | |
| 45 | ||
| 46 | 2. Pull images that are used for opencog development by running | |
| 47 | `./docker-build.sh -a` | |
| 48 | 3. Build images using `./docker-build.sh [OPTIONS]`. | |
| 49 | * For language learning work, use the `-l` option. | |
| 50 | * If you want to update your images add `-u` option. For example, | |
| 51 | for opencog development, use `-ctu` options. Unless there are | |
| 52 | some base OS changes, or changes to ocpkg/octool, you don't have | |
| 53 | to update `opencog/opencog-deps` image. | |
| 54 | * To list the available options, use `-h` | |
| 55 | * For opencog development use `-bct` option | |
| 56 | * For NLP related work use `-r` option | |
| 57 | * For opencog-to-minecraft use `-bcte` option | |
| 58 | ||
| 59 | 4. The following is required only if you want to use `docker-compose` | |
| 60 | setup that is described below. You only need to do this once, or | |
| 61 | repeat it when updating. | |
| 62 | ||
| 63 | ``` | |
| 64 | sudo apt install docker-compose | |
| 65 | ``` | |
| 66 | ||
| 67 | 5. Run docker using whichever setup you are accustomed to. If you want | |
| 68 | to use `docker-compose`, follow the steps below, as per your type | |
| 69 | of development. The `docker-compose` setup enables you to persist | |
| 70 | changes you make on the opencog repos, from within the container, | |
| 71 | to your host OS, even when you choose to remove the containers. | |
| 72 | ||
| 73 | ### Windows | |
| 74 | 1. Follow the instruction | |
| 75 | [here](https://docs.docker.com/engine/installation/windows) for setting | |
| 76 | docker, | |
| 77 | ||
| 78 | 2. Start the docker virtual machine using 'Docker Quickstart Terminal' as | |
| 79 | described in the linked web-page from the previous step, | |
| 80 | ||
| 81 | 3. Pull images that are used for opencog development by running | |
| 82 | `./docker-build.sh -a` | |
| 83 | 4. Build images using `./docker-build.sh [OPTIONS]` | |
| 84 | * If you want to update your images add `-u` option. For example, | |
| 85 | for opencog development, use `-ctu` options. Unless there are | |
| 86 | some base OS changes, or changes to ocpkg/octool, you don't have | |
| 87 | to update `opencog/opencog-deps` image. | |
| 88 | * To list the available options, use `-h` | |
| 89 | * For opencog development use `-bct` option | |
| 90 | * For NLP related work add `-r` option | |
| 91 | ||
| 92 | 5. In the script `windows-run.sh` found in the same directory as this README, | |
| 93 | Replace `$HOME/path/to/` in the export command to the appropriate absolute | |
| 94 | path on your windows machine. __Note that you don't have to clone each | |
| 95 | repository or add all the paths__, just those you need. Since you will be | |
| 96 | using the MINGW environment that was setup by the first step, use UNIX path | |
| 97 | naming format. | |
| 98 | ||
| 99 | 6. Run `./windows-run.sh`. | |
| 100 | ||
| 101 | ## Running Production Servers | |
| 102 | Several different server containers are provided. The most important of | |
| 103 | these are: | |
| 104 | * The atomspace container, which contains the core atomspace that | |
| 105 | everyone needs. It does not contain any of the more experimental | |
| 106 | repos, nor any of the older, deprecated or abandoned projects. | |
| 107 | * The development container, which contains everything, including | |
| 108 | development tools, and most (but not all!) of the experimental | |
| 109 | repos, and some of the deprecated repos that are still in use. | |
| 110 | ||
| 111 | ## Steps for OpenCog development | |
| 112 | __For UNIX-like systems only, if you choose to use docker-compose__ | |
| 113 | ||
| 114 | 1. Specify a directory for storing ccache's compiler outputs on your host OS | |
| 115 | ||
| 116 | ``` | |
| 117 | mkdir -p $HOME/path/to/where/you/want/to/save/ccache/output | |
| 118 | export CCACHE_DIR=$HOME/path/to/where/you/want/to/save/ccache/output` | |
| 119 | ``` | |
| 120 | ||
| 121 | Specifying this means, making a clean build of source code after removing a | |
| 122 | container will be faster. If you don't want to do this, then comment out the | |
| 123 | `- $CCACHE_DIR:/home/opencog/.ccache` in `common.yml` file | |
| 124 | ||
| 125 | 2. Add these lines to `~/.bashrc` at $HOME of your host OS and run | |
| 126 | `source ~/.bashrc`. | |
| 127 | ||
| 128 | ``` | |
| 129 | export ETC_LOCALTIME=$(readlink /etc/localtime) | |
| 130 | export OPENCOG_SOURCE_DIR=$HOME/path/to/opencog | |
| 131 | export ATOMSPACE_SOURCE_DIR=$HOME/path/to/atomspace | |
| 132 | export COGUTIL_SOURCE_DIR=$HOME/path/to/cogutil | |
| 133 | export OC2MC_SOURCE_DIR=$HOME/path/to/opencog-to-minecraft | |
| 134 | ``` | |
| 135 | ||
| 136 | Optionally, if you are using `moses` add to `~/.bashrc`, | |
| 137 | `export MOSES_SOURCE_DIR=$HOME/path/to/moses` and uncomment | |
| 138 | `- $MOSES_SOURCE_DIR:/moses` line in the docker-compose.yml file. | |
| 139 | ||
| 140 | 3. For starting the containers using docker-compose run either of the following | |
| 141 | commands, | |
| 142 | * If you want to map container ports to host run | |
| 143 | `docker-compose run --service-ports dev` | |
| 144 | * If you don't want to map ports to host run | |
| 145 | `docker-compose run dev` | |
| 146 | ||
| 147 | 4. The container has opencog installed, but if you want to install | |
| 148 | cogutil, atomspace, or opencog due to some change you made in | |
| 149 | the source code found on your host, `cd` into the mount directory inside | |
| 150 | the container and then run `/tmp/octool -bi` | |
| 151 | ||
| 152 | 5. For using opencog shells follow instruction | |
| 153 | [here](http://wiki.opencog.org/w/OpenCog_shell) | |
| 154 | ||
| 155 | 6. Have fun hacking | |
| 156 | ||
| 157 | 7. Exit container | |
| 158 | ||
| 159 | ## Steps for RelEx development | |
| 160 | RelEx is deprecated/obsolete. It builds and works just fine, and is | |
| 161 | perfectly usable. However, it is no longer maintained, and is not | |
| 162 | recommended for any future development. See the (commented out) | |
| 163 | instructions in this README for details. | |
| 164 | ||
| 165 | RelEx is deprecated/obsolete. | |
| 166 | ||
| 167 | 6. For configuring RelEx in the cogserver run | |
| 168 | * start the cogserver, telnet into it and access the scheme shell. | |
| 169 | * `(use-modules (opencog nlp) (opencog nlp chatbot) (opencog nlp relex2logic))` | |
| 170 | * `(set-relex-server-host)` | |
| 171 | * `(nlp-parse "you know what this is.")` | |
| 172 | ||
| 173 | ## Steps for RelEx development | |
| 174 | __For UNIX like systems only, and if you choose to use docker-compose__ | |
| 175 | ||
| 176 | 1. Add these lines to `~/.bashrc` at $HOME of your PC and run | |
| 177 | `source ~/.bashrc`. | |
| 178 | ||
| 179 | ``` | |
| 180 | export RELEX_SOURCE_DIR=$HOME/path/to/relex | |
| 181 | ``` | |
| 182 | ||
| 183 | 2. For starting the containers run either of the following commands, | |
| 184 | * If you want to map container ports to host run | |
| 185 | `docker-compose -f relex.yml run --service-ports relex` | |
| 186 | * If you don't want to map ports to host run | |
| 187 | `docker-compose -f relex.yml run relex` | |
| 188 | ||
| 189 | ## Steps for running jupyter kernels with opencog | |
| 190 | For some reason, the Jupyter container no longer builds. There is some | |
| 191 | bug with setting up the python environment. If you know how to use | |
| 192 | python, please fix this (these) config bugs (and remove this error | |
| 193 | message when done.) | |
| 194 | ||
| 195 | 1. Build the image which has python and guile kernels installed with the following command. | |
| 196 | ``` | |
| 197 | ./docker-build -j | |
| 198 | ``` | |
| 199 | This would build/pull necessary docker images. | |
| 200 | ||
| 201 | 2. Add this lines to `./.bashrc` to point to your preferred notebooks save directory | |
| 202 | ||
| 203 | ``` | |
| 204 | export OPENCOG_NOTEBOOKS=$HOME/path/to/opencog_notebooks | |
| 205 | ``` | |
| 206 | 3. For starting jupyter notebook run the following command. | |
| 207 | ||
| 208 | ``` | |
| 209 | docker-compose -f opencog-jupyter.yml run --service-ports notes | |
| 210 | ``` | |
| 211 | 4. Go to `0.0.0.0:8888/tree/notebooks` to interact with your notebooks. | |
| 212 | ||
| 213 | ## Steps for opencog-to-minecraft development | |
| 214 | The minecraft code is currently bit-rotted, and will not build. | |
| 215 | See the (commented out) instructions in this README for details. | |
| 216 | ||
| 217 | ## Steps for opencog-to-minecraft development | |
| 218 | __For UNIX like systems only, and if you choose to use docker-compose__ | |
| 219 | ||
| 220 | 1. Add these lines to `~/.bashrc` at $HOME of your PC and run | |
| 221 | `source ~/.bashrc`. | |
| 222 | ||
| 223 | ``` | |
| 224 | export ETC_LOCALTIME=$(readlink /etc/localtime) | |
| 225 | export OPENCOG_SOURCE_DIR=$HOME/path/to/opencog | |
| 226 | export ATOMSPACE_SOURCE_DIR=$HOME/path/to/atomspace | |
| 227 | export COGUTIL_SOURCE_DIR=$HOME/path/to/cogutil | |
| 228 | export OC2MC_SOURCE_DIR=$HOME/path/to/opencog-to-minecraft | |
| 229 | ``` | |
| 230 | ||
| 231 | 2. To start the Minecraft server and access a configured development environment | |
| 232 | run `docker-compose -f minecraft.yml run oc2mc`. The server.properties file | |
| 233 | is found in `minecraft/data` in the same folder as this README. The file is | |
| 234 | auto-generated so on changing the entries, restart the server by running | |
| 235 | ` docker restart minecraft-server`. | |
| 236 | ||
| 237 | 3. Run `tmux` inside the container for working with multiple windows/panes. | |
| 238 | If you create multiple panes you can use your mouse as an alternative to | |
| 239 | switch between panes. | |
| 240 | ||
| 241 | 4. Open a separate terminal, on your host, run `docker attach minecraft-server`. | |
| 242 | This gives you access to the server's console that is used for configuration. | |
| 243 | ||
| 244 | 5. Except PYTHONPATH setting step, which isn't needed because it is already | |
| 245 | configured inside the container, follow the steps described | |
| 246 | [here](https://github.com/opencog/opencog-to-minecraft#steps-to-start-the-bot) | |
| 247 | ||
| 248 | ## Steps for opencog perception development | |
| 249 | The perception code is currently bit-rotted, and will not build. | |
| 250 | See the (commented out) instructions in this README for details. | |
| 251 | ||
| 252 | ## Steps for opencog perception development | |
| 253 | __WIP and only for use with systems with gpus, for now__ | |
| 254 | ||
| 255 | 1. Install nvidia docker plugin by following instruction | |
| 256 | [here](https://github.com/NVIDIA/nvidia-docker/wiki/Installation). | |
| 257 | ||
| 258 | 2. Build openog/perception image by running | |
| 259 | `docker build -t opencog/perception perception/` from this directory. | |
| 260 | ||
| 261 | 3. For usage of the built image see | |
| 262 | [here](https://github.com/NVIDIA/nvidia-docker/wiki/nvidia-docker). | |
| 263 | ||
| 264 | ## Docker Cheat Sheet | |
| 265 | * `docker images` | |
| 266 | * `docker rmi <image-hex>` | |
| 267 | * `docker ps -a` | |
| 268 | * `docker rm <image-name>` | |
| 269 | ||
| 270 | ## Notes | |
| 271 | 1. Both `tmux` and `byobu` are installed, so you can use either for | |
| 272 | multiple windows/panes. | |
| 273 | ||
| 274 | 2. On exiting the opencog container, postgres & relex will still be | |
| 275 | running in the background. So when running `docker-compose run ...` | |
| 276 | it will auto-link to them, provided you haven't removed the | |
| 277 | containers or shutdown your machine. | |
| 278 | ||
| 279 | 3. For more on docker-compose refer to https://docs.docker.com/compose/ | |
| 280 | ||
| 281 | ## TODO | |
| 282 | 1. Update docker-compose configuration for minimizing steps to start | |
| 283 | developing | |
| 284 | ||
| 285 | 2. Add more images to github workflow for automated publishing |
| … | … | @@ -0,0 +1,57 @@ |
| 1 | # | |
| 2 | # OpenCog BAP/BIL development container. | |
| 3 | # BAP is the Carnegie-Mellon Binary Analysis Program | |
| 4 | # BIL is the BAP intermediate language | |
| 5 | # This container is meant for developing machine learning to analyze | |
| 6 | # software binaries, with the end-goal of threat mitigation. Provided | |
| 7 | # for Object Security LLC objectsecurity.com | |
| 8 | # | |
| 9 | # Steps to take: | |
| 10 | # 1. docker build -t opencog/atomspace:bap . | |
| 11 | # 2. docker create --name atomspace-bap -p 17001:17001 | |
| 12 | # -v /ABSOLUTE/PATH/TO/YOUR/WORKING/DIRECTORY/On/Your/PC/:/devel | |
| 13 | # -w /devel | |
| 14 | # -it opencog/atomspace:bap | |
| 15 | # 3. docker start -i atomspace-bap | |
| 16 | ||
| 17 | FROM opencog/cogutil | |
| 18 | ||
| 19 | RUN apt-get -y install opam | |
| 20 | ||
| 21 | # Switch away from the root user before doing opam work. | |
| 22 | USER opencog | |
| 23 | WORKDIR /home/opencog | |
| 24 | ||
| 25 | # Inits opam and install the OCaml compiler. Disable sandboxing | |
| 26 | # per https://github.com/ocaml/opam-repository/issues/20093 | |
| 27 | RUN opam init --comp=4.09.0 --disable-sandboxing | |
| 28 | ||
| 29 | # Activate opam environment | |
| 30 | RUN eval `opam config env` | |
| 31 | ||
| 32 | RUN opam install -y core | |
| 33 | RUN opam install -y depext | |
| 34 | ||
| 35 | # Install bap and its dependencies | |
| 36 | RUN opam -y depext --install bap -y | |
| 37 | ||
| 38 | RUN eval $(opam env) | |
| 39 | ||
| 40 | # Install core atomspace. | |
| 41 | RUN /tmp/octool -a && ccache -C | |
| 42 | ||
| 43 | # Setup the workspace for developers | |
| 44 | ## Dont't mount host volumes to opencog's home directory inside the | |
| 45 | ## container, if you do you will not find the contents copied below | |
| 46 | COPY /scripts/ /home/opencog | |
| 47 | ||
| 48 | # Cannot chown -R .* because the .opam dir is 4.5 GB and the .stack | |
| 49 | # dir is 1.5 GB and these take forever to chown. ... and don't need | |
| 50 | # to be. However, anything we copy does need to be. | |
| 51 | RUN sudo chown -R opencog:opencog .ocamlinit | |
| 52 | ||
| 53 | # Docker defaults | |
| 54 | CMD /bin/bash | |
| 55 | ||
| 56 | # For images built on this | |
| 57 | ONBUILD USER root |
| … | … | @@ -0,0 +1,13 @@ |
| 1 | (* boilplate -- not sure if all of this is needed. *) | |
| 2 | #use "topfind" | |
| 3 | #camlp4o | |
| 4 | #thread | |
| 5 | #require "core.top" | |
| 6 | #require "core.syntax" | |
| 7 | ||
| 8 | (* BAP stuff *) | |
| 9 | #require "bap.top";; | |
| 10 | ||
| 11 | (* Atomese stuff *) | |
| 12 | #directory "/usr/local/lib/opencog/ocaml/" ;; | |
| 13 | #use "atomese.ml" ;; |
| … | … | @@ -0,0 +1,18 @@ |
| 1 | # | |
| 2 | # Steps to take: | |
| 3 | # | |
| 4 | # 1. docker build --no-cache -t opencog/cogutil | |
| 5 | # 2. docker run --rm -it opencog/cogutil | |
| 6 | ||
| 7 | FROM opencog/opencog-deps:latest | |
| 8 | ||
| 9 | # Install cogutil | |
| 10 | RUN /tmp/octool -c && ccache -C | |
| 11 | ||
| 12 | USER opencog | |
| 13 | ||
| 14 | # Docker defaults | |
| 15 | CMD bash | |
| 16 | ||
| 17 | # For images built on this | |
| 18 | ONBUILD USER root |
| … | … | @@ -0,0 +1,24 @@ |
| 1 | # Used for setting common docker-compose run configurations for the files, | |
| 2 | # * docker-compose.yml | |
| 3 | # * minecraft.yml | |
| 4 | # NOTE: Don't add links in this file | |
| 5 | ||
| 6 | services: | |
| 7 | workspace: | |
| 8 | image: opencog/opencog-dev:cli | |
| 9 | ports: # syntax is host:container | |
| 10 | - "5000:5000" | |
| 11 | - "17001:17001" | |
| 12 | - "8080:8080" | |
| 13 | volumes: | |
| 14 | - $OPENCOG_SOURCE_DIR:/opencog | |
| 15 | - $HOME/.gitconfig:/home/opencog/.gitconfig # for git commits,stash ... | |
| 16 | - ${ETC_LOCALTIME}:/etc/localtime:ro # for syncing with host time. | |
| 17 | - $CCACHE_DIR:/home/opencog/.ccache # for persisting ccache artifacts | |
| 18 | environment: # Set environment variables within the container | |
| 19 | - OPENCOG_SOURCE_DIR=/opencog | |
| 20 | - CCACHE_DIR=/home/opencog/.ccache | |
| 21 | - PGHOST=db # This should be the same as the link's alias | |
| 22 | - PGUSER=opencog_user # user created by configure-database.sh | |
| 23 | command: bash | |
| 24 |
| … | … | @@ -0,0 +1,275 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # Notes: | |
| 4 | # 1. Build's all the images for development. You can also pull the images from | |
| 5 | # docker registry, but they are a bit bulky. | |
| 6 | # 2. If your user is not a member of the docker group you can add it by running | |
| 7 | # sudo adduser $USER docker . On restart you would be able to run docker and | |
| 8 | # this script without root privilege. | |
| 9 | # 3. This works for docker version >= 1.5.0 | |
| 10 | # 4. If run without -u option it will not rebuild all the images unless the base | |
| 11 | # ubuntu image is updated. | |
| 12 | ||
| 13 | # Exit on error | |
| 14 | set -e | |
| 15 | ||
| 16 | # Environment Variables | |
| 17 | ## Use's cache by default unless the -u options is passed | |
| 18 | CACHE_OPTION="" | |
| 19 | ||
| 20 | ## This file/symlinks name | |
| 21 | SELF_NAME=$(basename $0) | |
| 22 | ||
| 23 | # ----------------------------------------------------------------------------- | |
| 24 | # Main Execution | |
| 25 | if [ $# -eq 0 ]; then NO_ARGS=true; fi | |
| 26 | ||
| 27 | while getopts "abcehjlmprstu" flag; do | |
| 28 | case $flag in | |
| 29 | a) PULL_DEV_IMAGES=true ;; | |
| 30 | b) BUILD_OPENCOG_BASE_IMAGE=true ;; | |
| 31 | c) BUILD_COGUTIL_IMAGE=true ;; | |
| 32 | e) BUILD_EMBODIMENT_IMAGE=true ;; | |
| 33 | j) BUILD_JUPYTER_IMAGE=true ;; | |
| 34 | l) BUILD_LEARN_IMAGE=true ;; | |
| 35 | m) BUILD__MOSES_IMAGE=true ;; | |
| 36 | p) BUILD__POSTGRES_IMAGE=true ;; | |
| 37 | r) BUILD_RELEX_IMAGE=true ;; | |
| 38 | s) BUILD_ATOMSPACE_IMAGE=true ;; | |
| 39 | t) BUILD_TOOL_IMAGE=true ;; | |
| 40 | u) CACHE_OPTION=--no-cache ;; | |
| 41 | h) SHOW_USAGE=true ;; | |
| 42 | \?) | |
| 43 | SHOW_USAGE=true | |
| 44 | # exit 1 | |
| 45 | ;; | |
| 46 | *) UNKNOWN_FLAGS=true ;; | |
| 47 | esac | |
| 48 | done | |
| 49 | ||
| 50 | shift "$(($OPTIND - 1))" | |
| 51 | DOCKER_NAME=$1 | |
| 52 | if [[ -z $DOCKER_NAME ]]; then | |
| 53 | DOCKER_NAME="opencog" | |
| 54 | fi | |
| 55 | GITHUB_NAME=$2 | |
| 56 | if [[ -z $GITHUB_NAME ]]; then | |
| 57 | GITHUB_NAME="opencog" | |
| 58 | fi | |
| 59 | ||
| 60 | # Functions | |
| 61 | usage() { | |
| 62 | printf "Usage: ./%s [OPTIONS] [DOCKER_NAME] [GITHUB_NAME] | |
| 63 | ||
| 64 | OPTIONS: | |
| 65 | -a Pull all images needed for development from hub.docker.com/u/${DOCKER_NAME}/ | |
| 66 | -b Build ${DOCKER_NAME}/opencog-deps image. This provides all dependencies | |
| 67 | and development tools used by ${DOCKER_NAME}. | |
| 68 | -c Builds ${DOCKER_NAME}/cogutil image. This is the base image for all | |
| 69 | other ${DOCKER_NAME} images. | |
| 70 | ||
| 71 | -s Builds ${DOCKER_NAME}/atomspace image. | |
| 72 | -l Builds ${DOCKER_NAME}/learn image. | |
| 73 | ||
| 74 | -t Builds ${DOCKER_NAME}/opencog-dev image. It contains all supported | |
| 75 | opencog components. | |
| 76 | -j Builds ${DOCKER_NAME}/opencog-jupyter image. It adds a jupyter | |
| 77 | notebook to ${DOCKER_NAME}/opencog-dev:cli | |
| 78 | ||
| 79 | -u Ignore the docker image cache when building. This will cause the | |
| 80 | container(s) to be built from scratch. | |
| 81 | -h This help message. | |
| 82 | ||
| 83 | Deprecated (Obsolete): | |
| 84 | -e Builds ${DOCKER_NAME}/minecraft image. | |
| 85 | -m Builds ${DOCKER_NAME}/moses image. | |
| 86 | -p Builds ${DOCKER_NAME}/postgres image. | |
| 87 | -r Builds ${DOCKER_NAME}/relex image. | |
| 88 | ||
| 89 | DOCKER_NAME: The name of the Docker user account to be used for this build (default 'opencog'). | |
| 90 | GITHUB_NAME: The name of the GitHub user account to be used for this build (default 'opencog') \n" "$SELF_NAME" | |
| 91 | } | |
| 92 | ||
| 93 | if [ $SHOW_USAGE ]; then | |
| 94 | usage | |
| 95 | exit 0 | |
| 96 | fi | |
| 97 | ||
| 98 | # ----------------------------------------------------------------------------- | |
| 99 | # Sanity check | |
| 100 | if ! command -v docker &> /dev/null | |
| 101 | then | |
| 102 | echo "Error: docker could not be found!" | |
| 103 | echo "You can fix this on Debian/Ubuntu by saying:" | |
| 104 | echo "$ sudo apt install docker.io docker-compose" | |
| 105 | exit | |
| 106 | fi | |
| 107 | ||
| 108 | # ----------------------------------------------------------------------------- | |
| 109 | ## Build opencog/opencog-deps image. | |
| 110 | build_opencog_deps() { | |
| 111 | echo "---- Starting build of ${DOCKER_NAME}/opencog-deps ----" | |
| 112 | OCPKG_OPTION="" | |
| 113 | if [ ! -z "$OCPKG_URL" ]; then | |
| 114 | OCPKG_OPTION="--build-arg OCPKG_URL=$OCPKG_URL" | |
| 115 | fi | |
| 116 | GITHUB_OPTION="--build-arg GITHUB_NAME=$GITHUB_NAME" | |
| 117 | docker build $CACHE_OPTION $OCPKG_OPTION $GITHUB_OPTION -t ${DOCKER_NAME}/opencog-deps base | |
| 118 | echo "---- Finished build of ${DOCKER_NAME}/opencog-deps ----" | |
| 119 | } | |
| 120 | ||
| 121 | ## If the opencog/opencog-deps image hasn't been built yet then build it. | |
| 122 | check_opencog_deps() { | |
| 123 | if [ -z "$(docker images ${DOCKER_NAME}/opencog-deps | grep -i opencog-deps)" ]; then | |
| 124 | build_opencog_deps | |
| 125 | fi | |
| 126 | } | |
| 127 | ||
| 128 | # ----------------------------------------------------------------------------- | |
| 129 | ## Build opencog/cogutil image. | |
| 130 | build_cogutil() { | |
| 131 | check_opencog_deps | |
| 132 | echo "---- Starting build of ${DOCKER_NAME}/cogutil ----" | |
| 133 | OCPKG_OPTION="" | |
| 134 | if [ ! -z "$OCPKG_URL" ]; then | |
| 135 | OCPKG_OPTION="--build-arg OCPKG_URL=$OCPKG_URL" | |
| 136 | fi | |
| 137 | GITHUB_OPTION="--build-arg GITHUB_NAME=$GITHUB_NAME" | |
| 138 | docker build $CACHE_OPTION $OCPKG_OPTION $GITHUB_OPTION -t ${DOCKER_NAME}/cogutil cogutil | |
| 139 | echo "---- Finished build of ${DOCKER_NAME}/cogutil ----" | |
| 140 | ||
| 141 | } | |
| 142 | ||
| 143 | ## If the opencog/cogutil image hasn't been built yet then build it. | |
| 144 | check_cogutil() { | |
| 145 | if [ -z "$(docker images ${DOCKER_NAME}/cogutil | grep -i cogutil)" ]; then | |
| 146 | build_cogutil | |
| 147 | fi | |
| 148 | } | |
| 149 | ||
| 150 | # ----------------------------------------------------------------------------- | |
| 151 | ## Build opencog/atomspace image. | |
| 152 | build_atomspace() { | |
| 153 | check_cogutil | |
| 154 | echo "---- Starting build of ${DOCKER_NAME}/atomspace ----" | |
| 155 | OCPKG_OPTION="" | |
| 156 | if [ ! -z "$OCPKG_URL" ]; then | |
| 157 | OCPKG_OPTION="--build-arg OCPKG_URL=$OCPKG_URL" | |
| 158 | fi | |
| 159 | GITHUB_OPTION="--build-arg GITHUB_NAME=$GITHUB_NAME" | |
| 160 | docker build $CACHE_OPTION $OCPKG_OPTION $GITHUB_OPTION -t ${DOCKER_NAME}/atomspace atomspace | |
| 161 | echo "---- Finished build of ${DOCKER_NAME}/atomspace ----" | |
| 162 | } | |
| 163 | ||
| 164 | ## If the opencog/atomspace image hasn't been built yet then build it. | |
| 165 | check_atomspace() { | |
| 166 | if [ -z "$(docker images ${DOCKER_NAME}/atomspace | grep -i atomspace)" ]; then | |
| 167 | build_atomspace | |
| 168 | fi | |
| 169 | } | |
| 170 | ||
| 171 | # ----------------------------------------------------------------------------- | |
| 172 | ## Build opencog/opencog-dev image. | |
| 173 | build_dev_cli() { | |
| 174 | check_cogutil | |
| 175 | echo "---- Starting build of ${DOCKER_NAME}/opencog-dev ----" | |
| 176 | GITHUB_OPTION="--build-arg GITHUB_NAME=$GITHUB_NAME" | |
| 177 | docker build $CACHE_OPTION $GITHUB_OPTION -t ${DOCKER_NAME}/opencog-dev tools/cli | |
| 178 | echo "---- Finished build of ${DOCKER_NAME}/opencog-dev ----" | |
| 179 | } | |
| 180 | ||
| 181 | ## If the opencog/opencog-dev image hasn't been built yet then build it. | |
| 182 | check_dev_cli() { | |
| 183 | if [ -z "$(docker images ${DOCKER_NAME}/opencog-dev | grep -i opencog-dev)" ]; then | |
| 184 | build_dev_cli | |
| 185 | fi | |
| 186 | } | |
| 187 | ||
| 188 | # ----------------------------------------------------------------------------- | |
| 189 | ## Pull all images needed for development from hub.docker.com/u/opencog/ | |
| 190 | pull_dev_images() { | |
| 191 | echo "---- Starting pull of opencog development images ----" | |
| 192 | docker pull ${DOCKER_NAME}/opencog-deps | |
| 193 | docker pull ${DOCKER_NAME}/cogutil | |
| 194 | docker pull ${DOCKER_NAME}/atomspace | |
| 195 | docker pull ${DOCKER_NAME}/learn | |
| 196 | docker pull ${DOCKER_NAME}/opencog-dev:cli | |
| 197 | echo "---- Finished pull of opencog development images ----" | |
| 198 | } | |
| 199 | ||
| 200 | # ----------------------------------------------------------------------------- | |
| 201 | # NOTE: To avoid repetion of builds don't reorder the sequence here. | |
| 202 | ||
| 203 | if [ $PULL_DEV_IMAGES ]; then | |
| 204 | pull_dev_images | |
| 205 | exit 0 | |
| 206 | fi | |
| 207 | ||
| 208 | if [ $BUILD_OPENCOG_BASE_IMAGE ]; then | |
| 209 | build_opencog_deps | |
| 210 | fi | |
| 211 | ||
| 212 | if [ $BUILD_COGUTIL_IMAGE ]; then | |
| 213 | build_cogutil | |
| 214 | fi | |
| 215 | ||
| 216 | if [ $BUILD_ATOMSPACE_IMAGE ]; then | |
| 217 | build_atomspace | |
| 218 | fi | |
| 219 | ||
| 220 | if [ $BUILD_LEARN_IMAGE ] ; then | |
| 221 | echo "---- Starting build of ${DOCKER_NAME}/learn ----" | |
| 222 | docker build $CACHE_OPTION -t ${DOCKER_NAME}/learn learn | |
| 223 | echo "---- Finished build of ${DOCKER_NAME}/learn ----" | |
| 224 | fi | |
| 225 | ||
| 226 | if [ $BUILD_TOOL_IMAGE ]; then | |
| 227 | build_dev_cli | |
| 228 | fi | |
| 229 | ||
| 230 | if [ $BUILD_EMBODIMENT_IMAGE ]; then | |
| 231 | check_dev_cli | |
| 232 | echo "---- Starting build of ${DOCKER_NAME}/minecraft ----" | |
| 233 | docker build $CACHE_OPTION -t ${DOCKER_NAME}/minecraft:0.1.0 minecraft | |
| 234 | echo "---- Finished build of ${DOCKER_NAME}/minecraft ----" | |
| 235 | fi | |
| 236 | ||
| 237 | if [ $BUILD__MOSES_IMAGE ]; then | |
| 238 | check_cogutil | |
| 239 | echo "---- Starting build of ${DOCKER_NAME}/moses ----" | |
| 240 | docker build $CACHE_OPTION -t ${DOCKER_NAME}/moses moses | |
| 241 | echo "---- Finished build of ${DOCKER_NAME}/moses ----" | |
| 242 | fi | |
| 243 | ||
| 244 | if [ $BUILD__POSTGRES_IMAGE ]; then | |
| 245 | echo "---- Starting build of ${DOCKER_NAME}/postgres ----" | |
| 246 | ATOM_SQL_OPTION="" | |
| 247 | if [ ! -z "$ATOM_SQL_URL" ]; then | |
| 248 | ATOM_SQL_OPTION="--build-arg ATOM_SQL_URL=$ATOM_SQL_URL" | |
| 249 | fi | |
| 250 | docker build $CACHE_OPTION $ATOM_SQL_OPTION -t ${DOCKER_NAME}/postgres postgres | |
| 251 | echo "---- Finished build of ${DOCKER_NAME}/postgres ----" | |
| 252 | fi | |
| 253 | ||
| 254 | if [ $BUILD_RELEX_IMAGE ]; then | |
| 255 | echo "---- Starting build of ${DOCKER_NAME}/relex ----" | |
| 256 | RELEX_OPTIONS="" | |
| 257 | if [ ! -z "$RELEX_REPO" ]; then | |
| 258 | RELEX_OPTIONS="--build-arg RELEX_REPO=$RELEX_REPO" | |
| 259 | fi | |
| 260 | if [ ! -z "$RELEX_BRANCH" ]; then | |
| 261 | RELEX_OPTIONS="$RELEX_OPTIONS --build-arg RELEX_BRANCH=$RELEX_BRANCH" | |
| 262 | fi | |
| 263 | docker build $CACHE_OPTION $RELEX_OPTIONS -t ${DOCKER_NAME}/relex relex | |
| 264 | echo "---- Finished build of ${DOCKER_NAME}/relex ----" | |
| 265 | fi | |
| 266 | ||
| 267 | if [ $BUILD_JUPYTER_IMAGE ]; then | |
| 268 | check_dev_cli | |
| 269 | echo "---- Starting build of ${DOCKER_NAME}/opencog-jupyter ----" | |
| 270 | docker build $CACHE_OPTION -t ${DOCKER_NAME}/opencog-jupyter tools/jupyter_notebook | |
| 271 | echo "---- Finished build of ${DOCKER_NAME}/opencog-jupyter ----" | |
| 272 | fi | |
| 273 | ||
| 274 | if [ $UNKNOWN_FLAGS ] ; then usage; exit 1 ; fi | |
| 275 | if [ $NO_ARGS ] ; then usage ; fi |
| … | … | @@ -0,0 +1,33 @@ |
| 1 | # Usage: Follow the steps in the README file in the directory containing this file | |
| 2 | ||
| 3 | services: | |
| 4 | dev: | |
| 5 | extends: | |
| 6 | file: common.yml | |
| 7 | service: workspace | |
| 8 | volumes: | |
| 9 | - $ATOMSPACE_SOURCE_DIR:/atomspace | |
| 10 | - $COGUTIL_SOURCE_DIR:/cogutil | |
| 11 | # Uncomment the following lines if you want to work on moses | |
| 12 | # - $MOSES_SOURCE_DIR:/moses | |
| 13 | working_dir: /opencog # This is the same as the volume mount point below | |
| 14 | environment: | |
| 15 | - ATOMSPACE_SOURCE_DIR=/atomspace | |
| 16 | - COGUTIL_SOURCE_DIR=/cogutil | |
| 17 | links: | |
| 18 | - postgres:db | |
| 19 | - relex:relex | |
| 20 | ||
| 21 | postgres: | |
| 22 | image: opencog/postgres | |
| 23 | # Uncomment the following lines if you want to work on a production | |
| 24 | # system. | |
| 25 | # NOTE: The environment variable `PROD` is set `True` then the entrypoint | |
| 26 | # script in opencog/postgres does additional configurations. | |
| 27 | # environment: | |
| 28 | # - PROD=True | |
| 29 | ||
| 30 | relex: | |
| 31 | image: opencog/relex | |
| 32 | command: /bin/sh -c "./opencog-server.sh" | |
| 33 |
| … | … | @@ -0,0 +1,29 @@ |
| 1 | # For use with Docker https://www.docker.io/gettingstarted/ | |
| 2 | # | |
| 3 | # docker build -t $USER/opencog-embodiment . | |
| 4 | # docker run --name embodiment -d -p 17001:17001 -p 5000:5000 -p 16312:16312 $USER/opencog-embodiment | |
| 5 | # docker logs embodiment | |
| 6 | ||
| 7 | FROM opencog/opencog-deps | |
| 8 | ||
| 9 | # Set locale | |
| 10 | RUN sudo locale-gen en_US en_US.UTF-8 && \ | |
| 11 | sudo dpkg-reconfigure locales | |
| 12 | ||
| 13 | # Get ocpkg script, replace wget with ADD when caching feature is added | |
| 14 | ADD opencog /opencog | |
| 15 | RUN mkdir -v -p /opencog/build | |
| 16 | WORKDIR /opencog/build | |
| 17 | RUN rm CMakeCache.txt | |
| 18 | RUN cmake .. | |
| 19 | RUN make -j$(nproc) | |
| 20 | ||
| 21 | # Run special scripts to copy embodiment files (should be in cmake not tclsh!) | |
| 22 | #RUN apt-get -y install lsof psmisc | |
| 23 | ||
| 24 | WORKDIR /opencog/scripts/embodiment | |
| 25 | RUN ./make_distribution | |
| 26 | ||
| 27 | # Start embodiment cogserver, spawner, router, etc. when container runs | |
| 28 | WORKDIR /opencog/build/dist/embodiment | |
| 29 | CMD ["/opencog/build/dist/embodiment/spawner"] |
| … | … | @@ -0,0 +1 @@ |
| 1 | Work in progress. |
| … | … | @@ -0,0 +1,36 @@ |
| 1 | # Usage: | |
| 2 | # 1. docker build -t opencog/minecraft minecraft/ | |
| 3 | # 2. docker-compose -f minecraft.yml run --rm oc2mc | |
| 4 | ||
| 5 | oc2mc: | |
| 6 | extends: | |
| 7 | file: common.yml | |
| 8 | service: workspace | |
| 9 | image: opencog/minecraft:0.1.0 | |
| 10 | volumes: | |
| 11 | - /tmp/.X11-unix/:/tmp/.X11-unix/:ro # For GUI | |
| 12 | - $OC2MC_SOURCE_DIR:/oc2mc | |
| 13 | links: | |
| 14 | - minecraft-server:minecraft | |
| 15 | environment: | |
| 16 | - MC_SERVER_NAME=minecraft # Should be same as the links field hostname | |
| 17 | working_dir: /oc2mc | |
| 18 | ||
| 19 | ||
| 20 | # For more configuration through environment variables see | |
| 21 | # github.com/itzg/dockerfiles/tree/master/minecraft-server#server-configuration | |
| 22 | minecraft-server: | |
| 23 | image: itzg/minecraft-server | |
| 24 | container_name: minecraft-server | |
| 25 | ports: | |
| 26 | - "25565:25565" # Needed for the client | |
| 27 | volumes: # For persistance of configurations | |
| 28 | - $PWD/minecraft/data:/data | |
| 29 | environment: | |
| 30 | - VERSION=1.8.8 | |
| 31 | - MODE=creative | |
| 32 | - EULA=TRUE # This in effect says the user agrees to the Minecraft eula | |
| 33 | # TODO How to handle it. | |
| 34 | # The follwoing are needed for interacting with the server from terminal | |
| 35 | tty: true | |
| 36 | stdin_open: true |
| … | … | @@ -0,0 +1 @@ |
| 1 | data/* |
| … | … | @@ -0,0 +1,45 @@ |
| 1 | FROM opencog/opencog-dev:cli | |
| 2 | ||
| 3 | # ROS installation | |
| 4 | # https://github.com/osrf/docker_images/blob/master/ros/indigo/indigo-ros-core/ | |
| 5 | # https://github.com/osrf/docker_images/blob/master/ros/indigo/indigo-ros-base/ | |
| 6 | RUN locale-gen en_US.UTF-8 | |
| 7 | ENV LANG en_US.UTF-8 | |
| 8 | ENV ROS_DISTRO kinetic | |
| 9 | ||
| 10 | ## python3-dev & python3-setuptools are for spock included in this | |
| 11 | ## instruction for minimizing layers | |
| 12 | RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654 | |
| 13 | RUN apt-get update && apt-get install --no-install-recommends -y \ | |
| 14 | python-rosdep \ | |
| 15 | python-rosinstall \ | |
| 16 | python-vcstools \ | |
| 17 | ros-kinetic-ros-base \ | |
| 18 | python3-dev python3-setuptools \ | |
| 19 | && rm -rf /var/lib/apt/lists/* \ | |
| 20 | && rosdep init | |
| 21 | ||
| 22 | COPY ./ros_entrypoint.sh / | |
| 23 | ||
| 24 | # Spock installation | |
| 25 | RUN easy_install pip && pip install cryptography | |
| 26 | RUN wget -P /tmp/ https://github.com/SpockBotMC/SpockBot/archive/v0.1.5.tar.gz ;\ | |
| 27 | cd /tmp ; tar -xvf v0.1.5.tar.gz ; cd SpockBot-0.1.5/ ;\ | |
| 28 | python setup.py install ;\ | |
| 29 | cd .. ; rm -rf v0.1.5.master.tar.gz SpockBot-0.1.5 | |
| 30 | ||
| 31 | # Installing tmuxinator | |
| 32 | ## This is NOT the "correct" way of getting this to work. Really should be done the the debian way. | |
| 33 | # RUN apt-get update && apt-get install ruby -y;\ | |
| 34 | RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB | |
| 35 | RUN wget -qO- https://get.rvm.io | bash -s stable | |
| 36 | #RUN cat /etc/profile.d/rvm.sh | bash | |
| 37 | RUN /usr/local/rvm/bin/rvm requirements | |
| 38 | RUN /usr/local/rvm/bin/rvm install 2.4.6 | |
| 39 | RUN /bin/bash -l -c "rvm use 2.4.6 --default" | |
| 40 | RUN /bin/bash -l -c "gem install tmuxinator" | |
| 41 | ||
| 42 | USER opencog | |
| 43 | RUN rosdep update | |
| 44 | ENTRYPOINT ["/ros_entrypoint.sh"] | |
| 45 | CMD ["bash"] |
| … | … | @@ -0,0 +1,13 @@ |
| 1 | #!/bin/bash | |
| 2 | # TODO: 1. Move this script to the base class | |
| 3 | # 2. add new env variables for modifying PYTHONPATH. That way the export | |
| 4 | # below wouldn't be built to images. | |
| 5 | ||
| 6 | set -e | |
| 7 | ||
| 8 | # setup ros environment | |
| 9 | source "/opt/ros/$ROS_DISTRO/setup.bash" | |
| 10 | ||
| 11 | # For oc2mc | |
| 12 | export PYTHONPATH=$PYTHONPATH:/oc2mc:/oc2mc/minecraft_bot/src | |
| 13 | exec "$@" |
| … | … | @@ -0,0 +1,25 @@ |
| 1 | # Step to take | |
| 2 | # 1. docker build --no-cache -t opencog/moses . | |
| 3 | # 2. docker run -v $PWD:/home/moses -it opencog/moses bash | |
| 4 | # 3. moses | |
| 5 | ||
| 6 | # Note: | |
| 7 | # 1. Since the build on r-base offical image R is installed on the system | |
| 8 | # 1. R is installed because there is an r binding being developed | |
| 9 | # @ https://github.com/mjsduncan/Rmoses . Since there is no cran | |
| 10 | # package for it devtools should be used. An Rscript has to be written (I guess) | |
| 11 | # 2. Step 2 above assumes you are running the command from a directory | |
| 12 | # containing some data. Instead of $PWD you could use abslute path like | |
| 13 | # $HOME/path/to/data/ | |
| 14 | ||
| 15 | FROM opencog/cogutil | |
| 16 | ||
| 17 | # Install R | |
| 18 | RUN apt-get -y install r-base | |
| 19 | ||
| 20 | # Install moses | |
| 21 | RUN /tmp/octool -m && ccache -C | |
| 22 | ||
| 23 | # Docker Defaults | |
| 24 | USER opencog | |
| 25 | CMD bash |
| … | … | @@ -0,0 +1,25 @@ |
| 1 | # Follow the instruction below for easy setup of environment | |
| 2 | # | |
| 3 | # Usage: Follow the steps in the README file in the directory containing this file | |
| 4 | # 1. docker-compose -f opencog-ide.yml build (run this when there is a dependency change) | |
| 5 | # 2. docker-compose -f opencog-ide.yml run --service-ports dev | |
| 6 | # 3. Check http://wiki.opencog.org/w/Using_QT_Creator on how to use qtcreator. | |
| 7 | ||
| 8 | # Note: You can use your mouse to switch between tmux windows/panes | |
| 9 | ||
| 10 | dev: | |
| 11 | build: tools/ide | |
| 12 | ports: # syntax is host:container | |
| 13 | - "5000:5000" | |
| 14 | - "17001:17001" | |
| 15 | - "18001:18001" | |
| 16 | - "8080:8080" | |
| 17 | working_dir: /opencog # This is the same as the volume mount point below | |
| 18 | volumes: | |
| 19 | - $OPENCOG_SOURCE_DIR:/opencog | |
| 20 | - $HOME/.gitconfig:/home/opencog/.gitconfig | |
| 21 | - /tmp/.X11-unix/:/tmp/.X11-unix/:ro # For GUI | |
| 22 | environment: # Set environment variables within the container | |
| 23 | - PYTHONPATH=/opencog/build/opencog/cython:/opencog/opencog/python/:/opencog/opencog/nlp/ | |
| 24 | - OPENCOG_SOURCE_DIR=/opencog | |
| 25 | - DISPLAY=:0 # For GUI assuming a single monitor setup. This should be set on run. |
| … | … | @@ -0,0 +1,34 @@ |
| 1 | # Follow the instructions below for setting using jupyter notebooks with opencog. | |
| 2 | # | |
| 3 | version: '3' | |
| 4 | services: | |
| 5 | notes: | |
| 6 | image: opencog/jupyter:latest | |
| 7 | ports: | |
| 8 | - "17001:17001" | |
| 9 | - "18001:18001" | |
| 10 | - "8080:8080" | |
| 11 | - "8888:8888" | |
| 12 | working_dir: /opencog/notebooks | |
| 13 | volumes: | |
| 14 | - $OPENCOG_SOURCE_DIR:/opencog | |
| 15 | - $HOME/.gitconfig:/home/opencog/.gitconfig | |
| 16 | - /tmp/.X11-unix/:/tmp/.X11-unix/:ro # For GUI | |
| 17 | - $OPENCOG_NOTEBOOKS:/opencog/notebooks | |
| 18 | environment: # Set environment variables within the container | |
| 19 | - PYTHONPATH=/opencog/build/opencog/cython:/opencog/opencog/python/:/opencog/opencog/nlp/ | |
| 20 | - OPENCOG_SOURCE_DIR=/opencog | |
| 21 | depends_on: | |
| 22 | - relex | |
| 23 | postgres: | |
| 24 | image: opencog/postgres | |
| 25 | # Uncomment the following lines if you want to work on a production | |
| 26 | # system. | |
| 27 | # NOTE: The environment variable `PROD` is set `True` then the entrypoint | |
| 28 | # script in opencog/postgres does additional configurations. | |
| 29 | # environment: | |
| 30 | # - PROD=True | |
| 31 | ||
| 32 | relex: | |
| 33 | image: opencog/relex | |
| 34 | command: /bin/sh -c "./opencog-server.sh" |
| … | … | @@ -0,0 +1,6 @@ |
| 1 | # This configuration file is kept to avoid duplicating it | |
| 2 | # in multiple direcories that may use it, even-though the | |
| 3 | # base image doesn't have tmux. | |
| 4 | ||
| 5 | # Enable mouse usage | |
| 6 | set-option -g mouse on |
| … | … | @@ -0,0 +1,21 @@ |
| 1 | FROM gcr.io/tensorflow/tensorflow:latest-gpu | |
| 2 | ||
| 3 | RUN apt-get update | |
| 4 | ||
| 5 | # Install tools for developers. | |
| 6 | RUN apt-get -y install sudo rlwrap telnet less tmux man git | |
| 7 | ||
| 8 | # Create and switch user. The user is privileged with no password required | |
| 9 | RUN adduser --disabled-password --gecos "OpenCog Developer" opencog | |
| 10 | RUN adduser opencog sudo | |
| 11 | RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
| 12 | USER opencog | |
| 13 | WORKDIR /home/opencog | |
| 14 | ||
| 15 | COPY .tmux.conf /home/opencog/.tmux.conf | |
| 16 | ||
| 17 | # Docker defaults | |
| 18 | CMD bash | |
| 19 | ||
| 20 | # For images built on this | |
| 21 | ONBUILD USER root |
| … | … | @@ -0,0 +1,22 @@ |
| 1 | # docker build -t opencog/postgres | |
| 2 | ||
| 3 | FROM postgres:9.5 | |
| 4 | ||
| 5 | # TODO: Change to build time argument. See https://github.com/docker/docker/issues/13490 | |
| 6 | ENV POSTGRES_PASSWORD="cheese" | |
| 7 | ||
| 8 | ADD https://raw.githubusercontent.com/opencog/atomspace/master/opencog/persist/sql/multi-driver/atom.sql /tmp/atom.sql | |
| 9 | ||
| 10 | COPY configure.sh /docker-entrypoint-initdb.d/ | |
| 11 | COPY start.sh / | |
| 12 | ||
| 13 | RUN chown $(id -u postgres):$(id -g postgres) /tmp/atom.sql \ | |
| 14 | /docker-entrypoint-initdb.d/configure.sh | |
| 15 | ||
| 16 | # Setup the databases for OpenCog use | |
| 17 | ENV PGDATA=/data | |
| 18 | RUN /docker-entrypoint.sh postgres | |
| 19 | ||
| 20 | # Start postgres on default without going through the configuration steps. | |
| 21 | ENTRYPOINT ["/start.sh"] | |
| 22 | CMD ["postgres"] |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | Assuming you are on a linux system, and have cloned this repository, if you want to setup postgres on your host using the docker image opencog/postgres, | |
| 2 | do the following | |
| 3 | ||
| 4 | 1. To start run the script `./run.sh` | |
| 5 | 2. To stop run `./stop.sh` |
| … | … | @@ -0,0 +1,41 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # This is a configuration script for opencog that is to be run within | |
| 4 | # the opencog container(i.e. the container that runs opencog). The | |
| 5 | # environment varaible OPENCOG_SOURCE_DIR should be set for this to | |
| 6 | # work; if you are using docker-compose, it is set for you. You might | |
| 7 | # have to wait for a few seconds until the postgres starts before | |
| 8 | # running the script. Once run you are set. | |
| 9 | ||
| 10 | # For Standard Use | |
| 11 | ## After setup for accessing the database run | |
| 12 | ## psql -h db -U opencog_user -d mycogdata | |
| 13 | printf "___ Configuring for standard OpenCog use ___\n" | |
| 14 | ||
| 15 | psql -U postgres -c \ | |
| 16 | "CREATE USER opencog_user WITH SUPERUSER PASSWORD '$POSTGRES_PASSWORD'" | |
| 17 | psql -U postgres -c "CREATE DATABASE mycogdata OWNER opencog_user" | |
| 18 | ||
| 19 | printf "___ Create the database tables for standard OpenCog use ___\n" | |
| 20 | psql -U opencog_user -d mycogdata -a -f /tmp/atom.sql | |
| 21 | ||
| 22 | # For Unit testing | |
| 23 | printf "\n___ Configuring for OpenCog unit testing ___\n" | |
| 24 | psql -U postgres -c \ | |
| 25 | "CREATE USER opencog_tester WITH SUPERUSER PASSWORD '$POSTGRES_PASSWORD'" | |
| 26 | psql -U postgres -c "CREATE DATABASE opencog_test OWNER opencog_tester" | |
| 27 | ||
| 28 | ## 'cheese' is the password for the next step | |
| 29 | printf "\n___ Create the database tables for OpenCog unit testing ___\n" | |
| 30 | psql -U opencog_tester -d opencog_test -a -f /tmp/atom.sql | |
| 31 | ||
| 32 | # Continue the running of docker-entrypoint.sh after configuration. | |
| 33 | # NOTE: Copy pasted from docker-entrypoint.sh | |
| 34 | PGUSER="${PGUSER:-postgres}" pg_ctl -D "$PGDATA" -m fast -w stop | |
| 35 | ||
| 36 | echo | |
| 37 | echo 'PostgreSQL init process complete; ready for start up.' | |
| 38 | echo | |
| 39 | ||
| 40 | # Exit from process as we don't want to start the server. | |
| 41 | exit 0 |
| … | … | @@ -0,0 +1,20 @@ |
| 1 | #!/bin/bash | |
| 2 | ||
| 3 | cp ../base/scripts/odbc-localhost.ini ~/.odbc.ini | |
| 4 | ||
| 5 | STARTED="FALSE" | |
| 6 | ||
| 7 | for i in $(docker ps -a --format={{.Names}}); do | |
| 8 | if [ $i == "opencog-postgres" ]; then | |
| 9 | echo "Starting container opencog-postgres" | |
| 10 | docker start opencog-postgres | |
| 11 | STARTED="TRUE" | |
| 12 | echo "Started container opencog-postgres" | |
| 13 | fi | |
| 14 | done | |
| 15 | ||
| 16 | if [ $STARTED == "FALSE" ]; then | |
| 17 | echo "Starting container opencog-postgres" | |
| 18 | docker run -d --name opencog-postgres -e PROD="True" -p 5432:5432 opencog/postgres | |
| 19 | echo "Started container opencog-postgres" | |
| 20 | fi |
| … | … | @@ -0,0 +1,64 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # NOTE: | |
| 4 | # 1. This script is used as an entrypoint and is created to make host dependent | |
| 5 | # configurations easier. | |
| 6 | # 2. It implements the tweaks suggested @ | |
| 7 | # github.com/opencog/atomspace/tree/master/opencog/persist/sql#performance-tweaks | |
| 8 | ||
| 9 | set -e | |
| 10 | ||
| 11 | # This is used to modify the postgres configuration before starting the | |
| 12 | # server. | |
| 13 | # | |
| 14 | # $1 = configuration_parameter | |
| 15 | # $2 = value for setting the parameter | |
| 16 | alter_pg() { | |
| 17 | echo "Setting $1 configuration parameter to $2" | |
| 18 | psql -U postgres -c "ALTER SYSTEM SET $1 = '$2'" | |
| 19 | } | |
| 20 | ||
| 21 | # Returns a value reprsenting the percentage of ram in megabytes. | |
| 22 | # $1 = percent of ram. For e.g. 25 for 25% | |
| 23 | ram_percent() { | |
| 24 | local RAM_SIZE=$(grep MemTotal /proc/meminfo | awk '{print $2}') | |
| 25 | local RAM_MULTIPLE=$(($RAM_SIZE * $1)) | |
| 26 | local RAM_PERCENT="$(($RAM_MULTIPLE / 100000))MB" | |
| 27 | echo "$RAM_PERCENT" | |
| 28 | } | |
| 29 | ||
| 30 | if [ "$1" = "postgres" ]; then | |
| 31 | # Perform host specific configurations. The environment variable `PROD` is | |
| 32 | # used to switch between development and deployment environments. | |
| 33 | if [ "True" == "$PROD" ]; then | |
| 34 | # Start server | |
| 35 | echo "setting" | |
| 36 | gosu postgres pg_ctl -D "$PGDATA" \ | |
| 37 | -o "-c listen_addresses='localhost'" \ | |
| 38 | -w start | |
| 39 | ||
| 40 | # Do the configurations | |
| 41 | echo "Starting the runtime configurations" | |
| 42 | alter_pg shared_buffers $(ram_percent 25) | |
| 43 | alter_pg work_mem 32MB | |
| 44 | alter_pg effective_cache_size $(ram_percent 50) | |
| 45 | alter_pg synchronous_commit off | |
| 46 | # In 9.5 wal_buffers is auto-calcuated as 1/32 of shared_buffers | |
| 47 | # In 9.5 checkpoint_segments doesn't exist | |
| 48 | alter_pg max_connections 130 | |
| 49 | alter_pg max_worker_processes 32 | |
| 50 | alter_pg checkpoint_timeout 1h | |
| 51 | alter_pg max_wal_size 8GB | |
| 52 | alter_pg checkpoint_completion_target 0.9 | |
| 53 | alter_pg ssl off | |
| 54 | ||
| 55 | # Stop the server for a restart for changes to take effect. | |
| 56 | gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop | |
| 57 | fi | |
| 58 | ||
| 59 | # Start the server | |
| 60 | gosu postgres postgres | |
| 61 | ||
| 62 | else | |
| 63 | exec "$@" | |
| 64 | fi |
| … | … | @@ -0,0 +1,6 @@ |
| 1 | #!/bin/bash | |
| 2 | ||
| 3 | set -e | |
| 4 | echo "Stopping container opencog-postgres" | |
| 5 | docker stop opencog-postgres | |
| 6 | echo "Stopped container opencog-postgres" |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | # Usage: Follow the steps in the README file in the directory containing this file | |
| 2 | ||
| 3 | relex: | |
| 4 | image: opencog/relex | |
| 5 | ports: | |
| 6 | - "4444:4444" | |
| 7 | - "9000:9000" | |
| 8 | - "3333:3333" | |
| 9 | working_dir: /relex | |
| 10 | volumes: | |
| 11 | - $RELEX_SOURCE_DIR:/relex | |
| 12 | - $HOME/.gitconfig:/home/opencog/.gitconfig # for git commits,stash ... | |
| 13 | - /etc/localtime:/etc/localtime:ro # for syncing with host time. | |
| 14 | command: bash |
| … | … | @@ -0,0 +1,95 @@ |
| 1 | # | |
| 2 | # Docker file that builds RelEx and starts the RelEx server. | |
| 3 | # | |
| 4 | # To build: | |
| 5 | # docker build -t relex/relex . | |
| 6 | # | |
| 7 | # To start: | |
| 8 | # docker run -p 3333:3333 relex/relex /bin/sh plain-text-server.sh | |
| 9 | # | |
| 10 | # Or alternately, this: | |
| 11 | # docker run -p 4444:4444 relex/relex /bin/sh opencog-server.sh | |
| 12 | # | |
| 13 | # docker run -p 9000:9000 relex/relex /bin/sh link-grammar-server.sh | |
| 14 | # | |
| 15 | # To demo: | |
| 16 | # telnet localhost 4444 | |
| 17 | # This is a test sentence! | |
| 18 | # | |
| 19 | # That is, after connecting by telnet, type in any sentence, ending | |
| 20 | # with a period, and hit enter. The response returned will be the | |
| 21 | # parse of the sentence, in opencog scheme format. | |
| 22 | # | |
| 23 | FROM ubuntu:latest | |
| 24 | ||
| 25 | # Avoid triggering apt-get dialogs (which may lead to errors). See: | |
| 26 | # https://stackoverflow.com/questions/25019183/docker-java7-install-fail | |
| 27 | ENV DEBIAN_FRONTEND noninteractive | |
| 28 | ||
| 29 | ENV JAVA_HOME /usr/lib/jvm/java-1.11.0-openjdk-amd64 | |
| 30 | ||
| 31 | RUN apt-get update ; apt-get -y upgrade ; apt-get -y autoclean | |
| 32 | ||
| 33 | # Java and basic build tools | |
| 34 | RUN apt-get -y install maven screen telnet netcat-openbsd byobu \ | |
| 35 | wget vim git unzip sudo apt-utils openjdk-11-jdk gcc g++ make m4 \ | |
| 36 | autoconf-archive libtool swig flex pkg-config ant libpcre2-dev | |
| 37 | ||
| 38 | # Wordnet | |
| 39 | RUN apt-get -y install wordnet wordnet-dev wordnet-sense-index | |
| 40 | ||
| 41 | # There are UTF8 chars in the Java sources, and the RelEx build will | |
| 42 | # break if build in a C environment. | |
| 43 | RUN apt-get -y install locales && locale-gen en_US.UTF-8 | |
| 44 | ENV LANG en_US.UTF-8 | |
| 45 | ENV LANGUAGE en_US:en | |
| 46 | ENV LC_ALL en_US.UTF-8 | |
| 47 | ||
| 48 | RUN mkdir /usr/local/share/java | |
| 49 | ||
| 50 | WORKDIR /home/Downloads/ | |
| 51 | ||
| 52 | # JWNL - Never changes, so do this first. | |
| 53 | RUN wget https://downloads.sourceforge.net/project/jwordnet/jwnl/JWNL%201.4/jwnl14-rc2.zip \ | |
| 54 | && unzip jwnl14-rc2.zip; cd jwnl14-rc2; \ | |
| 55 | cp jwnl.jar /usr/local/share/java/; \ | |
| 56 | chmod 755 /usr/local/share/java/jwnl.jar; \ | |
| 57 | cd ..; rm -rf jwnl* | |
| 58 | ||
| 59 | # OpenNLP - Never changes, so do this first. | |
| 60 | RUN wget https://archive.apache.org/dist/opennlp/opennlp-1.5.3/apache-opennlp-1.5.3-bin.tar.gz \ | |
| 61 | && tar -zxf apache-opennlp-1.5.3-bin.tar.gz ;\ | |
| 62 | cd apache-opennlp-1.5.3; \ | |
| 63 | cp lib/*.jar /usr/local/share/java/; \ | |
| 64 | cp lib/*.jar /usr/share/java/; \ | |
| 65 | cp lib/opennlp-tools-1.5.3.jar /usr/local/share/java/opennlp-tools-1.5.0.jar; \ | |
| 66 | cd .. ; rm -rf apache-opennlp* | |
| 67 | ||
| 68 | # Link Parser -- changes often | |
| 69 | # Download the current released version of link-grammar. | |
| 70 | ADD https://raw.githubusercontent.com/opencog/ocpkg/master/ocpkg \ | |
| 71 | /tmp/octool | |
| 72 | RUN chmod 755 /tmp/octool; sync; /tmp/octool -l java | |
| 73 | ||
| 74 | # Relex -- changes often | |
| 75 | ADD https://github.com/opencog/relex/archive/master.tar.gz master.tar.gz | |
| 76 | RUN tar -xvf master.tar.gz; cd relex-master; mvn install | |
| 77 | ||
| 78 | # Create and switch user. The user is privileged, with no password | |
| 79 | # required. That is, you can use sudo. | |
| 80 | RUN adduser --disabled-password --gecos "ReLex USER" relex | |
| 81 | RUN adduser relex sudo | |
| 82 | RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
| 83 | USER relex | |
| 84 | ||
| 85 | RUN sudo chown -R relex:relex . | |
| 86 | # Punch out ports | |
| 87 | ## plain-text-server.sh port | |
| 88 | EXPOSE 3333 | |
| 89 | ## opencog-server.sh port | |
| 90 | EXPOSE 4444 | |
| 91 | ## link-grammar-server.sh port | |
| 92 | EXPOSE 9000 | |
| 93 | ||
| 94 | WORKDIR /home/Downloads/relex-master/ | |
| 95 | CMD /bin/bash |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for relex | |
| 4 | # | |
| 5 | docker build -t opencog/relex . |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh relex-link-grammar | |
| 6 | docker run --rm --name="relex-link-grammar" -p 9000:9000 \ | |
| 7 | -w /home/Downloads/relex-master opencog/relex /bin/sh link-grammar-server.sh | |
| 8 | ||
| 9 | clear |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh relex-opencog | |
| 6 | docker run --rm --name="relex-opencog" -p 4444:4444 \ | |
| 7 | -w /home/Downloads/relex-master opencog/relex /bin/sh opencog-server.sh | |
| 8 | ||
| 9 | clear |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh relex-plain | |
| 6 | docker run --rm --name="relex-plain" -p 3333:3333 \ | |
| 7 | -w /home/Downloads/relex-master opencog/relex /bin/sh plain-text-server.sh | |
| 8 | ||
| 9 | clear |
| … | … | @@ -0,0 +1,18 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | NAME=$1 | |
| 6 | if test x"$1" == x; then | |
| 7 | NAME=relex | |
| 8 | fi | |
| 9 | TAINER=`docker ps |grep $NAME |cut -f1 -d" "` | |
| 10 | if test x"$TAINER" != x; then | |
| 11 | echo -n 'Stopping leftover container.. ' | |
| 12 | docker stop -t 1 $TAINER | |
| 13 | fi | |
| 14 | TAINER=`docker ps -a |grep $NAME |cut -f1 -d" "` | |
| 15 | if test x"$TAINER" != x; then | |
| 16 | echo -n 'Removing.. ' | |
| 17 | docker rm $TAINER | |
| 18 | fi |
| … | … | @@ -0,0 +1,33 @@ |
| 1 | # For creating images with non gui tools for development and dependencies installed | |
| 2 | # Steps: | |
| 3 | # 1. docker build -t opencog/opencog-dev:cli . | |
| 4 | # 2. docker create --name opencog -p 17001:17001 -p 5000:5000 | |
| 5 | # -v /ABSOLUTE/PATH/TO/OPENCOG/ROOT/DIRECTORY/On/Your/PC/:/opencog | |
| 6 | # -w /opencog | |
| 7 | # -it opencog/opencog-dev:cli | |
| 8 | # 3. docker start -i opencog | |
| 9 | # 4. mkdir build | |
| 10 | # 5. cmake .. | |
| 11 | # 6. make -j$(nproc) | |
| 12 | # Check http://wiki.opencog.org/w/Building_OpenCog on how to use IDEs | |
| 13 | ||
| 14 | FROM opencog/atomspace:latest | |
| 15 | ||
| 16 | # Download data and install opencog. | |
| 17 | RUN /tmp/octool -ow && ccache -C | |
| 18 | ||
| 19 | # Install tools for developers. | |
| 20 | RUN apt-get -y install python3-dbg man valgrind gdb | |
| 21 | ||
| 22 | USER opencog | |
| 23 | WORKDIR /home/opencog | |
| 24 | ||
| 25 | # Setup the workspace for developers | |
| 26 | ## Dont't mount host volumes to opencog's home directory inside the container, | |
| 27 | ## if you do you will not find the contents copied below | |
| 28 | COPY /scripts/ /home/opencog | |
| 29 | RUN sudo chown -R opencog:opencog .[a-z]* | |
| 30 | ||
| 31 | CMD /bin/bash | |
| 32 | ||
| 33 | ONBUILD USER root |
| … | … | @@ -0,0 +1,6 @@ |
| 1 | # This configuration file is kept to avoid duplicating it | |
| 2 | # in multiple direcories that may use it, even-though the | |
| 3 | # base image doesn't have tmux. | |
| 4 | ||
| 5 | # Enable mouse mode | |
| 6 | set -g mouse on |
| … | … | @@ -0,0 +1,20 @@ |
| 1 | # For use with Docker https://www.docker.io/gettingstarted/ | |
| 2 | # | |
| 3 | # docker build -t $USER/opencog-distcc . | |
| 4 | # docker run -d -p 3632:3632 $USER/opencog-distcc | |
| 5 | ||
| 6 | FROM opencog/opencog-deps | |
| 7 | MAINTAINER David Hart "dhart@opencog.org" | |
| 8 | ||
| 9 | RUN apt-get -y update && \ | |
| 10 | apt-get -y install distcc | |
| 11 | ||
| 12 | # startdtiscc ignored since we're manually starting in non-daemon mode | |
| 13 | RUN sed -i s:STARTDISTCC="false":STARTDISTCC="true":g /etc/default/distcc | |
| 14 | RUN sed -i s:ALLOWEDNETS="127.0.0.1/24":ALLOWEDNETS="158.132.58.0/24":g /etc/default/distcc | |
| 15 | RUN sed -i s:LISTENER="127.0.0.1":LISTENER="0.0.0.0":g /etc/default/distcc | |
| 16 | RUN sed -i s:NICE="10":NICE="10":g /etc/default/distcc | |
| 17 | RUN sed -i s:JOBS="":JOBS="8":g /etc/default/distcc | |
| 18 | RUN sed -i s:ZEROCONF="false":ZEROCONF="true":g /etc/default/distcc | |
| 19 | ||
| 20 | CMD /usr/bin/distccd --allow 158.132.58.0/24 ; sleep infinity |
| … | … | @@ -0,0 +1,21 @@ |
| 1 | # For creating images with gui tools for development, and dependencies installed | |
| 2 | # Steps: | |
| 3 | # 1. docker build -t opencog/opencog-dev:qtcreator . | |
| 4 | # 2. docker create --name opencog -p 17001:17001 -p 18080:18080 -p 5000:5000 | |
| 5 | # -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/:ro -it | |
| 6 | # -w /opencog | |
| 7 | # -it opencog/opencog-dev:qtcreator | |
| 8 | # 3. docker start -i opencog | |
| 9 | # 4. qtcreator | |
| 10 | # Check http://wiki.opencog.org/w/Using_QT_Creator on how to use qtcreator. | |
| 11 | ||
| 12 | FROM opencog/opencog-dev:cli | |
| 13 | ||
| 14 | # Tools | |
| 15 | RUN apt-get -y install git-gui meld qtcreator | |
| 16 | ||
| 17 | # Workspace configuration | |
| 18 | COPY qtcreator-startup-script.sh /home/opencog/ | |
| 19 | RUN chown opencog:opencog /home/opencog/qtcreator-startup-script.sh | |
| 20 | USER opencog | |
| 21 | CMD /home/opencog/qtcreator-startup-script.sh |
| … | … | @@ -0,0 +1,13 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # This script is the container entry script used to setup cli | |
| 4 | # interface and trigger qtcreator. | |
| 5 | ||
| 6 | tmux new-session -d -n "opencog-development"; | |
| 7 | echo evaluating startup script... ;\ | |
| 8 | tmux set-option -g set-remain-on-exit on ;\ | |
| 9 | tmux bind-key R respawn-window ;\ | |
| 10 | tmux split-window -d -v -p 25 ;\ | |
| 11 | tmux send -t 1 qtcreator | |
| 12 | tmux send -t 1 Enter | |
| 13 | tmux attach |
| … | … | @@ -0,0 +1,36 @@ |
| 1 | # For interacting with jupter notebooks. This installs a kernel for python and guile. | |
| 2 | ||
| 3 | # Build from opencog-dev:cli as it has all packages it needs. | |
| 4 | FROM opencog/opencog-dev:cli | |
| 5 | ||
| 6 | RUN apt-get update --fix-missing && apt-get install -y bzip2 \ | |
| 7 | libglib2.0-0 libxext6 libsm6 libxrender1 \ | |
| 8 | mercurial subversion python3-pip | |
| 9 | ||
| 10 | # To install jupyter notebook alongside with kernel on default python3 for later usage | |
| 11 | # torando must be at this specific version from https://github.com/jupyter/notebook/issues/3407 | |
| 12 | RUN python3 -m pip install jupyter ipykernel tornado==4.5.3 | |
| 13 | ||
| 14 | # Install guile-json as it is needed for guile-kernel | |
| 15 | WORKDIR /opt/ | |
| 16 | ||
| 17 | RUN wget https://download.savannah.gnu.org/releases/guile-json/guile-json-0.6.0.tar.gz && \ | |
| 18 | tar xvf guile-json-0.6.0.tar.gz && \ | |
| 19 | rm guile-json-0.6.0.tar.gz && \ | |
| 20 | cd guile-json-0.6.0 && \ | |
| 21 | ./configure && \ | |
| 22 | make install | |
| 23 | ||
| 24 | # ZMQ library to enable communication with jupyter notebook | |
| 25 | RUN wget https://raw.githubusercontent.com/jerry40/guile-simple-zmq/master/src/simple-zmq.scm -O /usr/local/share/guile/site/simple-zmq.scm | |
| 26 | ||
| 27 | # Create a directory with the guile kernel in jupyter notebook kernels directory | |
| 28 | WORKDIR /usr/local/share/jupyter/kernels | |
| 29 | ||
| 30 | RUN git clone --depth 1 https://github.com/jerry40/guile-kernel | |
| 31 | # Copy kernel description to the above folder | |
| 32 | COPY kernel.json /usr/local/share/jupyter/kernels/guile-kernel | |
| 33 | ||
| 34 | EXPOSE 8888 | |
| 35 | USER opencog | |
| 36 | CMD [ "jupyter", "notebook", "--ip=0.0.0.0", "--port=8888" ] |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | { | |
| 2 | "argv": ["guile", "-s", "/usr/local/share/jupyter/kernels/guile-kernel/src/guile-jupyter-kernel.scm", "--", "{connection_file}"], | |
| 3 | "display_name": "Guile", | |
| 4 | "language": "scheme" | |
| 5 | } |
| … | … | @@ -0,0 +1,58 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # This does what docker-compose does until docker-compose support for windows | |
| 4 | # imporves. Ofcourse it can be used instead of docker-compose on unix systems | |
| 5 | ||
| 6 | # TODO: move all this to octool | |
| 7 | ||
| 8 | # Environment variable used by the commands edit them to suite your | |
| 9 | export OPENCOG_SOURCE_DIR=$HOME/path/to/opencog | |
| 10 | export RELEX_SOURCE_DIR=$HOME/path/to/relex | |
| 11 | export ATOMSPACE_SOURCE_DIR=$HOME/path/to/atomspace | |
| 12 | export COGUTIL_SOURCE_DIR=$HOME/path/to/cogutil | |
| 13 | export MOSES_SOURCE_DIR=$HOME/path/to/moses | |
| 14 | ||
| 15 | # NOTE: Error outputs during creation are silenced b/c this script is a | |
| 16 | # temporary hack :-D | |
| 17 | docker create --name postgres opencog/postgres &> /dev/null | |
| 18 | ||
| 19 | docker create \ | |
| 20 | --name relex \ | |
| 21 | -v "$RELEX_SOURCE_DIR:/relex" \ | |
| 22 | -p "4444:4444" \ | |
| 23 | -p "9000:9000" \ | |
| 24 | -p "3333:3333" \ | |
| 25 | -w /relex \ | |
| 26 | -it opencog/relex /bin/sh -c "ant clean && ant && ./opencog-server.sh" &> /dev/null | |
| 27 | ||
| 28 | docker create \ | |
| 29 | --name opencog_dev \ | |
| 30 | -v "$OPENCOG_SOURCE_DIR:/opencog" \ | |
| 31 | -v "$RELEX_SOURCE_DIR:/relex" \ | |
| 32 | -v "$ATOMSPACE_SOURCE_DIR:/atomspace" \ | |
| 33 | -v "$COGUTIL_SOURCE_DIR:/cogutil" \ | |
| 34 | -v "$MOSES_SOURCE_DIR:/moses" \ | |
| 35 | -e PYTHONPATH=/usr/local/share/opencog/python:/opencog/opencog/python/:/opencog/build/opencog/cython:/opencog/opencog/nlp/anaphora \ | |
| 36 | -e OPENCOG_SOURCE_DIR=/opencog \ | |
| 37 | -e PGHOST=db \ | |
| 38 | -e PGUSER=opencog_user \ | |
| 39 | -p "5000:5000" \ | |
| 40 | -p "17001:17001" \ | |
| 41 | -p "18001:18001" \ | |
| 42 | -p "8080:8080" \ | |
| 43 | -w /opencog \ | |
| 44 | --link postgres:db \ | |
| 45 | --link relex:relex \ | |
| 46 | -it opencog/opencog-dev:cli &> /dev/null | |
| 47 | ||
| 48 | # Keep the order of the start | |
| 49 | echo "Starting postgres and relex" | |
| 50 | docker start relex postgres | |
| 51 | echo "Starting opencog_dev in 10 seconds" | |
| 52 | sleep 10 | |
| 53 | docker start -i opencog_dev | |
| 54 | ||
| 55 | # Cleanup on exit from opencog_dev | |
| 56 | echo "Stopping postgres and relex" | |
| 57 | docker stop relex postgres | |
| 58 | echo "If you want to remove the containers run 'docker rm postgres relex'" |
| … | … | @@ -0,0 +1,29 @@ |
| 1 | # docker build -t opencog/ros-hydro-deps . | |
| 2 | # xhost + | |
| 3 | # docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -i -t opencog/ros-hydro-deps /bin/bash | |
| 4 | # docker run -t -i --rm --privileged -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /home/mandeep/sharedFolder:/tmp/shared -v /dev/video0:/dev/video0 mandeep/ros-hydro-deps /bin/bash | |
| 5 | # xhost + is stupid and dangerous, so please run 'xhost -' after launching apps | |
| 6 | # camorama -d /dev/video0 | |
| 7 | # docker export opencog/ros-hydro | gzip -c > /media/lenovo_mandeep/ros-hydro-deps.tgz | |
| 8 | # docker import opencog/ros-hydro < /media/lenovo_mandeep/ros-hydro.tgz | |
| 9 | # echo 'DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock"' \ | |
| 10 | # | sudo tee -a /etc/default/docker | |
| 11 | ||
| 12 | FROM ubuntu:12.04 | |
| 13 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 14 | MAINTAINER David Hart "dhart@opencog.org" | |
| 15 | ||
| 16 | RUN apt-get -y update | |
| 17 | RUN apt-get -y install python-software-properties wget screen | |
| 18 | RUN wget http://packages.ros.org/ros.key -O - | apt-key add - | |
| 19 | RUN echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list | |
| 20 | RUN apt-get -y update | |
| 21 | RUN apt-get -y install ros-hydro-ros-base ros-hydro-rqt-common-plugins | |
| 22 | RUN apt-get -y install ros-hydro-robot ros-hydro-viz | |
| 23 | RUN apt-get -y install ros-hydro-mobile ros-hydro-perception ros-hydro-simulators | |
| 24 | ||
| 25 | RUN rosdep init | |
| 26 | RUN rosdep update | |
| 27 | RUN echo "source /opt/ros/hydro/setup.bash" >> ~/.bashrc | |
| 28 | ENV DISPLAY 0:0 | |
| 29 | CMD /bin/bash |
| … | … | @@ -0,0 +1,11 @@ |
| 1 | # ROS Hydro release | |
| 2 | ||
| 3 | Older ROS Hydro packages. | |
| 4 | Include full container for the Zeno robot. | |
| 5 | ||
| 6 | ### Docker image structure: | |
| 7 | ||
| 8 | ├─ros-hydro-deps | |
| 9 | ├─ros-hydro-dev | |
| 10 | ├─ros-hydro-openni | |
| 11 | ├─ros-hydro-percept |
| … | … | @@ -0,0 +1,16 @@ |
| 1 | # docker build -t opencog/ros-hydro-dev . | |
| 2 | # xhost + | |
| 3 | # docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -i -t opencog/ros-hydro-dev /bin/bash | |
| 4 | # docker run -t -i --rm --privileged -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /home/mandeep/sharedFolder:/tmp/shared -v /dev/video0:/dev/video0 mandeep/ros-hydro-dev /bin/bash | |
| 5 | ||
| 6 | FROM opencog/ros-hydro-deps | |
| 7 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 8 | MAINTAINER David Hart "dhart@opencog.org" | |
| 9 | ||
| 10 | RUN apt-get -y update | |
| 11 | RUN apt-get -y install camorama geany | |
| 12 | RUN apt-get -y install cmake-curses-gui git mercurial subversion | |
| 13 | RUN apt-get -y install ros-hydro-gscam | |
| 14 | RUN apt-get -y install less meld vim-gnome | |
| 15 | ||
| 16 | CMD /bin/bash |
| … | … | @@ -0,0 +1,29 @@ |
| 1 | # docker build -t opencog/ros-hydro-openni . | |
| 2 | # xhost + | |
| 3 | # docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -i -t opencog/ros-hydro-openni /bin/bash | |
| 4 | # docker run -t -i --rm --privileged -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /home/mandeep/sharedFolder:/tmp/shared -v /dev/video0:/dev/video0 mandeep/ros-hydro-openni /bin/bash | |
| 5 | # from https://github.com/OpenNI/OpenNI | |
| 6 | ||
| 7 | FROM opencog/ros-hydro-dev | |
| 8 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 9 | MAINTAINER David Hart "dhart@opencog.org" | |
| 10 | ||
| 11 | RUN apt-get -y update | |
| 12 | RUN apt-get -y install g++ python libusb-1.0-0-dev freeglut3-dev openjdk-7-jdk | |
| 13 | RUN apt-get -y install unzip | |
| 14 | ||
| 15 | ADD https://github.com/OpenNI/OpenNI/archive/master.zip /OpenNI.zip | |
| 16 | RUN unzip /OpenNI.zip | |
| 17 | ||
| 18 | #RedistMaker needs doxygen or it fails. dum dumb dumb dumb. | |
| 19 | #WORKDIR /OpenNI-master/Platform/Linux/CreateRedist | |
| 20 | #RUN ./RedistMaker | |
| 21 | ||
| 22 | #WORKDIR /OpenNI-master/Platform/Linux/Redist | |
| 23 | #RUN ./install.sh | |
| 24 | ||
| 25 | WORKDIR /OpenNI-master/Platform/Linux/Build | |
| 26 | RUN make | |
| 27 | RUN make install | |
| 28 | ||
| 29 | CMD /bin/bash |
| … | … | @@ -0,0 +1,21 @@ |
| 1 | # docker build -t opencog/ros-hydro-percept . | |
| 2 | # xhost + | |
| 3 | # docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -i -t opencog/ros-hydro-percept /bin/bash | |
| 4 | # docker run -t -i --rm --privileged -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /home/mandeep/sharedFolder:/tmp/shared -v /dev/video0:/dev/video0 mandeep/ros-hydro-percept /bin/bash | |
| 5 | # from https://github.com/OpenNI/OpenNI | |
| 6 | ||
| 7 | FROM opencog/ros-hydro-openni | |
| 8 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 9 | MAINTAINER David Hart "dhart@opencog.org" | |
| 10 | ||
| 11 | # RUN apt-get -y update | |
| 12 | ||
| 13 | ADD https://github.com/hansonrobotics/perception_synthesizer/archive/master.zip /perception_synthesizer.zip | |
| 14 | RUN unzip /perception_synthesizer.zip | |
| 15 | ||
| 16 | WORKDIR /perception_synthesizer-master/build | |
| 17 | RUN cmake .. | |
| 18 | RUN make | |
| 19 | RUN make install | |
| 20 | ||
| 21 | CMD /bin/bash |
| … | … | @@ -0,0 +1,150 @@ |
| 1 | # docker build -t opencog/ros-hydro-zenorsm . | |
| 2 | # xhost + | |
| 3 | # docker run --rm --privileged -i -v /dev/ttyACM0:/dev/ttyACM0 -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -v /dev/video0:/dev/video0 -v /dev/video1:/dev/video1 -e DISPLAY=:0.0 -p 33433:33433/udp -t opencog/ros-hydro-zenorsm | |
| 4 | # Note: port 33433=faceshift, /dev/ttyACM0=pololu, /dev/dri=gpu, /dev/shm=gpu | |
| 5 | # ToDo: add MORSE robot simulator | |
| 6 | # replace faceshift with OpenCV FaceRecognizer, etc. | |
| 7 | ||
| 8 | FROM opencog/ros-hydro-dev | |
| 9 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 10 | MAINTAINER David Hart "dhart@opencog.org" | |
| 11 | ||
| 12 | RUN apt-get -y update | |
| 13 | # Crap, didn't notice that it's installing blender...I think this can be removed? - AvdP | |
| 14 | RUN apt-get -y install blender | |
| 15 | ||
| 16 | RUN apt-get -y install python3-yaml | |
| 17 | RUN apt-get -y install python3-setuptools | |
| 18 | RUN easy_install3 pip | |
| 19 | RUN pip3 install rospkg catkin_pkg | |
| 20 | ||
| 21 | RUN echo source /opt/ros/hydro/setup.bash >> /.bash_profile && \ | |
| 22 | echo -e "\e[1;34m[$SELF_NAME] catkin devel setup\.bash sourced\e[0m" | |
| 23 | ||
| 24 | # Install ITFTalk and prerequisites | |
| 25 | WORKDIR /catkin_ws/src | |
| 26 | RUN apt-get -y install mplayer python-pycurl libcurl3 | |
| 27 | RUN git clone https://github.com/Alex-van-der-Peet/ITFTalk | |
| 28 | ||
| 29 | # Install ITFListen and prerequisites | |
| 30 | WORKDIR /catkin_ws/src | |
| 31 | RUN apt-get -y install sox python-simplejson | |
| 32 | RUN git clone https://github.com/Alex-van-der-Peet/ITFListen | |
| 33 | ||
| 34 | # Install ITFParrot to test ITFListen -> ITFTalk | |
| 35 | WORKDIR /catkin_ws/src | |
| 36 | RUN git clone https://github.com/Alex-van-der-Peet/ITFParrot | |
| 37 | ||
| 38 | # I figured it'd be undesirable to auto-start the parrot, so | |
| 39 | # to Run ITFParrot, go to /catkin_ws and then run: | |
| 40 | # source devel/setup.bash | |
| 41 | # rosrlaunch itf_parrot itf_parrot.launch | |
| 42 | ||
| 43 | # Install openEAR prerequisites | |
| 44 | RUN apt-get -y install autoconf libtool g++ libportaudio2 | |
| 45 | ||
| 46 | # Download ROS-enabled version of openEAR | |
| 47 | # WORKDIR / | |
| 48 | # Line below is needed otherwise it keeps saying ros_open_ear exists | |
| 49 | # and is not empty | |
| 50 | # RUN rm -rf /ros_open_ear | |
| 51 | # RUN git clone https://github.com/Alex-van-der-Peet/ros_open_ear | |
| 52 | ||
| 53 | # Unpack, make and install portaudio (openEAR prerequisite) | |
| 54 | # WORKDIR /ros_open_ear/thirdparty | |
| 55 | # RUN tar -xvf portaudio.tgz | |
| 56 | # WORKDIR /ros_open_ear/thirdparty/portaudio | |
| 57 | # RUN ./configure | |
| 58 | # RUN make | |
| 59 | # RUN make install | |
| 60 | ||
| 61 | # Configure, build and install the modified version of openEAR | |
| 62 | # WORKDIR /ros_open_ear | |
| 63 | # Double run below is on purpose | |
| 64 | #### ENV C_INCLUDE_PATH /opt/ros/hydro/include/ros:/opt/ros/hydro/include | |
| 65 | # RUN ./autogen.sh | |
| 66 | # RUN ./autogen.sh | |
| 67 | # RUN ./configure | |
| 68 | # RUN apt-get install libc6-dev build-essential | |
| 69 | # RUN echo "C_INCLUDEPATH=$C_INCLUDE_PATH" | |
| 70 | # RUN make | |
| 71 | # RUN make install | |
| 72 | ||
| 73 | WORKDIR /catkin_ws/src | |
| 74 | RUN cp /opt/ros/hydro/setup.sh /etc/profile.d/ros_hydro.sh | |
| 75 | ENV PYTHONPATH /opt/ros/hydro/lib/python2.7/dist-packages | |
| 76 | RUN /usr/bin/python3 /opt/ros/hydro/bin/catkin_init_workspace | |
| 77 | ||
| 78 | #Download and install DepthSenseSDK | |
| 79 | WORKDIR /Downloads | |
| 80 | ADD http://buildbot.opencog.org/hidden/DepthSenseSDK-1.4.3-1527-amd64.deb /Downloads/DepthSenseSDK-1.4.3-1527-amd64.deb | |
| 81 | RUN dpkg -i DepthSenseSDK-1.4.3-1527-amd64.deb | |
| 82 | ||
| 83 | WORKDIR /catkin_ws/src | |
| 84 | ||
| 85 | # The steps below clone ROS packages, but since the Gizmo runs out of memory we have to build | |
| 86 | # intermediately every few packages | |
| 87 | RUN git clone https://github.com/hansonrobotics/robo_blender | |
| 88 | RUN git clone https://github.com/yantrabuddhi/ros_pololu_servo | |
| 89 | WORKDIR /catkin_ws | |
| 90 | ||
| 91 | RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make" | |
| 92 | ||
| 93 | WORKDIR /catkin_ws/src | |
| 94 | ||
| 95 | # RUN git clone https://github.com/yantrabuddhi/ros_nmpt_saliency | |
| 96 | # Mandeep's saliency tracker above doesn't work, so I'm using the one I made | |
| 97 | # which is stored in Jamie's repo - Alex | |
| 98 | #RUN git clone https://github.com/jdddog/ros_nmpt_saliency | |
| 99 | RUN git clone https://github.com/yantrabuddhi/ros_faceshift | |
| 100 | RUN git clone https://github.com/yantrabuddhi/simple_face_tracker | |
| 101 | ||
| 102 | WORKDIR /catkin_ws | |
| 103 | ||
| 104 | RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make" | |
| 105 | ||
| 106 | WORKDIR /catkin_ws/src | |
| 107 | ||
| 108 | # Octomap breaks catkin_build, hence disabled: | |
| 109 | #RUN git clone https://github.com/OctoMap/octomap | |
| 110 | #RUN git clone https://github.com/Alex-van-der-Peet/ITFOpenEar | |
| 111 | # Jamie's repo doesn't work, so taking the source repo of his fork | |
| 112 | #RUN git clone https://github.com/jdddog/softkinetic | |
| 113 | RUN git clone https://github.com/ipa320/softkinetic | |
| 114 | ||
| 115 | WORKDIR /catkin_ws | |
| 116 | ||
| 117 | RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make" | |
| 118 | ||
| 119 | WORKDIR /catkin_ws/src | |
| 120 | ||
| 121 | WORKDIR /catkin_ws | |
| 122 | #RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make" | |
| 123 | # RUN /opt/ros/hydro/bin/catkin_make | |
| 124 | ||
| 125 | WORKDIR /catkin_ws | |
| 126 | ||
| 127 | RUN apt-get -y install ros-hydro-cv-camera | |
| 128 | ||
| 129 | ENV STARTSCRIPT "\ | |
| 130 | echo evaluating startup script... &&\ | |
| 131 | source /catkin_ws/devel/setup.bash &&\ | |
| 132 | tmux new-session -d 'echo -e \"\e[1;34mroscore\e[0m\" ; roscore' &&\ | |
| 133 | tmux set -g set-remain-on-exit on &&\ | |
| 134 | tmux set-option -g set-remain-on-exit on &&\ | |
| 135 | tmux bind-key R respawn-window &&\ | |
| 136 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_pololu_servo\e[0m\" ;\ | |
| 137 | rosrun ros_pololu_servo ros_pololu_servo_node' &&\ | |
| 138 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mblender robo.blend\e[0m\" ;\ | |
| 139 | sleep 4 && blender robo.blend' &&\ | |
| 140 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mbash shell\e[0m\" ;\ | |
| 141 | bash -l -i' &&\ | |
| 142 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_talk\e[0m\" ;\ | |
| 143 | roslaunch itf_talk itf_talk.launch' &&\ | |
| 144 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_listen\e[0m\" ;\ | |
| 145 | roslaunch itf_listen itf_listen.launch' &&\ | |
| 146 | tmux select-layout even-vertical &&\ | |
| 147 | tmux attach \ | |
| 148 | " | |
| 149 | ||
| 150 | # CMD /bin/bash -l -c "eval $STARTSCRIPT" |
| … | … | @@ -0,0 +1 @@ |
| 1 | .Dockerfile.swp |
| … | … | @@ -0,0 +1,364 @@ |
| 1 | ROS Indigo + Blender + OpenCog | |
| 2 | ============================== | |
| 3 | Docker files for Hanson Robotics robots and heads. The most | |
| 4 | sophisticated of the bunch is Eva, an animated female head, capable | |
| 5 | of seeing you (via a webcam), talking to you (via a chatbot), and | |
| 6 | engaging you (and your guests) in social interaction. She will | |
| 7 | make eye contact, and express her pleasure with smiles and looks | |
| 8 | of surprise and happiness. | |
| 9 | ||
| 10 |    | |
| 11 | ||
| 12 | ## Hierarchy and dependents | |
| 13 | ||
| 14 | The docker image hierarchy is slightly more complex than it could be. | |
| 15 | It has been driven into this state in order to accomodate the conflicting | |
| 16 | needs of ROS+Docker. The root cause is discussed further down below. | |
| 17 | In short, ROS and Docker have conflicting ideas about how networking | |
| 18 | should work; this forces us to install everything into one giant Docker | |
| 19 | container. This is not ideal, but it works. See the design discussion | |
| 20 | below. | |
| 21 | ||
| 22 | ├─ros-indigo-base | |
| 23 | ├─ros-indigo-opencog | |
| 24 | ├─ros-incog-blender | |
| 25 | ├─eva-opencog | |
| 26 | ├─ros-indigo-blender | |
| 27 | ├─eva-owyl | |
| 28 | ├─eva-ros | |
| 29 | ├─ros-arthur-animation | |
| 30 | ├─ros-arthur-dev | |
| 31 | ├─ros-indigo-dev | |
| 32 | ├─ros-indigo-einstein | |
| 33 | ├─ros-indigo-zenorsm | |
| 34 | ||
| 35 | ||
| 36 | * `ros-base` contains a docker image defining only the basic ROS indigo | |
| 37 | nodes shared by all robots, and nothing more. | |
| 38 | ||
| 39 | * `ros-opencog` contains a docker image for ROS and OpenCog. Depends | |
| 40 | on `ros-base`, above. It does not provide anything beyond a | |
| 41 | configured ROS+OpenCog environment. | |
| 42 | ||
| 43 | * `ros-blender` contains a docker image for ROS and blender. Depends | |
| 44 | on `ros-base`, above. It does not provide anything beyond a | |
| 45 | configured ROS+blender environment. | |
| 46 | ||
| 47 | * `ros-incog-blender` contains a docker image for ROS, opencog and | |
| 48 | blender. Depends on `ros-opencog`, above. It does not provide | |
| 49 | anything beyond a configured ROS+opencog+blender environment. | |
| 50 | ||
| 51 | * `eva-ros` contains the basic Hanson Robotics Eva blender rig, | |
| 52 | together with the ROS nodes needed for vision processing. | |
| 53 | Upon startup, it will automatically run the blender rig and the | |
| 54 | vision subsystem. However, it is missing the chatbot and the | |
| 55 | behavior subsystem; Eva will stare blankly into space and breath, | |
| 56 | but do nothing more. | |
| 57 | ||
| 58 | * `eva-owyl` is a a stand-alone demo of the basic Hanson Robotics | |
| 59 | Eva blender rig, showing the full range of emotional facial | |
| 60 | expressions, ranging from happiness to frustration, excitement | |
| 61 | to boredom, as well as gestures such as shakes, nods, blinks and | |
| 62 | a keep-alive breathing cycle. It includes basic vision processing | |
| 63 | and basic human-face awareness behavior, but without a chatbot or | |
| 64 | any OpenCog processing software. This is a stand-alone demo, | |
| 65 | without any other dependencies. It is representative of the state | |
| 66 | of development of the Hanson Robotics Eva blender rig, as of | |
| 67 | May 2015. | |
| 68 | ||
| 69 | * `eva-silent` contains the Eva blender rig, ROS, and OpenCog, but not | |
| 70 | the chatbot. Behaviors are executed using an OpenCog-based behavior | |
| 71 | tree, very similar to the owyl tree. She can see you, and reacts | |
| 72 | to your presence by making eye contact, smiling, and showing general | |
| 73 | interest. She reacts to absence by being bored and falling asleep. | |
| 74 | ||
| 75 | * `eva-opencog` contains the Eva blender rig, ROS, OpenCog, chatbot. | |
| 76 | This is the whole kit-n-kaboodle. Under development. Sometimes | |
| 77 | works, sometimes broken. | |
| 78 | ||
| 79 | ## Miscellaneous packages | |
| 80 | ||
| 81 | * `dev`, derived from `base`, contains a docker image for a ROS indigo | |
| 82 | development environment. | |
| 83 | ||
| 84 | * `einstein` container for the Hanson Robotics' small Einstein head. | |
| 85 | This container was demoed at ROS Kong 2014 by David Hanson. | |
| 86 | ||
| 87 | * `zenorsm` ... Zeno ?? with Einstein head ?? | |
| 88 | ||
| 89 | ## Unmaintained images | |
| 90 | The `arthur-animation` and `arthur-dev` packages are deprecated. They | |
| 91 | implement an older animation system that was difficult to work with. | |
| 92 | Most importantly, eye-tracking and emotion gestures were not blended | |
| 93 | and integrated in an easy-to-use fashion. | |
| 94 | ||
| 95 | * `arthur-animation` contains a demo for the Hanson Robotics Arthur head, | |
| 96 | showing how ROS messages can be used to control facial animations. | |
| 97 | That is, the blender rig is encapsulated in a ROS node; the rig | |
| 98 | reacts to ROS messages. | |
| 99 | ||
| 100 | * `arthur-dev` contains the full end-to-end development environment | |
| 101 | for the Hanson Robotics Arthur head. This includes a half-dozen | |
| 102 | ROS nodes for camera and vision processing, scripted behavior trees, | |
| 103 | motor controllers, and a web-based user interface. | |
| 104 | ||
| 105 | ## Building | |
| 106 | Most subdirectories contain a `build.sh` script for building the | |
| 107 | particular docker image. | |
| 108 | ||
| 109 | Use `build-all.sh` to build the Eva docker image and it's dependents. | |
| 110 | This may take an hour or more. | |
| 111 | ||
| 112 | ## Running | |
| 113 | Most subdirectories contain a pair of scripts: `run.sh` and `stop.sh`. | |
| 114 | These will run and stop the containers defined in that directory. | |
| 115 | ||
| 116 | # ROS+Docker Container Design | |
| 117 | Building a well-designed system using Docker and ROS is impossible at | |
| 118 | this point in time (as of spring 2016). This is because the way that | |
| 119 | Docker does networking is in direct conflict with how ROS does | |
| 120 | networking. The primary issue is that ROS messages contain port | |
| 121 | numbers in them, whereas Docker networking uses proxies to remap ports | |
| 122 | between containers. This means that the port numbers in the ROS messages | |
| 123 | do not match the actual port numbers being used in the Docker container. | |
| 124 | This can be hacked around in various ways, but none of the hacks solve | |
| 125 | all of the problems. | |
| 126 | ||
| 127 | The way that Docker does networking is changing (for Swarm), while ROS | |
| 128 | will also change, with a completely different messaging system for ROS2. | |
| 129 | It will be a while before the dust settles and there's a coherent | |
| 130 | networking policy. | |
| 131 | ||
| 132 | In the meantime, there are three reasonable design choices: | |
| 133 | ||
| 134 | * Put OpenCog and ROS in the same Docker container. This is ugly | |
| 135 | and unpleasant, and not a reasonable design choice at all, but it's | |
| 136 | the one we take, because nothing else works. | |
| 137 | ||
| 138 | * Put Eva blender and vision in one Docker container, (or maybe two | |
| 139 | containers, one for blender, and one for vision) and OpenCog in a | |
| 140 | third container. This is an ideal design, but cannot be made to work | |
| 141 | due to conflicting networking models. | |
| 142 | ||
| 143 | * Put every ROS node into its own container. This would result in a | |
| 144 | half-dozen to a dozen or more containers, and becomes a manageability | |
| 145 | issue: too many containers to correctly build, set up, monitor, and | |
| 146 | run. Might work for some super-admin with superman-cloud-fu, but is | |
| 147 | way too complicated for us AI scientists. Also, at this time, it also | |
| 148 | won't work, due to design limitations/flaws with Docker+ROS networking. | |
| 149 | ||
| 150 | Below is a discussion and notes about the issues that block the second | |
| 151 | and third design points. | |
| 152 | ||
| 153 | Main issue: a ROS publisher inside a Docker container cannot be | |
| 154 | subscribed to outside of a Docker container. There are several ways | |
| 155 | to set this up and try to hack around it. | |
| 156 | ||
| 157 | ## Version A: Default Docker networking. | |
| 158 | Start the ROS container in directory `base` using the `./run.sh` command. | |
| 159 | Make yourself a tmux session as follows (this is for convenience only): | |
| 160 | ``` | |
| 161 | byobu new-session -d -n 'aa' '$SHELL' | |
| 162 | tmux new-window -n 'bb' '$SHELL' | |
| 163 | tmux new-window -n 'cc' '$SHELL' | |
| 164 | tmux new-window -n 'dd' '$SHELL' | |
| 165 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 166 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 167 | tmux attach | |
| 168 | ``` | |
| 169 | Start `roscore` by hand in one terminal. In another terminal, publish | |
| 170 | something: | |
| 171 | ``` | |
| 172 | rostopic pub -r 5 /foo std_msgs/String '{data: hallooooo}' | |
| 173 | ``` | |
| 174 | In a third terminal, subscribe: | |
| 175 | ``` | |
| 176 | rostopic echo /foo | |
| 177 | ``` | |
| 178 | Yayy! This works! Can we subscribe to this topic outside of this | |
| 179 | container? No, we cannot. Here's how to check. Inside a terminal, say | |
| 180 | `ifconfig` and get the IP address of the container. Its will probably be | |
| 181 | `172.17.0.2`. Alternately, you can get this number from the outside, | |
| 182 | with | |
| 183 | ``` | |
| 184 | docker inspect opencog-eva-ros | grep IPAdress | |
| 185 | ``` | |
| 186 | We can now attempt to contact ROS from the outside world. First, set | |
| 187 | ``` | |
| 188 | export ROS_MASTER_URI=http://172.17.0.2:11311 | |
| 189 | ``` | |
| 190 | Now, ROS will *almost* work. But not quite. This works: | |
| 191 | ``` | |
| 192 | rostopic list | |
| 193 | rostopic info /foo | |
| 194 | ``` | |
| 195 | This fails (it hangs): | |
| 196 | ``` | |
| 197 | rostopic echo /foo | |
| 198 | ``` | |
| 199 | The reason that this is broken is because ROS messages themselves contain | |
| 200 | tcpip port numbers, and Docker uses a form of port proxying and | |
| 201 | firewalling (iptables) that remaps ports. Thus, port numbers inside the | |
| 202 | container do not match the port number contained in the message, when | |
| 203 | that message is coming from outside the container. This mis-match is at | |
| 204 | the root of the hang. | |
| 205 | ||
| 206 | Curiously, the reversed process works: if you publish on the outside, | |
| 207 | then you can subscribe on the inside, just fine. | |
| 208 | ||
| 209 | This issue prevents the natural separation between OpenCog and Eva-ROS. | |
| 210 | The Eva-ROS container is publishing `/camera/face_locations` and OpenCog | |
| 211 | subscribes to that to find out about the location of human faces visible | |
| 212 | to Eva. Since the messages never arrive, Eva is blind, and sees | |
| 213 | nothing. | |
| 214 | ||
| 215 | ## Version B: New Docker networking. | |
| 216 | Starting with Docker version 1.9 (the current version in Ubuntu 14.04 | |
| 217 | trusty LTS), docker introduces a networking overlay. This seems like it | |
| 218 | is almost enough to get ROS working in Docker, and there are even some | |
| 219 | 'famous' highly visible tutorials for this: | |
| 220 | ||
| 221 | * [Official ROS Docker Tutorial](http://wiki.ros.org/docker/Tutorials/Docker) | |
| 222 | * [Todd Sampson Blog](http://toddsampson.com/post/131227320927/docker-experimental-networking-and-ros) | |
| 223 | ||
| 224 | However, these tutorials are misleading: Some stuff works, but other, | |
| 225 | different stuff breaks, and the original problem remains unsolved. This | |
| 226 | can be reproduced as described below. Their success depends on using | |
| 227 | Docker networks, and being very very careful -- diligently careful -- | |
| 228 | about setting ROS environment variables. This makes the whole process | |
| 229 | very fragile, and subject to lots of confusion. YMMV. | |
| 230 | ||
| 231 | First, create a Docker network: | |
| 232 | ``` | |
| 233 | docker network create boingo | |
| 234 | ``` | |
| 235 | Start three ROS containers. One, called the `master`, will contain | |
| 236 | `roscore`. The other two will publish and subscribe to each-other. | |
| 237 | There are several ways to start these, including the setting of ROS | |
| 238 | environment variables during startup. This won't be done for this | |
| 239 | example, since it clouds the issue: it confuses what is really | |
| 240 | happening. The environment variables can be set by hand, after | |
| 241 | startup. Start the containers as follows: | |
| 242 | ``` | |
| 243 | docker run --net=boingo --name=master -p 11311:11311 -it opencog/ros-indigo-base | |
| 244 | docker run --net=boingo --name=aaa -p 11311:11311 -it opencog/ros-indigo-base | |
| 245 | docker run --net=boingo --name=bbb -p 11311:11311 -it opencog/ros-indigo-base | |
| 246 | ``` | |
| 247 | Note the `--net=boingo` parameter. This causes Docker to use a different | |
| 248 | set of network addresses. It also alters how Docker does port proxying. | |
| 249 | Although the proxying is different, the core issue of re-labelling port | |
| 250 | numbers remains: the ROS messages still have port numbers in them that | |
| 251 | fail to match up with the actual port assignments. Let's plow onwards. | |
| 252 | ||
| 253 | Start `roscore` inside container `master`. Next, inside `aaa`, do this: | |
| 254 | ``` | |
| 255 | export ROS_HOSTNAME=aaa | |
| 256 | export ROS_MASTER_URI=http://master:11311 | |
| 257 | rostopic pub -r 5 /bar std_msgs/String '{data: olaaa}' | |
| 258 | ``` | |
| 259 | while inside `bbb`, do this: | |
| 260 | ``` | |
| 261 | export ROS_HOSTNAME=bbb | |
| 262 | export ROS_MASTER_URI=http://master:11311 | |
| 263 | rostopic echo /bar | |
| 264 | ``` | |
| 265 | Yayyy! This works! They can hear each other! This is the sum-total of | |
| 266 | the widely-publicized, easy-to-find ROS+Docker tutorials all over the | |
| 267 | net. That all is not right heaven is easy to see. Outside of the | |
| 268 | containers, `rostopic list` and `rostopic info /bar` works just as | |
| 269 | before, and `rostopic echo /bar` still fails, as before. Unlike before, | |
| 270 | however, there is now a new failure: go to container `aaa`, and, in a | |
| 271 | new tmux terminal, try `rostopic echo /bar` -- it doesn't work!!! This | |
| 272 | is a new failure: subscribers can no longer hear publishers living | |
| 273 | inside the same container! Be careful to export the `ROS_HOSTNAME` | |
| 274 | correctly in the new tmux terminal; failing to do this adds to the | |
| 275 | confusion. You may experiment at this point: you won't get lucky, | |
| 276 | though, even though it seems like you might, with just one more try. | |
| 277 | ||
| 278 | This new failure mode forces one to a new design point that might seem | |
| 279 | reasonable, but is ultimately untenable: one ROS node per container. | |
| 280 | This might almost work, although its terribly fragile. Debugging is | |
| 281 | hard, because if you're outside a container, you cannot hear what they | |
| 282 | are passing around to each-other. Altering the network structure | |
| 283 | becomes difficult. Using tools like `rviz` to visualize the ROS network | |
| 284 | becomes difficult, because you now have to put `rviz` in it's own Docker | |
| 285 | container, and then punch a hole through it to get the graphs to | |
| 286 | display on your screen. It devolves from there, and by the time you get | |
| 287 | to OpenCog, you've got the cogserver launching one python thread for ROS | |
| 288 | messaging, while other threads send scheme over other sockets, while yet | |
| 289 | more threads are handling tcpip sockets to IRC, and messages are flying | |
| 290 | every-which way. It appears that the Docker philosophy of "one process | |
| 291 | per container" is untenable, in any practical sense. Its too hard to | |
| 292 | manage, too hard to configure and control. Perhaps Docker Swarm might | |
| 293 | one day help with this, but perhaps not: Swarm seems to push the problem | |
| 294 | around; it doesn't solve the core issue: ROS messages contain port | |
| 295 | numbers, and Docker proxying re-assigns ports. That is the core issue. | |
| 296 | ||
| 297 | ## Version B.1: Newer version of Docker?? | |
| 298 | [It has been reported](https://gist.github.com/ruffsl/4a24c26a1aa2cc733c64) | |
| 299 | that perhaps version 1.10 of docker does not have these problems. I | |
| 300 | have not yet tried. | |
| 301 | ||
| 302 | ## Version C: Desperation. | |
| 303 | There are several stunts that one might think could work, but they | |
| 304 | don't. A brief report here. | |
| 305 | ||
| 306 | ### Remap all the ports | |
| 307 | That is, start the Docker container with something like this: | |
| 308 | `-p 32768-65536:32768-65536`. *DO NOT EVEN TRY THIS* -- you'll be | |
| 309 | sorry if you do. If you do, it will take Docker five minutes to remap | |
| 310 | about 2K of these ports, at which point you will wonder what's going | |
| 311 | on. What its doing is creating a process `docker-proxy -proto tcp | |
| 312 | -host-ip 0.0.0.0 -host-port 60374 -container-ip 172.18.0.2 | |
| 313 | -container-port 60374` -- one for each port. So `ps ax |grep docker |wc` | |
| 314 | will tell you how many its done so far. Problem: you can't stop the | |
| 315 | container. You can `kill -9` it, but the proxying keeps going on. We're | |
| 316 | in a bad state now, so you can try `service docker stop` which won't | |
| 317 | work, so you can `kill -9` it. Which works. However `service docker | |
| 318 | start` leaves vast quantities of crap in `iptables`, which you can | |
| 319 | clean with `iptables -t nat -F`. However, `service docker start` merely | |
| 320 | recreates these bogus filters. So you have to `iptables` while Docker is | |
| 321 | running. Which hoses Docker, so you have to stop and restart again. | |
| 322 | Anyway, the unclean docker shutdown also left crap in `aufs` -- some | |
| 323 | dead docker containers that cannot be `docker rm`'ed. If you are brave, | |
| 324 | you can now go into `/var/lib/docker/aufs` and clean up by hand. Or | |
| 325 | you can reboot ... Ugh. | |
| 326 | ||
| 327 | ### Speaking of iptables... | |
| 328 | Several stack-exchange questions deal with using `iptables` to remap | |
| 329 | ports between docker containers and the host. If you're naive, you might | |
| 330 | hope that that will solve the problem. It won't. The core issue is that | |
| 331 | ROS messages contain port numbers in them, and Docker remaps ports. The | |
| 332 | only way that masquerading could be don't would be just like | |
| 333 | masquerading for FTP: you have to inspect the packets themselves, find | |
| 334 | the port number in them, and then re-write the port number. Since some | |
| 335 | ROS messages are strings, this can be challenging. Checksums and gzip | |
| 336 | add to the mess. | |
| 337 | ||
| 338 | ### Use the host network | |
| 339 | Start all of the containers with `--net=host`. This will cause Docker | |
| 340 | to not use its own private networks, but instead, use the IP address of | |
| 341 | the host for all networking. From the Docker point of view, its really | |
| 342 | not ideal, its a kind-of-a-hack. From the ROS point of view, you might | |
| 343 | expect that everything will now start working, since, after all, there | |
| 344 | are no more networking barriers anywhere. Right? Almost! | |
| 345 | ||
| 346 | With this network setting, you can now publish, with `rostopic pub` | |
| 347 | inside the container, and subscribe, with `rostopic echo` on the | |
| 348 | outside, and this now works. The toy example works! At last! Woot! | |
| 349 | ||
| 350 | Unfortunately, that's all that works. The real-life ROS nodes inside the | |
| 351 | ros-eva container are publishing messages that still cannot be heard | |
| 352 | outside of the container: specifically, `rostopic echo /camera/face_locations` | |
| 353 | fails. You might think that it should work. It doesn't. I don't | |
| 354 | understand why it doesn't, when the toy examples do work. Clearly, | |
| 355 | there's yet more to ROS networking, and the Docker `--net=host` is not | |
| 356 | enough to make things transparent. | |
| 357 | ||
| 358 | ## Version D: Hard reality | |
| 359 | The misery documented above points us in only one direction. Its not a | |
| 360 | pretty one... its not `docker compose` and its conceptually icky and | |
| 361 | not a good software design. However, its the only solution that works: | |
| 362 | Stick all of OpenCog (specifically, the CogServer) into the same Docker | |
| 363 | container with ROS. That will be one giant bloated container. But | |
| 364 | that's what the school of hard knocks teaches you. |
| … | … | @@ -0,0 +1,40 @@ |
| 1 | # | |
| 2 | # Container for the Hanson Robotics Arthur head (demo version) | |
| 3 | # This provides just enough infrastructure to run the Arthur rig | |
| 4 | # in an animation mode. | |
| 5 | # | |
| 6 | # To build: | |
| 7 | # sudo docker build -t opencog/ros-indigo-animation . | |
| 8 | # | |
| 9 | # opencog/ros-indigo-blender provides ROS+blender+catkin | |
| 10 | FROM opencog/ros-indigo-blender | |
| 11 | MAINTAINER Linas Vepstas "linasvepstas@gmail.com" | |
| 12 | ||
| 13 | WORKDIR /catkin_ws/src | |
| 14 | ||
| 15 | # Packages to install | |
| 16 | # The basic_head_api repo contains the messages | |
| 17 | RUN git clone https://github.com/hansonrobotics/basic_head_api | |
| 18 | # The robo_blender contains the head and animation scripts | |
| 19 | RUN git clone https://github.com/hansonrobotics/robo_blender | |
| 20 | # The pau2motors is where required PAU messages are defined | |
| 21 | RUN git clone https://github.com/hansonrobotics/pau2motors | |
| 22 | ||
| 23 | # Change line below to rebuild. Will use cached docker iamges up to | |
| 24 | # this line | |
| 25 | ENV LAST_SOFTWARE_UPDATE 2014-12-18 | |
| 26 | ||
| 27 | # Git pull for all packages | |
| 28 | RUN find . -maxdepth 1 -mindepth 1 -type d \ | |
| 29 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 30 | ||
| 31 | # Must source and make in same run, else the env is lost!?? | |
| 32 | WORKDIR /catkin_ws | |
| 33 | RUN . /opt/ros/indigo/setup.sh; /opt/ros/indigo/bin/catkin_make | |
| 34 | ||
| 35 | ADD /scripts/arthur.sh /catkin_ws/arthur.sh | |
| 36 | ADD /scripts/demo-hints.txt /catkin_ws/demo-hints.txt | |
| 37 | RUN chmod ugo+x ./arthur.sh | |
| 38 | CMD ./arthur.sh | |
| 39 | ||
| 40 | # CMD /bin/bash |
| … | … | @@ -0,0 +1,26 @@ |
| 1 | ||
| 2 | Facial Expression Animation Demo | |
| 3 | ================================ | |
| 4 | ||
| 5 | Demo of controlling basic facial animations with the Hanson Robotics | |
| 6 | Arthur blender head. Running this container will start the Arthur head | |
| 7 | in animation mode, and then print a short menu of suggested animations | |
| 8 | to try out. Facial expressions include 'happy', 'sad', 'surprised' and | |
| 9 | 'angry'. The animations are started and stopped using ROS messages. See | |
| 10 | the 'demo-hints.txt' file in this directory for the demo instructions. | |
| 11 | ||
| 12 | The demo can be started by saying `./run.sh` and can be halted by saying | |
| 13 | `./stop.sh`. | |
| 14 | ||
| 15 | Alternately, you can run this image by saying: | |
| 16 | ``` | |
| 17 | xhost + | |
| 18 | sudo docker run --rm --privileged -i \ | |
| 19 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 20 | -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm \ | |
| 21 | -e DISPLAY=:0.0 -t opencog/ros-indigo-animation | |
| 22 | ||
| 23 | # When done: | |
| 24 | xhost - | |
| 25 | ``` | |
| 26 |
| … | … | @@ -0,0 +1,19 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # run.sh | |
| 4 | # | |
| 5 | # Usage: ./run.sh | |
| 6 | # | |
| 7 | # This will start the docker container for demoing the Arthur head. | |
| 8 | # The container can be stopped with ./stop.sh | |
| 9 | # | |
| 10 | echo -n 'Stopping leftover container.. ' | |
| 11 | docker stop -t 1 arthur-animation-demo | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm arthur-animation-demo | |
| 14 | xhost + | |
| 15 | docker run --name="arthur-animation-demo" --privileged \ | |
| 16 | -e DISPLAY=:0.0 \ | |
| 17 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 18 | -v /dev/shm:/dev/shm -it opencog/ros-indigo-animation | |
| 19 | xhost - |
| … | … | @@ -0,0 +1,25 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # arthur.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics animation demo | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 14 | sleep 2; | |
| 15 | byobu new-window -n 'blender' 'cd /catkin_ws/src/robo_blender/src && blender animate-test.blend --enable-autoexec --python startup.py; $SHELL' | |
| 16 | sleep 6; | |
| 17 | byobu new-window -n 'cmdline' 'echo \"going into animation mode ...\"; rostopic pub --once /cmd_blendermode std_msgs/String Animations; clear; cat /catkin_ws/demo-hints.txt; $SHELL -l' | |
| 18 | ||
| 19 | # Fix the annoying byobu display | |
| 20 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 21 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 22 | tmux attach | |
| 23 | ||
| 24 | echo "Started" | |
| 25 | $SHELL |
| … | … | @@ -0,0 +1,22 @@ |
| 1 | # To use this head, try doing these things: | |
| 2 | # | |
| 3 | # Obtain the list of supported animations. The result should show: | |
| 4 | # actions: ['angry-1', 'sad-1', 'happy-1', 'surprised-1'] | |
| 5 | rostopic echo -n 1 /animations_list | |
| 6 | ||
| 7 | # Perform one of the supported animations | |
| 8 | rostopic pub --once /cmd_animations std_msgs/String play:sad-1 | |
| 9 | ||
| 10 | # Verify that tracking output is sent to the PAU motors | |
| 11 | rostopic echo /dmitry/cmd_eyes_pau | |
| 12 | ||
| 13 | # Pause the animation | |
| 14 | rostopic pub --once /cmd_animations std_msgs/String pause | |
| 15 | ||
| 16 | # Restart the animation | |
| 17 | rostopic pub --once /cmd_animations std_msgs/String play | |
| 18 | ||
| 19 | # Halt the animation | |
| 20 | rostopic pub --once /cmd_animations std_msgs/String stop | |
| 21 | ||
| 22 | # View this help text again, say 'cat /catkin_ws/demo-hints.txt' |
| … | … | @@ -0,0 +1,12 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # stop.sh | |
| 4 | # | |
| 5 | # Usage: ./stop.sh | |
| 6 | # | |
| 7 | # This will stop and remove a running docker container started with run.sh | |
| 8 | # | |
| 9 | echo -n 'Stopping leftover container.. ' | |
| 10 | docker stop -t 1 arthur-animation-demo | |
| 11 | echo -n 'Removing.. ' | |
| 12 | docker rm arthur-animation-demo |
| … | … | @@ -0,0 +1,75 @@ |
| 1 | # | |
| 2 | # Container for the Hanson Robotics Arthur head (full version) | |
| 3 | # This provides the complete running package for the demo head, | |
| 4 | # including UVC webcam vision input, pi_vision to discover faces, | |
| 5 | # behavior controled by owyl trees, and the full motor control output. | |
| 6 | # | |
| 7 | # To build: | |
| 8 | # sudo docker build -t opencog/ros-arthur-dev . | |
| 9 | # | |
| 10 | FROM opencog/ros-indigo-blender | |
| 11 | MAINTAINER Vytas Krisciunas "vytas@hansonrobotics.com" | |
| 12 | MAINTAINER Linas Vepstas "linasvepstas@gmail.com" | |
| 13 | ||
| 14 | # Install required packages | |
| 15 | RUN apt-get -y update | |
| 16 | RUN apt-get -y install ros-indigo-openni-camera ros-indigo-mjpeg-server \ | |
| 17 | ros-indigo-rosbridge-server ros-indigo-tf ros-indigo-audio-common \ | |
| 18 | ros-indigo-driver-common | |
| 19 | RUN apt-get -y install python-serial python-pycurl python-pyglet python-pip | |
| 20 | RUN apt-get -y install mplayer | |
| 21 | # RUN apt-get -y install libcurl3 libavbin-dev libavbin0 libav-tools | |
| 22 | ||
| 23 | # Install pi_vision | |
| 24 | WORKDIR /opt/ros/indigo/share | |
| 25 | RUN git clone https://github.com/ericperko/uvc_cam.git | |
| 26 | RUN git clone -b multiple_2d https://github.com/hansonrobotics/pi_vision.git | |
| 27 | RUN bash -l -c "source /.bashrc;rosmake pi_vision" | |
| 28 | ||
| 29 | # Owyl setup | |
| 30 | WORKDIR /opt/ | |
| 31 | RUN git clone https://github.com/eykd/owyl.git | |
| 32 | WORKDIR /opt/owyl/ | |
| 33 | RUN python setup.py install | |
| 34 | ||
| 35 | # Install catkin packages | |
| 36 | WORKDIR /catkin_ws/src | |
| 37 | ||
| 38 | # The basic_head_api repo contains the messages | |
| 39 | RUN git clone https://github.com/hansonrobotics/basic_head_api | |
| 40 | # The robo_blender contains the head and animation scripts | |
| 41 | RUN git clone https://github.com/hansonrobotics/robo_blender | |
| 42 | # The pau2motors is where required PAU messages are defined | |
| 43 | RUN git clone https://github.com/hansonrobotics/pau2motors | |
| 44 | ||
| 45 | RUN git clone https://github.com/hansonrobotics/ros_pololu_servo.git | |
| 46 | RUN git clone https://github.com/hansonrobotics/ros_motors_webui.git | |
| 47 | RUN git clone https://github.com/hansonrobotics/robots_config.git | |
| 48 | RUN git clone https://github.com/hansonrobotics/chatbot.git | |
| 49 | RUN git clone https://github.com/hansonrobotics/eva_behavior.git | |
| 50 | RUN git clone https://github.com/hansonrobotics/ros_faceshift.git | |
| 51 | ||
| 52 | # Change line below to rebuild. Will use cache up to this line | |
| 53 | ENV LAST_SOFTWARE_UPDATE 2014-12-08 | |
| 54 | ||
| 55 | # Git pull for all packages | |
| 56 | RUN find . -maxdepth 1 -mindepth 1 -type d \ | |
| 57 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 58 | ||
| 59 | # CMake | |
| 60 | WORKDIR /catkin_ws | |
| 61 | RUN bash -l -c "/usr/bin/python3 /opt/ros/indigo/bin/catkin_make" | |
| 62 | ||
| 63 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc | |
| 64 | ||
| 65 | #Ports exposed | |
| 66 | EXPOSE 9090 | |
| 67 | EXPOSE 80 | |
| 68 | EXPOSE 33433 | |
| 69 | ||
| 70 | # The launch script | |
| 71 | ADD /scripts/arthur-dev.sh /catkin_ws/arthur-dev.sh | |
| 72 | RUN chmod ugo+x ./arthur-dev.sh | |
| 73 | ||
| 74 | ENTRYPOINT bash -l -c "cd /catkin_ws/; ./arthur-dev.sh; bash" | |
| 75 |
| … | … | @@ -0,0 +1,34 @@ |
| 1 | ||
| 2 | Robot Head Development | |
| 3 | ====================== | |
| 4 | ||
| 5 | Full configuration for animating the Hanson Robotics Arthur blender | |
| 6 | head. Running this container will start the UVC video camera drivers, | |
| 7 | the pi_vision face discovery module, the eva_behavior module that | |
| 8 | implements scrripted behaviors, two blender windows for the Arthur head, | |
| 9 | the PAU-2-motor control module, and the Pololu brand motor controllers. | |
| 10 | The Web user interfaces is also started. | |
| 11 | ||
| 12 | The behavior of the robot head can be controlled by aiming a web browser | |
| 13 | at http://localhost. This uses the default http port number of 80; this | |
| 14 | can be changed in the `run.sh` startup file. | |
| 15 | ||
| 16 | By default, the `/dev/video0` device is used as a webcam for face | |
| 17 | tracking. It can be changed in `run.sh` file. | |
| 18 | ||
| 19 | The container can be started by saying `./run.sh` and can be halted by | |
| 20 | saying `./stop.sh`. | |
| 21 | ||
| 22 | Alternately, you can run this image by saying: | |
| 23 | ``` | |
| 24 | xhost + | |
| 25 | sudo docker run --rm --privileged -i \ | |
| 26 | -p 33433:33433 -p 80:80 -p 9090:9090 \ | |
| 27 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 28 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 29 | -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm \ | |
| 30 | -e DISPLAY=:0.0 -t opencog/ros-arthur-dev | |
| 31 | ||
| 32 | # When done: | |
| 33 | xhost - | |
| 34 | ``` |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build the arthuer docker image | |
| 6 | # | |
| 7 | docker build -t opencog/ros-arthur-dev . |
| … | … | @@ -0,0 +1,21 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # run.sh | |
| 4 | # | |
| 5 | # Usage: ./run.sh | |
| 6 | # | |
| 7 | # This will start the docker container for the full Arthur head. | |
| 8 | # The container can be stopped with ./stop.sh | |
| 9 | # | |
| 10 | echo -n 'Stopping leftover container.. ' | |
| 11 | docker stop -t 1 hr-arthur-devel | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm hr-arthur-devel | |
| 14 | xhost + | |
| 15 | docker run --name="hr-arthur-devel" --privileged \ | |
| 16 | -e DISPLAY=:0.0 \ | |
| 17 | -p 33433:33433 -p 80:80 -p 9090:9090 \ | |
| 18 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 19 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 20 | -v /dev/shm:/dev/shm -it opencog/ros-arthur-dev | |
| 21 | xhost - |
| … | … | @@ -0,0 +1,40 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # arthur-dev.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics animation demo | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work | |
| 15 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 16 | sleep 2; | |
| 17 | tmux new-window -n 'arthur' 'roslaunch robots_config arthur-dev.launch; $SHELL' | |
| 18 | sleep 6; | |
| 19 | ||
| 20 | # Start web server for providing a nice UI for the animations. | |
| 21 | tmux new-window -n 'rosbridge' 'roslaunch rosbridge_server rosbridge_websocket.launch' | |
| 22 | tmux new-window -n 'webserver' 'cd /catkin_ws/src/ros_motors_webui && python -m SimpleHTTPServer 80; $SHELL' | |
| 23 | ||
| 24 | # One blender session for object tracking, another for animations | |
| 25 | tmux new-window -n 'blndr-trk' 'cd /catkin_ws/src/robo_blender/src && blender robo.blend --enable-autoexec --python startup.py; $SHELL' | |
| 26 | tmux new-window -n 'blndr-anim' 'cd /catkin_ws/src/robo_blender/src && blender animate-test.blend --enable-autoexec --python startup.py; $SHELL' | |
| 27 | ||
| 28 | # Video camera and face tracker | |
| 29 | tmux new-window -n 'camera' 'roslaunch ros2opencv uvc_cam.launch' | |
| 30 | tmux new-window -n 'face' 'roslaunch pi_face_tracker face_tracker_uvc_cam.launch' | |
| 31 | ||
| 32 | # Spare-usage shell | |
| 33 | tmux new-window -n 'bash' '$SHELL' | |
| 34 | ||
| 35 | # Fix the annoying byobu display | |
| 36 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 37 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 38 | tmux attach | |
| 39 | ||
| 40 | echo "Started" |
| … | … | @@ -0,0 +1,12 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # stop.sh | |
| 4 | # | |
| 5 | # Usage: ./stop.sh | |
| 6 | # | |
| 7 | # This will stop and remove a running docker container started with run.sh | |
| 8 | # | |
| 9 | echo -n 'Stopping leftover container.. ' | |
| 10 | docker stop -t 1 hr-arthur-devel | |
| 11 | echo -n 'Removing.. ' | |
| 12 | docker rm hr-arthur-devel |
| … | … | @@ -0,0 +1,25 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build-all.sh | |
| 4 | # | |
| 5 | # Handy dandy snippet to build the current demo images. | |
| 6 | # | |
| 7 | cd ros-base | |
| 8 | ./build.sh | |
| 9 | cd .. | |
| 10 | ||
| 11 | cd ros-opencog | |
| 12 | ./build.sh | |
| 13 | cd .. | |
| 14 | ||
| 15 | cd ros-incog-blender | |
| 16 | ./build.sh | |
| 17 | cd .. | |
| 18 | ||
| 19 | # cd eva-silent | |
| 20 | # ./build.sh | |
| 21 | # cd .. | |
| 22 | ||
| 23 | cd eva-opencog | |
| 24 | ./build.sh | |
| 25 | cd .. |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build-old.sh | |
| 4 | # | |
| 5 | # Handy dandy snippet to build the old images. | |
| 6 | # | |
| 7 | cd ros-base | |
| 8 | ./build.sh | |
| 9 | cd .. | |
| 10 | ||
| 11 | cd ros-blender | |
| 12 | ./build.sh | |
| 13 | cd .. | |
| 14 | ||
| 15 | cd eva-owyl | |
| 16 | ./build.sh | |
| 17 | cd .. |
| … | … | @@ -0,0 +1,36 @@ |
| 1 | # docker build -t opencog/ros-indigo-dev . | |
| 2 | # xhost + | |
| 3 | # docker run -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -i -t opencog/ros-indigo-dev /bin/bash | |
| 4 | # docker run -t -i --rm --privileged -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /home/mandeep/sharedFolder:/tmp/shared -v /dev/video0:/dev/video0 mandeep/ros-indigo-dev /bin/bash | |
| 5 | ||
| 6 | FROM opencog/ros-indigo-base | |
| 7 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 8 | MAINTAINER David Hart "dhart@opencog.org" | |
| 9 | ||
| 10 | # Fake a fuse install; openjdk pulls this in | |
| 11 | # https://github.com/dotcloud/docker/issues/514 | |
| 12 | # https://gist.github.com/henrik-muehe/6155333 | |
| 13 | RUN mkdir -p /tmp/fuse-hack && cd /tmp/fuse-hack && \ | |
| 14 | apt-get install libfuse2 && \ | |
| 15 | apt-get download fuse && \ | |
| 16 | dpkg-deb -x fuse_* . && \ | |
| 17 | dpkg-deb -e fuse_* && \ | |
| 18 | rm fuse_*.deb && \ | |
| 19 | echo -en '#!/bin/bash\nexit 0\n' > DEBIAN/postinst && \ | |
| 20 | dpkg-deb -b . /fuse.deb && \ | |
| 21 | dpkg -i /fuse.deb && \ | |
| 22 | rm -rf /tmp/fuse-hack | |
| 23 | ||
| 24 | RUN apt-get -y update | |
| 25 | RUN apt-get -y install camorama geany | |
| 26 | RUN apt-get -y install cmake-curses-gui git mercurial subversion | |
| 27 | RUN apt-get -y install less meld vim-gnome | |
| 28 | ||
| 29 | # Environment Variables | |
| 30 | ## Set Locale -- Catkin crashes on Krisčiunas, Mickevičius without this. | |
| 31 | RUN locale-gen en_US.UTF-8 | |
| 32 | ENV LANG en_US.UTF-8 | |
| 33 | ENV LANGUAGE en_US:en | |
| 34 | ENV LC_ALL en_US.UTF-8 | |
| 35 | ||
| 36 | CMD /bin/bash |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build this docker image. | |
| 6 | # | |
| 7 | docker build -t opencog/ros-indigo-dev . |
| … | … | @@ -0,0 +1,22 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # General docker cleanup. Handy if you've been ahcking and need the | |
| 4 | # accumulated juk to be blown away. Use at your own risk. | |
| 5 | # | |
| 6 | # First, remove the non-running containers. | |
| 7 | # docker rm $(docker ps -aq -f "status=exited") | |
| 8 | TAINERS=`docker ps -aq -f "status=exited" -f "status=dead"` | |
| 9 | if test x"$TAINERS" != x; then | |
| 10 | echo -n 'Removing exited containers...' | |
| 11 | docker rm $TAINERS | |
| 12 | fi | |
| 13 | ||
| 14 | # Next, remove failed images. | |
| 15 | # docker rmi $(docker images -q -f "dangling=true") | |
| 16 | MAGES=`docker images -q -f "dangling=true"` | |
| 17 | if test x"$MAGES" != x; then | |
| 18 | echo -n 'Removing dangling images' | |
| 19 | docker rmi $MAGES | |
| 20 | fi | |
| 21 | ||
| 22 | # docker rmi $(docker images --filter dangling=true) |
| … | … | @@ -0,0 +1,57 @@ |
| 1 | # docker build -t opencog/ros-indigo-blender . | |
| 2 | # xhost + | |
| 3 | # docker run --rm --privileged -i -v /dev/ttyACM0:/dev/ttyACM0 -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 -p 33433:33433/udp -t opencog/ros-indigo-blender | |
| 4 | # Note: port 33433=faceshift, /dev/ttyACM0=pololu, /dev/dri=gpu, /dev/shm=gpu | |
| 5 | ### Blender: click Run Script | |
| 6 | ### Blender: right-click & drag target (blue cube) | |
| 7 | # ToDo: add MORSE robot simulator | |
| 8 | # replace faceshift with OpenCV FaceRecognizer, etc. | |
| 9 | ||
| 10 | FROM opencog/ros-indigo-dev | |
| 11 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 12 | MAINTAINER David Hart "dhart@opencog.org" | |
| 13 | ||
| 14 | RUN apt-get -y update | |
| 15 | RUN apt-get -y install blender | |
| 16 | ||
| 17 | RUN apt-get -y install python3-yaml python3-pip | |
| 18 | RUN pip3 install rospkg catkin_pkg | |
| 19 | ||
| 20 | RUN echo source /catkin_ws/devel/setup.bash >> /.bash_profile && \ | |
| 21 | echo -e "\e[1;34m[$SELF_NAME] catkin devel setup\.bash sourced\e[0m" | |
| 22 | ||
| 23 | WORKDIR /catkin_ws/src | |
| 24 | RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh | |
| 25 | ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages | |
| 26 | RUN /usr/bin/python3 /opt/ros/indigo/bin/catkin_init_workspace | |
| 27 | ||
| 28 | RUN git clone https://github.com/hansonrobotics/robo_blender | |
| 29 | RUN git clone https://github.com/yantrabuddhi/ros_pololu_servo | |
| 30 | RUN git clone https://github.com/yantrabuddhi/ros_nmpt_saliency | |
| 31 | RUN git clone https://github.com/yantrabuddhi/ros_faceshift | |
| 32 | RUN git clone https://github.com/yantrabuddhi/simple_face_tracker | |
| 33 | RUN git clone https://github.com/OctoMap/octomap | |
| 34 | ||
| 35 | WORKDIR /catkin_ws | |
| 36 | RUN bash -l -c "/usr/bin/python3 /opt/ros/indigo/bin/catkin_make" | |
| 37 | ||
| 38 | WORKDIR /catkin_ws/src/robo_blender/src | |
| 39 | ||
| 40 | ENV STARTSCRIPT "\ | |
| 41 | echo evaluating startup script... &&\ | |
| 42 | source /catkin_ws/devel/setup.bash &&\ | |
| 43 | tmux new-session -d 'echo -e \"\e[1;34mroscore\e[0m\" ; roscore' &&\ | |
| 44 | tmux set -g set-remain-on-exit on &&\ | |
| 45 | tmux set-option -g set-remain-on-exit on &&\ | |
| 46 | tmux bind-key R respawn-window &&\ | |
| 47 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_pololu_servo\e[0m\" ;\ | |
| 48 | rosrun ros_pololu_servo ros_pololu_servo_node' &&\ | |
| 49 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mblender robo.blend\e[0m\" ;\ | |
| 50 | sleep 4 && blender robo.blend' &&\ | |
| 51 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mbash shell\e[0m\" ;\ | |
| 52 | bash -l -i' &&\ | |
| 53 | tmux select-layout even-vertical &&\ | |
| 54 | tmux attach \ | |
| 55 | " | |
| 56 | ||
| 57 | CMD /bin/bash -l -c "eval $STARTSCRIPT" |
| … | … | @@ -0,0 +1,8 @@ |
| 1 | ros-indigo-einstein | |
| 2 | =================== | |
| 3 | ||
| 4 | An integrated development container for teleoperating Hanson Robotics' small | |
| 5 | Einstein head. This container was demo'd at ROS Kong 2014 by David Hanson. | |
| 6 | ||
| 7 | The Einstein head contains servos driven by a Pololu board and controlled | |
| 8 | via Blender. Saliency detection is TBD. |
| … | … | @@ -0,0 +1,10 @@ |
| 1 | #!/bin/bash | |
| 2 | echo "Starting" | |
| 3 | tmux new-session -n 'einstein' -d ' roslaunch robots_config einstein.launch; $SHELL' | |
| 4 | sleep 5; | |
| 5 | export ROS_NAMESPACE=/einstein | |
| 6 | tmux new-window -n 'rosbridge' 'roslaunch rosbridge_server rosbridge_websocket.launch; $SHELL' | |
| 7 | tmux new-window -n 'webserver' 'cd /catkin_ws/src/ros_motors_webui && python -m SimpleHTTPServer; $SHELL' | |
| 8 | tmux attach; | |
| 9 | echo "Started" | |
| 10 |
| … | … | @@ -0,0 +1,95 @@ |
| 1 | # | |
| 2 | # Container for the OpenCog-based Hanson Robotics Eva robot. | |
| 3 | # This is the whole kit-n-kaboodle. Under development, probably | |
| 4 | # broken. | |
| 5 | # | |
| 6 | # To build: | |
| 7 | # sudo docker build -t opencog/eva-opencog . | |
| 8 | # | |
| 9 | FROM opencog/ros-incog-blender | |
| 10 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 11 | ||
| 12 | # Install required packages | |
| 13 | ENV LAST_OS_UPDATE 2015-02-16 | |
| 14 | RUN apt-get -y update | |
| 15 | RUN apt-get -y upgrade | |
| 16 | # The perception node needs ros-indigo-dynamixel-msgs and | |
| 17 | # the joint/robot-state publishers | |
| 18 | RUN apt-get -y install ros-indigo-tf ros-indigo-driver-common \ | |
| 19 | ros-indigo-cv-bridge ros-indigo-image-transport \ | |
| 20 | ros-indigo-openni-camera ros-indigo-mjpeg-server \ | |
| 21 | ros-indigo-usb-cam \ | |
| 22 | ros-indigo-dynamixel-msgs \ | |
| 23 | ros-indigo-robot-state-publisher \ | |
| 24 | ros-indigo-joint-state-publisher | |
| 25 | ||
| 26 | # Install catkinized packages | |
| 27 | WORKDIR /catkin_ws/src | |
| 28 | ||
| 29 | RUN git clone https://github.com/hansonrobotics/pi_vision.git | |
| 30 | RUN git clone https://github.com/hansonrobotics/perception.git | |
| 31 | RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git | |
| 32 | RUN git clone https://github.com/hansonrobotics/blender_api.git | |
| 33 | ||
| 34 | # The pau2motors package defines the PAU messages, which are | |
| 35 | # needed by the perception (vision-geometry) module. | |
| 36 | RUN git clone https://github.com/hansonrobotics/pau2motors.git | |
| 37 | RUN git clone https://github.com/hansonrobotics/robots_config.git | |
| 38 | ||
| 39 | # The OpenCog github account mirrors all of the Hanson Robotics | |
| 40 | # software. At this time, the two are in sync with each-other. | |
| 41 | # RUN git clone https://github.com/opencog/pi_vision.git | |
| 42 | # RUN git clone https://github.com/opencog/perception.git | |
| 43 | # RUN git clone https://github.com/opencog/blender_api_msgs.git | |
| 44 | # RUN git clone https://github.com/opencog/blender_api.git | |
| 45 | # RUN git clone https://github.com/opencog/pau2motors.git | |
| 46 | # RUN git clone https://github.com/opencog/robots_config.git | |
| 47 | ||
| 48 | RUN cd /opencog && git clone https://github.com/opencog/ros-behavior-scripting.git | |
| 49 | ||
| 50 | # Change line below on rebuild. Will use cache up to this line | |
| 51 | ENV LAST_SOFTWARE_UPDATE 2016-03-01 | |
| 52 | ||
| 53 | # Git pull for all OpenCog packages | |
| 54 | RUN cd /opencog/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 55 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 56 | ||
| 57 | ### RUN cd /opencog/ros-behavior-scripting && git pull https://github.com/linas/ros-behavior-scripting +lookie:master | |
| 58 | # Make sure we really have the lastest chatbot scripts | |
| 59 | RUN (cd /opencog/opencog/build; cmake ..; make install) | |
| 60 | ||
| 61 | # Install the behaviors as a module. | |
| 62 | RUN (mkdir /opencog/ros-behavior-scripting/build; \ | |
| 63 | cd /opencog/ros-behavior-scripting/build; \ | |
| 64 | cmake ..; make install) | |
| 65 | ||
| 66 | # Pre-compile the guile modules. | |
| 67 | RUN (bash -l -c "echo \"(use-modules (opencog eva-model))\" | guile ") | |
| 68 | RUN (bash -l -c "echo \"(use-modules (opencog eva-behvaior))\" | guile ") | |
| 69 | ||
| 70 | # Git pull for all ROS packages | |
| 71 | RUN cd /catkin_ws/src/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 72 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 73 | ||
| 74 | # The blender API has not been fully catkinized yet. | |
| 75 | RUN pip3 install ./blender_api_msgs/ | |
| 76 | ||
| 77 | # Some versions of ros_pololu_server will fail during build; the | |
| 78 | # work-around for this is to build twice (This because the missing | |
| 79 | # files are autogened, and the pololu Cmakefiles fail to list them as | |
| 80 | # dependencies.) | |
| 81 | WORKDIR /catkin_ws | |
| 82 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true | |
| 83 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" | |
| 84 | ||
| 85 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc | |
| 86 | ||
| 87 | COPY /scripts/eva.sh /catkin_ws/eva.sh | |
| 88 | ||
| 89 | # Ports exposed | |
| 90 | # 11311 is roscore | |
| 91 | # EXPOSE 11311 | |
| 92 | # 4444 is the relex parse server | |
| 93 | # EXPOSE 4444 | |
| 94 | ||
| 95 | ENTRYPOINT bash -l -c "./eva.sh; bash" |
| … | … | @@ -0,0 +1,50 @@ |
| 1 | eva-opencog | |
| 2 | =========== | |
| 3 | ||
| 4 | An image containing the OpenCog + Hanson Robotics Eva robot. | |
| 5 | This is the whole kit-n-kaboodle. In development. Probably broken. | |
| 6 | ||
| 7 | The visual processing+animation pipeline consists of: | |
| 8 | * A ROS node that takes video input from a UVC-compatible USB webcam | |
| 9 | (most typical desktop/laptop cameras are compatible). | |
| 10 | * A ROS node that does face detection: it tries to find human faces in | |
| 11 | the video feed. | |
| 12 | * A ROS node that maps the face postions to a 3D coordinate system. | |
| 13 | * A ROS node that runs the Eva blender rig itself (i.e. uses blender | |
| 14 | to draw/animate Eva). | |
| 15 | ||
| 16 | The speech processing pipleing consists of: | |
| 17 | * The RelEx server parsing English. | |
| 18 | * The OpenCog chatbot (currently not attached to any input source). | |
| 19 | ||
| 20 | ## Building | |
| 21 | ||
| 22 | Run the `./build.sh` file in this directory. You need to have built | |
| 23 | the `ros-incog-blender` image (in the `../ros-incog-blender` directory) | |
| 24 | first. | |
| 25 | ||
| 26 | ## Testing | |
| 27 | To verify that blender works, run the `./run.sh` shell script. | |
| 28 | This will start blender and the half-dozen ROS nodes that control it. | |
| 29 | You should see a living, breating Eva. | |
| 30 | ||
| 31 | You can chat to Eva by going to the guile prompt, and typing in | |
| 32 | chat text like so: | |
| 33 | ``` | |
| 34 | (process-query 'luser "Look left!") | |
| 35 | (process-query 'luser "Smile!") | |
| 36 | (process-query 'luser "Look sad!") | |
| 37 | (process-query 'luser "Eva, express boredom") | |
| 38 | ``` | |
| 39 | ||
| 40 | Turn on the non-verbal behaviors by saying: | |
| 41 | ``` | |
| 42 | (run) | |
| 43 | ``` | |
| 44 | ||
| 45 | If things don't work, open a github issue or complain on the mailing list! | |
| 46 | ||
| 47 | ## TODO | |
| 48 | * Remove joint_state_publisher robot_state_publisher from the geometry | |
| 49 | startup -- we only need to track face locations via geometry, and not | |
| 50 | the rest of the stuff. |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for eva-opencog | |
| 4 | # | |
| 5 | docker build -t opencog/eva-opencog . |
| … | … | @@ -0,0 +1,21 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | # Assorted grunge to let X11 use the 3D graphics acceleration. | |
| 11 | # 11311 is the roscore port -- but we have no need to expose it... | |
| 12 | # 4444 is the relex parse server -- again, no need to expose it just now. | |
| 13 | # -p 11311:11311 -p 4444:4444 | |
| 14 | docker run --name="eva-opencog" \ | |
| 15 | -e DISPLAY=:0.0 --privileged \ | |
| 16 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 17 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 18 | -v /dev/shm:/dev/shm -it opencog/eva-opencog | |
| 19 | ||
| 20 | xhost -local:root | |
| 21 | clear |
| … | … | @@ -0,0 +1,50 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # eva.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics Eva blender head. | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work. | |
| 15 | byobu new-session -d -n 'ros' 'roscore; $SHELL' | |
| 16 | sleep 4; | |
| 17 | ||
| 18 | # Run the relex parse server. | |
| 19 | tmux new-window -n 'rlx' 'cd /opencog/relex && ./opencog-server.sh ; $SHELL' | |
| 20 | ||
| 21 | # Single Video (body) camera and face tracker. | |
| 22 | tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL' | |
| 23 | ||
| 24 | # Publish the geometry messages. This includes tf2 which holds | |
| 25 | # the face locations. | |
| 26 | tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL' | |
| 27 | ||
| 28 | ### Start the blender GUI. | |
| 29 | tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL' | |
| 30 | ||
| 31 | # Start the IRC chatbot bridge. | |
| 32 | tmux new-window -n 'irc' 'cd /opencog/opencog/build/opencog/nlp/irc && ./cogita -n ieva -f "Robot Eva" -t 17020; ; $SHELL' | |
| 33 | ||
| 34 | # Start the cogserver. | |
| 35 | # It seems to take more than 5 seconds to load all scripts!? | |
| 36 | tmux new-window -n 'cog' 'cd /opencog/ros-behavior-scripting/src && guile -l btree-eva.scm ; $SHELL' | |
| 37 | sleep 5 | |
| 38 | ||
| 39 | # Run the new face tracker. | |
| 40 | tmux new-window -n 'fac' 'cd /opencog/ros-behavior-scripting/face_track && ./main.py ; $SHELL' | |
| 41 | ||
| 42 | # Spare-usage shell | |
| 43 | tmux new-window -n 'bash' '$SHELL' | |
| 44 | ||
| 45 | # Fix the annoying byobu display. | |
| 46 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 47 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 48 | tmux attach | |
| 49 | ||
| 50 | echo "Started" |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep eva-opencog |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep eva-opencog` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm eva-opencog | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,75 @@ |
| 1 | # | |
| 2 | # Container for the Hanson Robotics Eva head (stand-alone Owyl version). | |
| 3 | # This provides the complete Owyl-behavior-tree version of the demo head. | |
| 4 | # It includes UVC webcam vision input, pi_vision to discover faces, and | |
| 5 | # behavior controlled by Owyl trees. This is a stand-alone version of | |
| 6 | # the Eva head, it does not depend on or use any OpenCog software. | |
| 7 | # In particular, it is not capable of chat. | |
| 8 | # | |
| 9 | # To build: | |
| 10 | # sudo docker build -t opencog/eva-owyl . | |
| 11 | # | |
| 12 | FROM opencog/ros-indigo-blender | |
| 13 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 14 | ||
| 15 | # Install required packages | |
| 16 | ENV LAST_OS_UPDATE 2015-02-16 | |
| 17 | RUN apt-get -y update | |
| 18 | RUN apt-get -y upgrade | |
| 19 | RUN apt-get -y install ros-indigo-tf ros-indigo-driver-common | |
| 20 | RUN apt-get -y install ros-indigo-cv-bridge ros-indigo-image-transport | |
| 21 | RUN apt-get -y install ros-indigo-openni-camera ros-indigo-mjpeg-server | |
| 22 | RUN apt-get -y install ros-indigo-usb-cam | |
| 23 | # The below are needed by perception node | |
| 24 | RUN apt-get -y install ros-indigo-dynamixel-msgs | |
| 25 | RUN apt-get -y install ros-indigo-robot-state-publisher | |
| 26 | RUN apt-get -y install ros-indigo-joint-state-publisher | |
| 27 | ||
| 28 | # Owyl setup | |
| 29 | WORKDIR /opt/ | |
| 30 | RUN git clone https://github.com/eykd/owyl.git | |
| 31 | WORKDIR /opt/owyl/ | |
| 32 | RUN python setup.py install | |
| 33 | ||
| 34 | # Install catkinized packages | |
| 35 | WORKDIR /catkin_ws/src | |
| 36 | ||
| 37 | RUN git clone https://github.com/hansonrobotics/pi_vision.git | |
| 38 | RUN git clone https://github.com/hansonrobotics/perception.git | |
| 39 | RUN git clone https://github.com/hansonrobotics/eva_behavior.git | |
| 40 | RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git | |
| 41 | RUN git clone https://github.com/hansonrobotics/blender_api.git | |
| 42 | ||
| 43 | # The pau2motors package defines the PAU messages, which are | |
| 44 | # needed by the perception (vision-geometry) module. | |
| 45 | RUN git clone https://github.com/hansonrobotics/pau2motors.git | |
| 46 | RUN git clone https://github.com/hansonrobotics/robots_config.git | |
| 47 | ||
| 48 | # The motor side of things is not needed for the software head. | |
| 49 | # RUN git clone https://github.com/geni-lab/ros_pololu_servo.git | |
| 50 | # RUN git clone https://github.com/hansonrobotics/ros_pololu_servo.git | |
| 51 | # RUN git clone https://github.com/hansonrobotics/ros_motors_webui.git | |
| 52 | ||
| 53 | # Change line below on rebuild. Will use cache up to this line | |
| 54 | ENV LAST_SOFTWARE_UPDATE 2015-02-19 | |
| 55 | ||
| 56 | # Git pull for all packages | |
| 57 | RUN cd /catkin_ws/src/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 58 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 59 | ||
| 60 | # The blender API has not been fully catkinized yet. | |
| 61 | RUN pip3 install ./blender_api_msgs/ | |
| 62 | ||
| 63 | # Some versions of ros_pololu_server will fail during build; the | |
| 64 | # work-around for this is to build twice (This because the missing | |
| 65 | # files are autogened, and the pololu Cmakefiles fail to list them as | |
| 66 | # dependencies.) | |
| 67 | WORKDIR /catkin_ws | |
| 68 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true | |
| 69 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" | |
| 70 | ||
| 71 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc | |
| 72 | ||
| 73 | COPY /scripts/eva.sh /catkin_ws/eva.sh | |
| 74 | ||
| 75 | ENTRYPOINT bash -l -c "./eva.sh; bash" |
| … | … | @@ -0,0 +1,48 @@ |
| 1 | eva-owyl | |
| 2 | ======== | |
| 3 | ||
| 4 | Eva is an animated female head, capable of seeing you via a webcam, | |
| 5 | and engaging you in social interaction, making eye contact, and | |
| 6 | expressing her pleasure with smiles and looks of surprise and happiness. | |
| 7 | ||
| 8 | There are several Eva demos. This is a stand-alone demo of the basic | |
| 9 | Hanson Robotics Eva blender rig, showing the full range of emotional | |
| 10 | facial expressions, ranging from happiness to frustration, excitement | |
| 11 | to boredom, as well as gestures such as shakes, nods, blinks and a | |
| 12 | keep-alive breathing cycle. | |
| 13 | ||
| 14 | This docker image includes vision processing and basic human-face | |
| 15 | awareness behavior, but without a chatbot or any OpenCog processing | |
| 16 | software. The behaviors are controlled by a simple behavior-tree | |
| 17 | script implemented using Owyl. When the docker image is started, the | |
| 18 | demo starts and runs automatically; she should be able to see you | |
| 19 | (and your guests) through your webcam, and interact with all of you | |
| 20 | in a most charming way. This demo is roughly representative of the | |
| 21 | state of the Hanson Robotics Eva development, as of April 2015. | |
| 22 | ||
| 23 | The demo processing pipeline consists of: | |
| 24 | * A ROS node that takes video input from a UVC-compatible USB webcam | |
| 25 | (most typical desktop/laptop cameras are compatible). | |
| 26 | * A ROS node that does face detection: it tries to find human faces in | |
| 27 | the video feed. | |
| 28 | * A ROS node that maps the face postions to a 3D coordinate system. | |
| 29 | * A ROS node that implements social interactions: when a face is seen | |
| 30 | for the first time, Eva makes eye contact and smiles. When a face | |
| 31 | disappears, Eva becomes at first disappointed, perhaps angry, and | |
| 32 | eventually bored. In the meantime, the behavior controller cycles | |
| 33 | through a variety of suitable emotional expressions. | |
| 34 | * A ROS node that runs the Eva blender rig itself (i.e. uses blender | |
| 35 | to draw/animate Eva). | |
| 36 | * A ROS node that converts PAU (Physiological Action Units) into motor | |
| 37 | controls, needed for animating physical robot models. | |
| 38 | ||
| 39 | ## Building | |
| 40 | ||
| 41 | Run the `build.sh` file in this directory. You need to have built | |
| 42 | the ros-indigo-blender image (in the `../blender` directory) first. | |
| 43 | ||
| 44 | ## Testing | |
| 45 | To verify that blender works, run the `run.sh` shell script. | |
| 46 | This will start blender and the half-dozen ROS nodes that control it. | |
| 47 | You should see a living, breating Eva who smiles at you and tries to | |
| 48 | make and maintain eye contact as you move around. |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for eva | |
| 4 | # | |
| 5 | docker build -t opencog/eva-owyl . |
| … | … | @@ -0,0 +1,18 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | # Assorted grunge to let X11 use the 3D graphics acceleration. | |
| 11 | docker run --name="eva-owyl" --privileged \ | |
| 12 | -e DISPLAY=:0.0 \ | |
| 13 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 14 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 15 | -v /dev/shm:/dev/shm -it opencog/eva-owyl | |
| 16 | ||
| 17 | xhost -local:root | |
| 18 | clear |
| … | … | @@ -0,0 +1,33 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # eva.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics Eva blender head. | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work | |
| 15 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 16 | sleep 4; | |
| 17 | ||
| 18 | # Single Video (body) camera and face tracker | |
| 19 | tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL' | |
| 20 | # Publish the geometry messages | |
| 21 | tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL' | |
| 22 | tmux new-window -n 'bhave' 'rosrun eva_behavior main.py; $SHELL' | |
| 23 | tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL' | |
| 24 | ||
| 25 | # Spare-usage shell | |
| 26 | tmux new-window -n 'bash' 'sleep 4; rostopic pub --once /behavior_switch std_msgs/String btree_on; $SHELL' | |
| 27 | ||
| 28 | # Fix the annoying byobu display | |
| 29 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 30 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 31 | tmux attach | |
| 32 | ||
| 33 | echo "Started" |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep eva-owyl |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container.. ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep eva-owyl` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm eva-owyl | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,74 @@ |
| 1 | # | |
| 2 | # Container for the Hanson Robotics Eva blender rig ROS node, and | |
| 3 | # the ROS vision subsystem. It does not include behaviors or a | |
| 4 | # chatbot. On launch, it will start roscore, blender, and the vision | |
| 5 | # (face-detection) subsystem, but will not perform any behaviors. | |
| 6 | # | |
| 7 | # To build: | |
| 8 | # sudo docker build -t opencog/eva-ros . | |
| 9 | # | |
| 10 | FROM opencog/ros-indigo-blender | |
| 11 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 12 | ||
| 13 | # Install required packages | |
| 14 | ENV LAST_OS_UPDATE 2015-02-16 | |
| 15 | RUN apt-get -y update | |
| 16 | RUN apt-get -y upgrade | |
| 17 | RUN apt-get -y install ros-indigo-tf ros-indigo-driver-common | |
| 18 | RUN apt-get -y install ros-indigo-cv-bridge ros-indigo-image-transport | |
| 19 | RUN apt-get -y install ros-indigo-openni-camera ros-indigo-mjpeg-server | |
| 20 | RUN apt-get -y install ros-indigo-usb-cam | |
| 21 | # The below are needed by perception node | |
| 22 | RUN apt-get -y install ros-indigo-dynamixel-msgs | |
| 23 | RUN apt-get -y install ros-indigo-robot-state-publisher | |
| 24 | RUN apt-get -y install ros-indigo-joint-state-publisher | |
| 25 | ||
| 26 | # Install catkinized packages | |
| 27 | WORKDIR /catkin_ws/src | |
| 28 | ||
| 29 | RUN git clone https://github.com/hansonrobotics/pi_vision.git | |
| 30 | RUN git clone https://github.com/hansonrobotics/perception.git | |
| 31 | RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git | |
| 32 | RUN git clone https://github.com/hansonrobotics/blender_api.git | |
| 33 | ||
| 34 | # The pau2motors package defines the PAU messages, which are | |
| 35 | # needed by the perception (vision-geometry) module. | |
| 36 | RUN git clone https://github.com/hansonrobotics/pau2motors.git | |
| 37 | RUN git clone https://github.com/hansonrobotics/robots_config.git | |
| 38 | ||
| 39 | # The OpenCog github account mirrors all of the Hanson Robotics | |
| 40 | # software. At this time, the two are in sync with each-other. | |
| 41 | # RUN git clone https://github.com/opencog/pi_vision.git | |
| 42 | # RUN git clone https://github.com/opencog/perception.git | |
| 43 | # RUN git clone https://github.com/opencog/blender_api_msgs.git | |
| 44 | # RUN git clone https://github.com/opencog/blender_api.git | |
| 45 | # RUN git clone https://github.com/opencog/pau2motors.git | |
| 46 | # RUN git clone https://github.com/opencog/robots_config.git | |
| 47 | ||
| 48 | # Change line below on rebuild. Will use cache up to this line | |
| 49 | ENV LAST_SOFTWARE_UPDATE 2015-02-19 | |
| 50 | ||
| 51 | # Git pull for all packages | |
| 52 | RUN cd /catkin_ws/src/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 53 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 54 | ||
| 55 | # The blender API has not been fully catkinized yet. | |
| 56 | RUN pip3 install ./blender_api_msgs/ | |
| 57 | ||
| 58 | # Some versions of ros_pololu_server will fail during build; the | |
| 59 | # work-around for this is to build twice (This because the missing | |
| 60 | # files are autogened, and the pololu Cmakefiles fail to list them as | |
| 61 | # dependencies.) | |
| 62 | WORKDIR /catkin_ws | |
| 63 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true | |
| 64 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" | |
| 65 | ||
| 66 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc | |
| 67 | ||
| 68 | COPY /scripts/eva.sh /catkin_ws/eva.sh | |
| 69 | ||
| 70 | # Ports exposed | |
| 71 | # 11311 is roscore | |
| 72 | EXPOSE 11311 | |
| 73 | ||
| 74 | ENTRYPOINT bash -l -c "./eva.sh; bash" |
| … | … | @@ -0,0 +1,28 @@ |
| 1 | eva-ros | |
| 2 | ======= | |
| 3 | ||
| 4 | An image containing the Hanson Robotics Eva blender rig, and the ROS | |
| 5 | vision subsystem. It does not contain any parts of OpenCog, or a | |
| 6 | chatbot, nor any behavior controls; its just blender+vision. | |
| 7 | ||
| 8 | The data processing pipeline consists of: | |
| 9 | * A ROS node that takes video input from a UVC-compatible USB webcam | |
| 10 | (most typical desktop/laptop cameras are compatible). | |
| 11 | * A ROS node that does face detection: it tries to find human faces in | |
| 12 | the video feed. | |
| 13 | * A ROS node that maps the face postions to a 3D coordinate system. | |
| 14 | * A ROS node that runs the Eva blender rig itself (i.e. uses blender | |
| 15 | to draw/animate Eva). | |
| 16 | * A ROS node that converts PAU (Physiological Action Units) into motor | |
| 17 | controls, needed for animating physical robot models. | |
| 18 | ||
| 19 | ## Building | |
| 20 | ||
| 21 | Run the `build.sh` file in this directory. You need to have built | |
| 22 | the ros-indigo-blender image (in the `../blender` directory) first. | |
| 23 | ||
| 24 | ## Testing | |
| 25 | To verify that blender works, run the `run.sh` shell script. | |
| 26 | This will start blender and the half-dozen ROS nodes that control it. | |
| 27 | You should see a living, breating Eva; however, she is lobotimized: | |
| 28 | there's no brain, she cannot actually see you, and will not react. |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for eva-ros | |
| 4 | # | |
| 5 | docker build -t opencog/eva-ros . |
| … | … | @@ -0,0 +1,19 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | # Assorted grunge to let X11 use the 3D graphics acceleration. | |
| 11 | # 11311 is the roscore port | |
| 12 | docker run --name="eva-ros" -p 11311:11311 \ | |
| 13 | -e DISPLAY=:0.0 --privileged \ | |
| 14 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 15 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 16 | -v /dev/shm:/dev/shm -it opencog/eva-ros | |
| 17 | ||
| 18 | xhost -local:root | |
| 19 | clear |
| … | … | @@ -0,0 +1,32 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # eva.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics Eva blender head. | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work | |
| 15 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 16 | sleep 4; | |
| 17 | ||
| 18 | # Single Video (body) camera and face tracker | |
| 19 | tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL' | |
| 20 | # Publish the geometry messages | |
| 21 | tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL' | |
| 22 | tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL' | |
| 23 | ||
| 24 | # Spare-usage shell | |
| 25 | tmux new-window -n 'bash' '$SHELL' | |
| 26 | ||
| 27 | # Fix the annoying byobu display | |
| 28 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 29 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 30 | tmux attach | |
| 31 | ||
| 32 | echo "Started" |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep eva-ros |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep eva-ros` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm eva-ros | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,76 @@ |
| 1 | # | |
| 2 | # Container for the OpenCog-based Hanson Robotics Eva mute robot. | |
| 3 | # No chatbot; she merely reacts to your presence or absence, as seen | |
| 4 | # by the webcam. | |
| 5 | # | |
| 6 | # To build: | |
| 7 | # sudo docker build -t opencog/eva-silent . | |
| 8 | # | |
| 9 | FROM opencog/ros-incog-blender | |
| 10 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 11 | ||
| 12 | # Install required packages | |
| 13 | ENV LAST_OS_UPDATE 2015-02-16 | |
| 14 | RUN apt-get -y update | |
| 15 | RUN apt-get -y upgrade | |
| 16 | # The perception node needs ros-indigo-dynamixel-msgs and | |
| 17 | # the joint/robot-state publishers | |
| 18 | RUN apt-get -y install ros-indigo-tf ros-indigo-driver-common \ | |
| 19 | ros-indigo-cv-bridge ros-indigo-image-transport \ | |
| 20 | ros-indigo-openni-camera ros-indigo-mjpeg-server \ | |
| 21 | ros-indigo-usb-cam \ | |
| 22 | ros-indigo-dynamixel-msgs \ | |
| 23 | ros-indigo-robot-state-publisher \ | |
| 24 | ros-indigo-joint-state-publisher | |
| 25 | ||
| 26 | # Install catkinized packages | |
| 27 | WORKDIR /catkin_ws/src | |
| 28 | ||
| 29 | RUN git clone https://github.com/hansonrobotics/pi_vision.git | |
| 30 | RUN git clone https://github.com/hansonrobotics/perception.git | |
| 31 | RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git | |
| 32 | RUN git clone https://github.com/hansonrobotics/blender_api.git | |
| 33 | ||
| 34 | # The pau2motors package defines the PAU messages, which are | |
| 35 | # needed by the perception (vision-geometry) module. | |
| 36 | RUN git clone https://github.com/hansonrobotics/pau2motors.git | |
| 37 | RUN git clone https://github.com/hansonrobotics/robots_config.git | |
| 38 | ||
| 39 | # The OpenCog github account mirrors all of the Hanson Robotics | |
| 40 | # software. At this time, the two are in sync with each-other. | |
| 41 | # RUN git clone https://github.com/opencog/pi_vision.git | |
| 42 | # RUN git clone https://github.com/opencog/perception.git | |
| 43 | # RUN git clone https://github.com/opencog/blender_api_msgs.git | |
| 44 | # RUN git clone https://github.com/opencog/blender_api.git | |
| 45 | # RUN git clone https://github.com/opencog/pau2motors.git | |
| 46 | # RUN git clone https://github.com/opencog/robots_config.git | |
| 47 | ||
| 48 | RUN cd /opencog && git clone https://github.com/opencog/ros-behavior-scripting.git | |
| 49 | ||
| 50 | # Change line below on rebuild. Will use cache up to this line | |
| 51 | ENV LAST_SOFTWARE_UPDATE 2016-02-19 | |
| 52 | ||
| 53 | # Git pull for all packages | |
| 54 | RUN cd /catkin_ws/src/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 55 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 56 | ||
| 57 | # The blender API has not been fully catkinized yet. | |
| 58 | RUN pip3 install ./blender_api_msgs/ | |
| 59 | ||
| 60 | # Some versions of ros_pololu_server will fail during build; the | |
| 61 | # work-around for this is to build twice (This because the missing | |
| 62 | # files are autogened, and the pololu Cmakefiles fail to list them as | |
| 63 | # dependencies.) | |
| 64 | WORKDIR /catkin_ws | |
| 65 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true | |
| 66 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" | |
| 67 | ||
| 68 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc | |
| 69 | ||
| 70 | COPY /scripts/eva.sh /catkin_ws/eva.sh | |
| 71 | ||
| 72 | # Ports exposed | |
| 73 | # 11311 is roscore | |
| 74 | EXPOSE 11311 | |
| 75 | ||
| 76 | ENTRYPOINT bash -l -c "./eva.sh; bash" |
| … | … | @@ -0,0 +1,31 @@ |
| 1 | eva-silent | |
| 2 | ========== | |
| 3 | ||
| 4 | An image containing the OpenCog + Hanson Robotics Eva mute robot. | |
| 5 | This is the robot with vision and face tracking, and behaviors, | |
| 6 | but no chatbot. | |
| 7 | ||
| 8 | The data processing pipeline consists of: | |
| 9 | * A ROS node that takes video input from a UVC-compatible USB webcam | |
| 10 | (most typical desktop/laptop cameras are compatible). | |
| 11 | * A ROS node that does face detection: it tries to find human faces in | |
| 12 | the video feed. | |
| 13 | * A ROS node that maps the face postions to a 3D coordinate system. | |
| 14 | * A ROS node that runs the Eva blender rig itself (i.e. uses blender | |
| 15 | to draw/animate Eva). | |
| 16 | * A ROS node that converts PAU (Physiological Action Units) into motor | |
| 17 | controls, needed for animating physical robot models. | |
| 18 | ||
| 19 | ## Building | |
| 20 | ||
| 21 | Run the `./build.sh` file in this directory. You need to have built | |
| 22 | the `ros-incog-blender` image (in the `../ros-incog-blender` directory) | |
| 23 | first. | |
| 24 | ||
| 25 | ## Testing | |
| 26 | To verify that blender works, run the `./run.sh` shell script. | |
| 27 | This will start blender and the half-dozen ROS nodes that control it. | |
| 28 | You should see a living, breating Eva; she should be able to "see" you | |
| 29 | and react to your presence by attempting to make eye-contact, smiling | |
| 30 | and being interested. If she can't see anything, she'll look bored, and | |
| 31 | eventually fall asleep. |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for eva-silent | |
| 4 | # | |
| 5 | docker build -t opencog/eva-silent . |
| … | … | @@ -0,0 +1,19 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | # Assorted grunge to let X11 use the 3D graphics acceleration. | |
| 11 | # 11311 is the roscore port | |
| 12 | docker run --name="eva-silent" -p 11311:11311 \ | |
| 13 | -e DISPLAY=:0.0 --privileged \ | |
| 14 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 15 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 16 | -v /dev/shm:/dev/shm -it opencog/eva-silent | |
| 17 | ||
| 18 | xhost -local:root | |
| 19 | clear |
| … | … | @@ -0,0 +1,37 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # eva.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics Eva blender head. | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work | |
| 15 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 16 | sleep 4; | |
| 17 | ||
| 18 | # Single Video (body) camera and face tracker | |
| 19 | tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL' | |
| 20 | # Publish the geometry messages | |
| 21 | tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL' | |
| 22 | tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL' | |
| 23 | ||
| 24 | # Run the quick-n-dirty face tracker. | |
| 25 | tmux new-window -n 'fac' 'cd /opencog/ros-behavior-scripting/face_track && ./main.py ; $SHELL' | |
| 26 | ||
| 27 | tmux new-window -n 'bhv' 'cd /opencog/ros-behavior-scripting/src && guile -l btree.scm ; $SHELL' | |
| 28 | ||
| 29 | # Spare-usage shell | |
| 30 | tmux new-window -n 'bash' '$SHELL' | |
| 31 | ||
| 32 | # Fix the annoying byobu display | |
| 33 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 34 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 35 | tmux attach | |
| 36 | ||
| 37 | echo "Started" |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep eva-silent |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep eva-silent` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm eva-silent | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,47 @@ |
| 1 | # | |
| 2 | # Base ROS indigo installation. | |
| 3 | # Bare bones install; does not launch any nodes. | |
| 4 | # | |
| 5 | # To build: | |
| 6 | # docker build -t opencog/ros-indigo-base . | |
| 7 | # | |
| 8 | # To run: | |
| 9 | # docker run --rm --name="indigo-base" -i -t opencog/ros-indigo-base | |
| 10 | # | |
| 11 | FROM ubuntu:14.04 | |
| 12 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 13 | ||
| 14 | # Avoid triggering apt-get dialogs (which may lead to errors). See: | |
| 15 | # http://stackoverflow.com/questions/25019183/docker-java7-install-fail | |
| 16 | ENV DEBIAN_FRONTEND noninteractive | |
| 17 | ||
| 18 | ENV LAST_OS_UPDATE 2016-02-29 | |
| 19 | RUN apt-get -y update | |
| 20 | RUN apt-get -y upgrade | |
| 21 | ||
| 22 | # Need software-properties-common for `add-apt-repository` command | |
| 23 | RUN apt-get -y install wget software-properties-common | |
| 24 | RUN wget http://packages.ros.org/ros.key -O - | sudo apt-key add - | |
| 25 | RUN echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list | |
| 26 | RUN apt-get -y update | |
| 27 | # | |
| 28 | # Most robot bringup will require git-cloning the working repos. | |
| 29 | # Need byobu+tmux for ROS terminal control. | |
| 30 | # Need vim so that we can do at least some basic debugging. | |
| 31 | RUN apt-get -y install ros-indigo-ros-base ros-indigo-angles | |
| 32 | RUN apt-get -y install git tmux byobu vim | |
| 33 | ||
| 34 | # Make vim be usable instead of insane. | |
| 35 | COPY /scripts/.vimrc /root/ | |
| 36 | ||
| 37 | # Environment Variables | |
| 38 | ## Set Locale -- Catkin crashes on Krisčiunas, Mickevičius without this. | |
| 39 | RUN locale-gen en_US.UTF-8 | |
| 40 | ENV LANG en_US.UTF-8 | |
| 41 | ENV LANGUAGE en_US:en | |
| 42 | ENV LC_ALL en_US.UTF-8 | |
| 43 | ||
| 44 | RUN rosdep init | |
| 45 | RUN rosdep update | |
| 46 | RUN echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc | |
| 47 | CMD /bin/bash |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | ros-indigo-base | |
| 2 | =============== | |
| 3 | ||
| 4 | The base image for building other docker imagess that use ROS. The | |
| 5 | container installs and configures a fair variety of ROS packages | |
| 6 | needed for running ROS nodes. No actual ROS nodes are started. | |
| 7 | ||
| 8 | ## Building | |
| 9 | ||
| 10 | Run the `build.sh` file in this directory. You need to have first | |
| 11 | obtained (downloaded) the ubuntu:14.04 image from Docker. | |
| 12 | ||
| 13 | ## Testing | |
| 14 | To verify that things works, run the `run.sh` shell script. | |
| 15 | This should result in a shell prompt inside the docker container. | |
| 16 | You can start roscore simply by saying `roscore`. Of course, roscore | |
| 17 | by itself, does not do anything interesting... |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build the base image images. | |
| 6 | # | |
| 7 | docker build -t opencog/ros-indigo-base . |
| … | … | @@ -0,0 +1,11 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Just for fun, we will export the roscore port 11311 out of the | |
| 8 | # container. That way, if you run roscore inside the container, | |
| 9 | # and you can `rostopic list` outside of it! | |
| 10 | docker run --name="ros-base" \ | |
| 11 | -p 11311:11311 -it opencog/ros-indigo-base |
| … | … | @@ -0,0 +1,22 @@ |
| 1 | set wrapmargin=8 | |
| 2 | set ts=3 | |
| 3 | set showmode | |
| 4 | set noautoindent | |
| 5 | set encoding=utf-8 | |
| 6 | ||
| 7 | " Sets the color scheme to something easier on my eyes. | |
| 8 | colo evening | |
| 9 | ||
| 10 | " Only do this part when compiled with support for autocommands. | |
| 11 | if has("autocmd") | |
| 12 | " When editing a file, always jump to the last known cursor position. | |
| 13 | " Don't do it when the position is invalid or when inside an event handler | |
| 14 | " (happens when dropping a file on gvim). | |
| 15 | autocmd BufReadPost * | |
| 16 | \ if line("'\"") > 0 && line("'\"") <= line("$") | | |
| 17 | \ exe "normal g`\"" | | |
| 18 | \ endif | |
| 19 | ||
| 20 | endif " has("autocmd") | |
| 21 | ||
| 22 | " /etc/vimrc ends here |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep ros-base |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container.. ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep ros-base` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm ros-base | |
| 14 | fi |
| … | … | @@ -0,0 +1,62 @@ |
| 1 | # | |
| 2 | # Docker file for base ROS+Blender install | |
| 3 | # No ROS nodes are started. | |
| 4 | # | |
| 5 | # The primary difficulty here is that Blender wants Python3 | |
| 6 | # while ROS wants Python2, and so there are install conflicts. | |
| 7 | # | |
| 8 | # To build: | |
| 9 | # docker build -t opencog/ros-indigo-blender . | |
| 10 | # | |
| 11 | # To run: | |
| 12 | # docker run --rm --privileged -i -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 13 | # -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 \ | |
| 14 | # -t opencog/ros-indigo-blender | |
| 15 | # | |
| 16 | # The above should be sufficient to get blender running with full | |
| 17 | # 3D hardware acceleration on the local host (dri==direct rendering interface) | |
| 18 | # Note: /dev/dri=gpu, /dev/shm=gpu | |
| 19 | # | |
| 20 | FROM opencog/ros-indigo-base | |
| 21 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 22 | MAINTAINER David Hart "dhart@opencog.org" | |
| 23 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 24 | ||
| 25 | ENV LAST_OS_UPDATE 2015-11-25 | |
| 26 | ||
| 27 | # Get blender version 2.71; the default in trusty is 2.69, and lighting | |
| 28 | # looks wrong in it. The one in ppa:thomas-schiex is 2.75, and gestures | |
| 29 | # don't work with that version. | |
| 30 | # RUN add-apt-repository ppa:thomas-schiex/blender | |
| 31 | RUN add-apt-repository ppa:irie/blender | |
| 32 | RUN apt-get -y update | |
| 33 | RUN apt-get -y upgrade | |
| 34 | ||
| 35 | # Blender with dependencies | |
| 36 | # Install x11-utils to get xdpyinfo, for X11 display debugging | |
| 37 | # mesa-utils provides glxinfo, handy for understanding the 3D support. | |
| 38 | # Blender needs python3 | |
| 39 | RUN apt-get -y install blender x11-utils mesa-utils python3-yaml python3-pip | |
| 40 | ||
| 41 | # We perform some magic incantations to allow ROS (which normally | |
| 42 | # expects python2) to happily co-exist with python3. Yes, its odd | |
| 43 | # to do this here, but here is where we first install python3. | |
| 44 | RUN pip3 install rospkg catkin_pkg | |
| 45 | ||
| 46 | WORKDIR /catkin_ws/src | |
| 47 | RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh | |
| 48 | ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages | |
| 49 | RUN /usr/bin/python3 /opt/ros/indigo/bin/catkin_init_workspace | |
| 50 | ||
| 51 | # Must run catkin at least once, even if there is nothing to build; | |
| 52 | # it creates the needed directory structure and the needed setup.sh. | |
| 53 | WORKDIR /catkin_ws | |
| 54 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" | |
| 55 | ||
| 56 | # Empty ROS Enviroment Setup | |
| 57 | # The user is root; so ~/.bash_profile is /root/.bash_profile | |
| 58 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bash_profile && \ | |
| 59 | echo -e "\e[1;34m[$SELF_NAME] catkin devel setup\.bash sourced\e[0m" | |
| 60 | ||
| 61 | ENV DISPLAY :0.0 | |
| 62 | CMD /bin/bash |
| … | … | @@ -0,0 +1,18 @@ |
| 1 | ros-indigo-blender | |
| 2 | ================== | |
| 3 | ||
| 4 | A docker image that installs both ROS and blender, for demoing | |
| 5 | ROS-controlled blender animations. The image holds only the base | |
| 6 | packages needed for running blender and ROS together; no actual ROS | |
| 7 | nodes are started, no blender animations are run. | |
| 8 | ||
| 9 | ## Building | |
| 10 | ||
| 11 | Run the `build.sh` file in this directory. You need to have built | |
| 12 | the base ROS image (in the `../ros-base` directory) first. | |
| 13 | ||
| 14 | ## Testing | |
| 15 | To verify that blender works, run the `run.sh` shell script. | |
| 16 | This should result in a shell prompt inside the docker container. | |
| 17 | You can start blender simply by saying `blender`; it should display | |
| 18 | on your desktop. |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build this docker image. | |
| 6 | # | |
| 7 | docker build -t opencog/ros-indigo-blender . |
| … | … | @@ -0,0 +1,16 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | docker run --name="ros-blender" \ | |
| 11 | -p 11311:11311 \ | |
| 12 | --privileged -i -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 13 | -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 \ | |
| 14 | -t opencog/ros-indigo-blender | |
| 15 | ||
| 16 | xhost -local:root |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep ros-blender |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container.. ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep ros-blender` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm ros-blender | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,64 @@ |
| 1 | # | |
| 2 | # Docker file for base ROS+OpenCog+Blender install | |
| 3 | # The CogServer is not started; no ROS nodes are started. | |
| 4 | # | |
| 5 | # XXX THIS IS IDENTICAL TO the ros-indigo-blender DOCKERFILE, | |
| 6 | # XXX EXCEPT THAT A DIFFERENT BASE IS USED! | |
| 7 | # XXX Please try to keep it that way! | |
| 8 | # | |
| 9 | # The primary difficulty here is that Blender wants Python3 | |
| 10 | # while ROS wants Python2, and so there are install conflicts. | |
| 11 | # | |
| 12 | # To build: | |
| 13 | # docker build -t opencog/ros-incog-blender . | |
| 14 | # | |
| 15 | # To run: | |
| 16 | # docker run --rm --privileged -i -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 17 | # -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 \ | |
| 18 | # -t opencog/ros-incog-blender | |
| 19 | # | |
| 20 | # The above should be sufficient to get blender running with full | |
| 21 | # 3D hardware acceleration on the local host (dri==direct rendering interface) | |
| 22 | # Note: /dev/dri=gpu, /dev/shm=gpu | |
| 23 | # | |
| 24 | FROM opencog/ros-indigo-opencog | |
| 25 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 26 | ||
| 27 | ENV LAST_OS_UPDATE 2015-11-25 | |
| 28 | ||
| 29 | # Get blender version 2.71; the default in trusty is 2.69, and lighting | |
| 30 | # looks wrong in it. The one in ppa:thomas-schiex is 2.75, and gestures | |
| 31 | # don't work with that version. | |
| 32 | # RUN add-apt-repository ppa:thomas-schiex/blender | |
| 33 | RUN add-apt-repository ppa:irie/blender | |
| 34 | RUN apt-get -y update | |
| 35 | RUN apt-get -y upgrade | |
| 36 | ||
| 37 | # Blender with dependencies | |
| 38 | # Install x11-utils to get xdpyinfo, for X11 display debugging | |
| 39 | # mesa-utils provides glxinfo, handy for understanding the 3D support. | |
| 40 | # Blender needs python3 | |
| 41 | RUN apt-get -y install blender x11-utils mesa-utils python3-yaml python3-pip | |
| 42 | ||
| 43 | # We perform some magic incantations to allow ROS (which normally | |
| 44 | # expects python2) to happily co-exist with python3. Yes, its odd | |
| 45 | # to do this here, but here is where we first install python3. | |
| 46 | RUN pip3 install rospkg catkin_pkg | |
| 47 | ||
| 48 | WORKDIR /catkin_ws/src | |
| 49 | RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh | |
| 50 | ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages | |
| 51 | RUN /usr/bin/python3 /opt/ros/indigo/bin/catkin_init_workspace | |
| 52 | ||
| 53 | # Must run catkin at least once, even if there is nothing to build; | |
| 54 | # it creates the needed directory structure and the needed setup.sh. | |
| 55 | WORKDIR /catkin_ws | |
| 56 | RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" | |
| 57 | ||
| 58 | # Empty ROS Enviroment Setup | |
| 59 | # The user is root; so ~/.bash_profile is /root/.bash_profile | |
| 60 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bash_profile && \ | |
| 61 | echo -e "\e[1;34m[$SELF_NAME] catkin devel setup\.bash sourced\e[0m" | |
| 62 | ||
| 63 | ENV DISPLAY :0.0 | |
| 64 | CMD /bin/bash |
| … | … | @@ -0,0 +1,18 @@ |
| 1 | ros-incog-blender | |
| 2 | ================= | |
| 3 | ||
| 4 | A docker image that installs ROS, OpenCog and blender. The image holds | |
| 5 | only the base packages needed for running OpenCog, blender and ROS | |
| 6 | together; no actual ROS nodes are started, the CogServer is not started, | |
| 7 | and no blender animations are run. | |
| 8 | ||
| 9 | ## Building | |
| 10 | ||
| 11 | Run the `build.sh` file in this directory. You need to have built | |
| 12 | the opencog image (in the `../ros-opencog` directory) first. | |
| 13 | ||
| 14 | ## Testing | |
| 15 | To verify that blender works, run the `run.sh` shell script. | |
| 16 | This should result in a shell prompt inside the docker container. | |
| 17 | You can start blender simply by saying `blender`; it should display | |
| 18 | on your desktop. |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build this docker image. | |
| 6 | # | |
| 7 | docker build -t opencog/ros-incog-blender . |
| … | … | @@ -0,0 +1,16 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | docker run --name="opencog-incog-blender" \ | |
| 11 | -p 11311:11311 \ | |
| 12 | --privileged -i -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 13 | -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 \ | |
| 14 | -t opencog/ros-incog-blender | |
| 15 | ||
| 16 | xhost -local:root |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep opencog-incog-blender |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container.. ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep opencog-incog-blender` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm opencog-incog-blender | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,163 @@ |
| 1 | # | |
| 2 | # Container for ROS+OpenCog | |
| 3 | # | |
| 4 | # To build: | |
| 5 | # sudo docker build -t opencog/ros-indigo-opencog . | |
| 6 | # | |
| 7 | FROM opencog/ros-indigo-base | |
| 8 | MAINTAINER Linas Vepštas "linasvepstas@gmail.com" | |
| 9 | ||
| 10 | # Install required packages | |
| 11 | ENV LAST_OS_UPDATE 2016-02-18 | |
| 12 | RUN apt-get -y update | |
| 13 | RUN apt-get -y upgrade | |
| 14 | # Base stuff for cogutil. All on one line, to avoid error | |
| 15 | # `Cannot create container with more than 127 parents` | |
| 16 | RUN apt-get -y install gcc g++ cmake binutils-dev libiberty-dev \ | |
| 17 | libboost-dev libboost-date-time-dev libboost-filesystem-dev \ | |
| 18 | libboost-program-options-dev libboost-regex-dev \ | |
| 19 | libboost-serialization-dev libboost-system-dev libboost-thread-dev \ | |
| 20 | cxxtest | |
| 21 | ||
| 22 | # Additional stuff needed to build and run relex. | |
| 23 | RUN apt-get -y install wordnet-dev wordnet-sense-index openjdk-7-jdk \ | |
| 24 | ant libcommons-logging-java libgetopt-java | |
| 25 | ||
| 26 | # Additional stuff for the AtomSpace: cython and guile and ODBC. | |
| 27 | # Additional stuff for OpenCog. We need telnet as a debug utility. | |
| 28 | # Need wget to download link-grammar source. | |
| 29 | # Need unzip to unzip JWNL. | |
| 30 | RUN apt-get -y install guile-2.0-dev cython unixodbc-dev odbc-postgresql \ | |
| 31 | wget telnet locales rlwrap unzip | |
| 32 | ||
| 33 | # ------------------------------------------------------------- | |
| 34 | # Right now, just clone the OpenCog sources. They will be built | |
| 35 | # later on. | |
| 36 | WORKDIR /opencog | |
| 37 | RUN git clone https://github.com/opencog/cogutil.git | |
| 38 | RUN git clone https://github.com/opencog/atomspace.git | |
| 39 | RUN git clone https://github.com/opencog/opencog.git | |
| 40 | RUN git clone https://github.com/opencog/relex.git | |
| 41 | ||
| 42 | # ------------------------------------------------------------- | |
| 43 | # Download and install JWNL; its needed for relex. | |
| 44 | WORKDIR /src | |
| 45 | RUN wget http://downloads.sourceforge.net/project/jwordnet/jwnl/JWNL%201.4/jwnl14-rc2.zip | |
| 46 | RUN (unzip jwnl14-rc2.zip jwnl14-rc2/jwnl.jar ; \ | |
| 47 | mkdir /usr/local/share/java ; \ | |
| 48 | mv -v jwnl14-rc2/jwnl.jar /usr/local/share/java ; \ | |
| 49 | rm -v jwnl14-rc2.zip ; rmdir jwnl14-rc2 ; \ | |
| 50 | chmod -v 0644 /usr/local/share/java/jwnl.jar) | |
| 51 | ||
| 52 | # ------------------------------------------------------------- | |
| 53 | # Download and build Link Grammar. Its needed for Sureal, | |
| 54 | # the language generation component of opencog. | |
| 55 | WORKDIR /src | |
| 56 | ||
| 57 | # Touch this tag to grab the latest version of LinkGrammar. | |
| 58 | ENV LAST_LG_UPDATE 2016-02-18 | |
| 59 | ||
| 60 | # Download the current released version of link-grammar. | |
| 61 | # We do NOT want to git-clone this; the git version is unstable; | |
| 62 | # it also requires extra tools and mish-mash to build it. | |
| 63 | # RUN http://www.abisource.com/downloads/link-grammar/current/link-grammar-5*.tar.gz | |
| 64 | # The wget tries to guess the correct file to download w/ wildcard | |
| 65 | # But that won't work. | |
| 66 | RUN wget -r --no-parent -nH --cut-dirs=2 http://www.abisource.com/downloads/link-grammar/current/ | |
| 67 | ||
| 68 | # Unpack the sources, too. | |
| 69 | RUN tar -zxf current/link-grammar-5*.tar.gz | |
| 70 | ||
| 71 | # Need the locales for utf8 | |
| 72 | RUN (echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ | |
| 73 | echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 74 | echo "he_IL.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 75 | echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 76 | echo "lt_LT.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 77 | echo "fa_IR.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 78 | echo "ar_AE.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 79 | echo "kk_KZ.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 80 | echo "tr_TR.UTF-8 UTF-8" >> /etc/locale.gen) | |
| 81 | ||
| 82 | # WTF. In debian wheezy, it is enough to just say locale-gen without | |
| 83 | # any arguments. But in trusty, we eneed to be explicit. I'm confused. | |
| 84 | # RUN locale-gen | |
| 85 | # Note also: under trusty, fa_IR.UTF-8 causes locale-gen to fail, | |
| 86 | # must use the naked fa_IR | |
| 87 | # Note also: Kazakh is kk_KZ not kz_KZ | |
| 88 | RUN locale-gen en_US.UTF-8 ru_RU.UTF-8 he_IL.UTF-8 \ | |
| 89 | de_DE.UTF-8 lt_LT.UTF-8 fa_IR ar_AE.UTF-8 kk_KZ.UTF-8 tr_TR.UTF-8 | |
| 90 | ||
| 91 | # Build the libraries and command-line parser only | |
| 92 | # Assumes that the sources have already been unpacked. | |
| 93 | RUN (cd link-grammar-5*; mkdir build; cd build; \ | |
| 94 | ../configure; make -j12; make install; ldconfig) | |
| 95 | ||
| 96 | RUN adduser --disabled-password --gecos "Link Parser User" link-parser | |
| 97 | ||
| 98 | USER link-parser | |
| 99 | RUN (cd /home/link-parser; echo "export LANG=en_US.UTF-8" >> .bash_aliases) | |
| 100 | CMD bash | |
| 101 | ||
| 102 | RUN export LANG=en_US.UTF-8 | |
| 103 | ||
| 104 | # ------------------------------------------------------------- | |
| 105 | USER root | |
| 106 | WORKDIR /opencog | |
| 107 | ||
| 108 | # Change line below on rebuild. Will use Docker cache up to this line, | |
| 109 | # twigging this date will update the opencog sources. | |
| 110 | ENV LAST_SOFTWARE_UPDATE 2016-03-10 | |
| 111 | ||
| 112 | # Git pull for all packages | |
| 113 | RUN cd /opencog/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 114 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 115 | ||
| 116 | # Build the base software. | |
| 117 | RUN (mkdir /opencog/cogutil/build; cd /opencog/cogutil/build; \ | |
| 118 | cmake ..; make -j6; make install) | |
| 119 | RUN (mkdir /opencog/atomspace/build; cd /opencog/atomspace/build; \ | |
| 120 | cmake ..; make -j12; make install) | |
| 121 | RUN (mkdir /opencog/opencog/build; cd /opencog/opencog/build; \ | |
| 122 | cmake ..; make -j12; make install) | |
| 123 | RUN (cd /opencog/relex; ant build; ant install) | |
| 124 | ||
| 125 | # Build the unit tests. This is .. optional, but we do it anyway, | |
| 126 | # for right now, just to sanity-check things. | |
| 127 | # WORKDIR /opencog/cogutil/build | |
| 128 | # RUN bash -l -c "make -j6 tests" | |
| 129 | # | |
| 130 | # WORKDIR /opencog/atomspace/build | |
| 131 | # RUN bash -l -c "make -j12 tests" | |
| 132 | # | |
| 133 | # WORKDIR /opencog/opencog/build | |
| 134 | # RUN bash -l -c "make -j12 tests" | |
| 135 | # | |
| 136 | COPY /scripts/.guile /root/ | |
| 137 | COPY /scripts/unit-test.sh /root/ | |
| 138 | COPY /scripts/tmux.sh /root/ | |
| 139 | ||
| 140 | # Pre-compile the guile modules. We could say `guild comple ...`, but | |
| 141 | # this is easier. This avoids fly compilation during container start. | |
| 142 | RUN (bash -l -c "echo \"(use-modules (opencog))\" | guile ; \ | |
| 143 | echo \"(use-modules (opencog exec))\" | guile ; \ | |
| 144 | echo \"(use-modules (opencog logger))\" | guile ; \ | |
| 145 | echo \"(use-modules (opencog persist))\" | guile ; \ | |
| 146 | echo \"(use-modules (opencog persist-sql))\" | guile ; \ | |
| 147 | echo \"(use-modules (opencog query))\" | guile ; \ | |
| 148 | echo \"(use-modules (opencog rule-engine))\" | guile ; \ | |
| 149 | echo \"(use-modules (opencog atom-types))\" | guile ; \ | |
| 150 | echo \"(use-modules (opencog cogserver))\" | guile ; \ | |
| 151 | echo \"(use-modules (opencog nlp))\" | guile ; \ | |
| 152 | echo \"(use-modules (opencog nlp chatbot))\" | guile ; \ | |
| 153 | echo \"(use-modules (opencog nlp chatbot-eva))\" | guile ; \ | |
| 154 | echo \"(use-modules (opencog nlp fuzzy))\" | guile ; \ | |
| 155 | echo \"(use-modules (opencog nlp lg-dict))\" | guile ; \ | |
| 156 | echo \"(use-modules (opencog nlp microplanning))\" | guile ; \ | |
| 157 | echo \"(use-modules (opencog nlp relex2logic))\" | guile ; \ | |
| 158 | echo \"(use-modules (opencog nlp sureal))\" | guile ") | |
| 159 | ||
| 160 | WORKDIR /root | |
| 161 | # ENTRYPOINT bash -l -c "./unit-test.sh; bash" | |
| 162 | ENTRYPOINT bash -l -c "./tmux.sh; bash" | |
| 163 | # CMD /bin/bash |
| … | … | @@ -0,0 +1,36 @@ |
| 1 | ros-opencog | |
| 2 | ============ | |
| 3 | ||
| 4 | A docker image that installs both ROS and OpenCog. The image holds | |
| 5 | only the base packages needed for running OpenCog and ROS together; | |
| 6 | The CogServer is not started, no ROS nodes are started. | |
| 7 | ||
| 8 | ## Building | |
| 9 | ||
| 10 | Run the `build.sh` file in this directory. You need to have built | |
| 11 | the base ROS image (in the `../ros-base` directory) first. | |
| 12 | ||
| 13 | ## Testing | |
| 14 | To verify that OpenCog works, run the `run.sh` shell script. | |
| 15 | This will create a tmux (byobu) session inside the docker container. | |
| 16 | There are several things you can try: | |
| 17 | ||
| 18 | * Navigate to the build directories in `/opencog` and run the unit | |
| 19 | tests there. | |
| 20 | ||
| 21 | * Start `guile` at the prompt, and then try `(use-modules (opencog))` | |
| 22 | ||
| 23 | * Try starting the cogserver! At the guile prompt: | |
| 24 | ``` | |
| 25 | (use-modules (opencog) (opencog cogserver)) | |
| 26 | (start-cogserver) | |
| 27 | (Concept "foobar" (stv 0.5 0.8)) | |
| 28 | ``` | |
| 29 | Then from another tmux prompt: | |
| 30 | ``` | |
| 31 | telnet localhost 17001 | |
| 32 | (use-modules (opencog)) | |
| 33 | (cog-node 'ConceptNode "foobar") | |
| 34 | ``` | |
| 35 | The above should display `(ConceptNode "foobar" (stv 0.5 0.80000001))`. | |
| 36 | of course! |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for ros-opencog | |
| 4 | # | |
| 5 | docker build -t opencog/ros-indigo-opencog . |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | docker run --name="cog-ros" -it opencog/ros-indigo-opencog | |
| 8 | ||
| 9 | clear |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | ; | |
| 2 | ; .guile -- commands to execute on guile REPL startup. | |
| 3 | ; | |
| 4 | ;; rlb's method for activiting realine ... | |
| 5 | (use-modules (ice-9 readline)) | |
| 6 | (activate-readline) | |
| 7 | ||
| 8 | (debug-enable 'backtrace) | |
| 9 | ;; (debug-enable 'debug) | |
| 10 | ||
| 11 | ; Record positions of source code expressions. | |
| 12 | (read-enable 'positions) | |
| 13 | ||
| 14 | (add-to-load-path "/usr/local/share/opencog/scm") |
| … | … | @@ -0,0 +1,20 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # tmux.sh | |
| 4 | # | |
| 5 | # Run some tmux (byobu) terminals. | |
| 6 | # | |
| 7 | # Use byobu so that the scroll bars actually work | |
| 8 | byobu new-session -d -n 'bash' '$SHELL' | |
| 9 | ||
| 10 | tmux new-window -n 'b2' '$SHELL' | |
| 11 | tmux new-window -n 'b3' '$SHELL' | |
| 12 | tmux new-window -n 'b4' '$SHELL' | |
| 13 | ||
| 14 | # Spare-usage shell | |
| 15 | tmux new-window -n 'bash' '$SHELL' | |
| 16 | ||
| 17 | # Fix the annoying byobu display | |
| 18 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 19 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 20 | tmux attach |
| … | … | @@ -0,0 +1,25 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # unit-test.sh | |
| 4 | # | |
| 5 | # Run the OpenCog unit tests on container startup. | |
| 6 | # Provide a spare teminal in the meanwhile. | |
| 7 | # | |
| 8 | echo "Will Run OpenCog unit tests..." | |
| 9 | ||
| 10 | # Use byobu so that the scroll bars actually work | |
| 11 | byobu new-session -d -n 'bash' '$SHELL' | |
| 12 | ||
| 13 | tmux new-window -n 'utils' 'cd /opencog/cogutil/build && make test; $SHELL' | |
| 14 | tmux new-window -n 'atoms' 'cd /opencog/atomspace/build && make test; $SHELL' | |
| 15 | tmux new-window -n 'servr' 'cd /opencog/opencog/build && make test; $SHELL' | |
| 16 | ||
| 17 | # Spare-usage shell | |
| 18 | tmux new-window -n 'bash' '$SHELL' | |
| 19 | ||
| 20 | # Fix the annoying byobu display | |
| 21 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 22 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 23 | tmux attach | |
| 24 | ||
| 25 | echo "Started" |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep cog-ros |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep cog-ros` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm cog-ros | |
| 14 | fi |
| … | … | @@ -0,0 +1,114 @@ |
| 1 | # docker build -t opencog/ros-indigo-zenorsm . | |
| 2 | # xhost + | |
| 3 | # docker run --rm --privileged -i -v /dev/ttyACM0:/dev/ttyACM0 -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 -p 33433:33433/udp -t opencog/ros-indigo-zenorsm | |
| 4 | # Note: port 33433=faceshift, /dev/ttyACM0=pololu, /dev/dri=gpu, /dev/shm=gpu | |
| 5 | # ToDo: add MORSE robot simulator | |
| 6 | # replace faceshift with OpenCV FaceRecognizer, etc. | |
| 7 | ||
| 8 | FROM opencog/ros-indigo-dev | |
| 9 | MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com" | |
| 10 | MAINTAINER David Hart "dhart@opencog.org" | |
| 11 | ||
| 12 | RUN apt-get -y update | |
| 13 | RUN apt-get -y install blender | |
| 14 | ||
| 15 | RUN apt-get -y install python3-yaml python3-pip | |
| 16 | RUN pip3 install rospkg catkin_pkg | |
| 17 | ||
| 18 | RUN echo source /catkin_ws/devel/setup.bash >> /.bash_profile && \ | |
| 19 | echo -e "\e[1;34m[$SELF_NAME] catkin devel setup\.bash sourced\e[0m" | |
| 20 | ||
| 21 | # Install ITFTalk and prerequisites | |
| 22 | WORKDIR /catkin_ws/src | |
| 23 | RUN apt-get -y install mplayer python-pycurl libcurl3 | |
| 24 | RUN apt-get install libavbin-dev libavbin0 | |
| 25 | ||
| 26 | RUN git clone https://github.com/geni-lab/ITFTalk | |
| 27 | ||
| 28 | # Install ITFListen and prerequisites | |
| 29 | WORKDIR /catkin_ws/src | |
| 30 | RUN apt-get -y install sox python-simplejson | |
| 31 | RUN git clone https://github.com/geni-lab/ITFListen | |
| 32 | ||
| 33 | # Install ITFParrot to test ITFListen -> ITFTalk | |
| 34 | WORKDIR /catkin_ws/src | |
| 35 | RUN git clone https://github.com/geni-lab/ITFParrot | |
| 36 | ||
| 37 | # I figured it'd be undesirable to auto-start the aprrot, so | |
| 38 | # to Run ITFParrot, go to /catkin_ws and then run: | |
| 39 | # source devel/setup.bash | |
| 40 | # rosrun itf_parrot itf_parrot.py | |
| 41 | ||
| 42 | # Install openEAR prerequisites | |
| 43 | RUN apt-get -y install autoconf libtool g++ libportaudio2 | |
| 44 | ||
| 45 | # Download ROS-enabled version of openEAR | |
| 46 | # WORKDIR / | |
| 47 | # Line below is needed otherwise it keeps saying ros_open_ear exists | |
| 48 | # and is not empty | |
| 49 | # RUN rm -rf /ros_open_ear | |
| 50 | # RUN git clone https://github.com/Alex-van-der-Peet/ros_open_ear | |
| 51 | ||
| 52 | # Unpack, make and install portaudio (openEAR prerequisite) | |
| 53 | # WORKDIR /ros_open_ear/thirdparty | |
| 54 | # RUN tar -xvf portaudio.tgz | |
| 55 | # WORKDIR /ros_open_ear/thirdparty/portaudio | |
| 56 | # RUN ./configure | |
| 57 | # RUN make | |
| 58 | # RUN make install | |
| 59 | ||
| 60 | # Configure, build and install the modified version of openEAR | |
| 61 | # WORKDIR /ros_open_ear | |
| 62 | # Double run below is on purpose | |
| 63 | # ENV C_INCLUDE_PATH /opt/ros/indigo/include/ros:/opt/ros/indigo/include | |
| 64 | # RUN ./autogen.sh | |
| 65 | # RUN ./autogen.sh | |
| 66 | # RUN ./configure | |
| 67 | # RUN apt-get install libc6-dev build-essential | |
| 68 | # RUN echo "C_INCLUDEPATH=$C_INCLUDE_PATH" | |
| 69 | # RUN make | |
| 70 | # RUN make install | |
| 71 | ||
| 72 | WORKDIR /catkin_ws/src | |
| 73 | RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh | |
| 74 | ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages | |
| 75 | RUN /usr/bin/python3 /opt/ros/indigo/bin/catkin_init_workspace | |
| 76 | ||
| 77 | RUN git clone https://github.com/hansonrobotics/robo_blender | |
| 78 | RUN git clone https://github.com/yantrabuddhi/ros_pololu_servo | |
| 79 | # RUN git clone https://github.com/yantrabuddhi/ros_nmpt_saliency | |
| 80 | # Mandeep's saliency tracker above doesn't work, so I'm using the one I made | |
| 81 | # which is stored in Jamie's repo - Alex | |
| 82 | RUN git clone https://github.com/jdddog/ros_nmpt_saliency | |
| 83 | RUN git clone https://github.com/yantrabuddhi/ros_faceshift | |
| 84 | RUN git clone https://github.com/yantrabuddhi/simple_face_tracker | |
| 85 | #RUN git clone https://github.com/OctoMap/octomap | |
| 86 | #RUN git clone https://github.com/Alex-van-der-Peet/ITFOpenEar | |
| 87 | ||
| 88 | WORKDIR /catkin_ws | |
| 89 | RUN bash -l -c "/usr/bin/python3 /opt/ros/indigo/bin/catkin_make" | |
| 90 | ||
| 91 | WORKDIR /catkin_ws/src/robo_blender/src | |
| 92 | ||
| 93 | ENV STARTSCRIPT "\ | |
| 94 | echo evaluating startup script... &&\ | |
| 95 | source /catkin_ws/devel/setup.bash &&\ | |
| 96 | tmux new-session -d 'echo -e \"\e[1;34mroscore\e[0m\" ; roscore' &&\ | |
| 97 | tmux set -g set-remain-on-exit on &&\ | |
| 98 | tmux set-option -g set-remain-on-exit on &&\ | |
| 99 | tmux bind-key R respawn-window &&\ | |
| 100 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_pololu_servo\e[0m\" ;\ | |
| 101 | rosrun ros_pololu_servo ros_pololu_servo_node' &&\ | |
| 102 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mblender robo.blend\e[0m\" ;\ | |
| 103 | sleep 4 && blender robo.blend' &&\ | |
| 104 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mbash shell\e[0m\" ;\ | |
| 105 | bash -l -i' &&\ | |
| 106 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_talk\e[0m\" ;\ | |
| 107 | rosrun itf_talk itf_talk.py' &&\ | |
| 108 | tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_listen\e[0m\" ;\ | |
| 109 | rosrun itf_listen itf_listen.py' &&\ | |
| 110 | tmux select-layout even-vertical &&\ | |
| 111 | tmux attach \ | |
| 112 | " | |
| 113 | ||
| 114 | CMD /bin/bash -l -c "eval $STARTSCRIPT" |
| … | … | @@ -0,0 +1,10 @@ |
| 1 | ros-indigo-zenorsm | |
| 2 | ================== | |
| 3 | ||
| 4 | Based on (copied from) ros-indigo-blender. | |
| 5 | ||
| 6 | An integrated development container for teleoperating Hanson Robotics' small | |
| 7 | Einstein head. This container was demo'd at ROS Kong 2014 by David Hanson. | |
| 8 | ||
| 9 | The Einstein head contains servos driven by a Pololu board and controlled | |
| 10 | via Blender. Saliency detection is TBD. |
| … | … | @@ -0,0 +1,37 @@ |
| 1 | Status of ROS noetic port and bit rot removal | |
| 2 | ============================================== | |
| 3 | This project so far is in the Roadmap 1 stage. See below. | |
| 4 | ||
| 5 | Dependencies | |
| 6 | ============ | |
| 7 | ||
| 8 | eva-ros --> ros-blender -------------------------- | |
| 9 | \ | |
| 10 | \ | |
| 11 | eva-silent ---- \ | |
| 12 | \ \ | |
| 13 | v v | |
| 14 | eva-opencog --> ros-incog-blender --> ros-opencog --> ros-base | |
| 15 | ||
| 16 | ||
| 17 | Roadmap | |
| 18 | ======= | |
| 19 | 1. eva-ros builds | |
| 20 | (will need to replace the vision / face detection subsystem - Done!) | |
| 21 | ISSUES: | |
| 22 | - the "roslaunch robots_config geometry.launch" fails to start | |
| 23 | - blender has issues: NOSE bone missing? dependency cycles ... | |
| 24 | Sophia has no eyes? | |
| 25 | 2. eva-ros works | |
| 26 | ISSUES: | |
| 27 | not started | |
| 28 | 4. eva-silent builds & works | |
| 29 | ISSUES: | |
| 30 | not started | |
| 31 | 5. eva-opencog builds & works | |
| 32 | ISSUES: | |
| 33 | not started | |
| 34 | ||
| 35 | For Further Reading | |
| 36 | =================== | |
| 37 | See the README.md in ../indigo |
| … | … | @@ -0,0 +1,74 @@ |
| 1 | # | |
| 2 | # Container for the Hanson Robotics Eva blender rig ROS node, and | |
| 3 | # the ROS vision subsystem. It does not include behaviors or a | |
| 4 | # chatbot. On launch, it will start roscore, blender, and the vision | |
| 5 | # (face-detection) subsystem, but will not perform any behaviors. | |
| 6 | # | |
| 7 | # To build: | |
| 8 | # sudo docker build -t opencog/eva-ros . | |
| 9 | # | |
| 10 | FROM opencog/ros-noetic-blender | |
| 11 | MAINTAINER Mark Wigzell "markwigzell@gmail.com" | |
| 12 | ||
| 13 | # Install required packages | |
| 14 | ENV LAST_OS_UPDATE 2022-02-25 | |
| 15 | RUN apt-get -y update | |
| 16 | RUN apt-get -y upgrade | |
| 17 | RUN apt-get -y install ros-noetic-tf ros-noetic-driver-common | |
| 18 | RUN apt-get -y install ros-noetic-cv-bridge ros-noetic-image-transport | |
| 19 | RUN apt-get -y install ros-noetic-usb-cam | |
| 20 | # The below are needed by perception node | |
| 21 | RUN apt-get -y install ros-noetic-robot-state-publisher | |
| 22 | RUN apt-get -y install ros-noetic-joint-state-publisher | |
| 23 | RUN apt-get -y install ros-noetic-joint-state-publisher-gui | |
| 24 | ||
| 25 | # Install catkinized packages | |
| 26 | WORKDIR /catkin_ws/src | |
| 27 | ||
| 28 | RUN git clone https://github.com/opencog/pi_vision.git | |
| 29 | RUN git clone https://github.com/opencog/perception.git | |
| 30 | RUN git clone https://github.com/opencog/blender_api_msgs.git | |
| 31 | RUN git clone https://github.com/opencog/blender_api.git | |
| 32 | ||
| 33 | # The pau2motors package defines the PAU messages, which are | |
| 34 | # needed by the perception (vision-geometry) module. | |
| 35 | RUN git clone https://github.com/opencog/pau2motors.git | |
| 36 | RUN git clone https://github.com/opencog/robots_config.git | |
| 37 | ||
| 38 | # The OpenCog github account mirrors all of the Hanson Robotics | |
| 39 | # software. At this time, the two are in sync with each-other. | |
| 40 | # RUN git clone https://github.com/opencog/pi_vision.git | |
| 41 | # RUN git clone https://github.com/opencog/perception.git | |
| 42 | # RUN git clone https://github.com/opencog/blender_api_msgs.git | |
| 43 | # RUN git clone https://github.com/opencog/blender_api.git | |
| 44 | # RUN git clone https://github.com/opencog/pau2motors.git | |
| 45 | # RUN git clone https://github.com/opencog/robots_config.git | |
| 46 | ||
| 47 | # Change line below on rebuild. Will use cache up to this line | |
| 48 | ENV LAST_SOFTWARE_UPDATE 2022-02-25 | |
| 49 | ||
| 50 | # Git pull for all packages | |
| 51 | RUN cd /catkin_ws/src/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 52 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 53 | ||
| 54 | # The blender API has not been fully catkinized yet. | |
| 55 | RUN pip3 install ./blender_api_msgs/ dlib | |
| 56 | # crappy python. Do we have to switch all our calls whenever python has major release? | |
| 57 | RUN ln -s /usr/bin/python3 /usr/bin/python | |
| 58 | ||
| 59 | # build the catkin packages. Run twice for good measure. | |
| 60 | # (some may fail first time due to bad deps) | |
| 61 | WORKDIR /catkin_ws | |
| 62 | RUN bash -l -c "/opt/ros/noetic/bin/catkin_make" || true | |
| 63 | RUN bash -l -c "/opt/ros/noetic/bin/catkin_make" | |
| 64 | ||
| 65 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc | |
| 66 | ||
| 67 | COPY /scripts/eva.sh /catkin_ws/eva.sh | |
| 68 | COPY /scripts/sophia.sh /catkin_ws/sophia.sh | |
| 69 | ||
| 70 | # Ports exposed | |
| 71 | # 11311 is roscore | |
| 72 | EXPOSE 11311 | |
| 73 | ||
| 74 | ENTRYPOINT bash -l -c "./sophia.sh; bash" |
| … | … | @@ -0,0 +1,28 @@ |
| 1 | eva-ros | |
| 2 | ======= | |
| 3 | ||
| 4 | An image containing the Hanson Robotics Eva blender rig, and the ROS | |
| 5 | vision subsystem. It does not contain any parts of OpenCog, or a | |
| 6 | chatbot, nor any behavior controls; its just blender+vision. | |
| 7 | ||
| 8 | The data processing pipeline consists of: | |
| 9 | * A ROS node that takes video input from a UVC-compatible USB webcam | |
| 10 | (most typical desktop/laptop cameras are compatible). | |
| 11 | * A ROS node that does face detection: it tries to find human faces in | |
| 12 | the video feed. | |
| 13 | * A ROS node that maps the face postions to a 3D coordinate system. | |
| 14 | * A ROS node that runs the Eva blender rig itself (i.e. uses blender | |
| 15 | to draw/animate Eva). | |
| 16 | * A ROS node that converts PAU (Physiological Action Units) into motor | |
| 17 | controls, needed for animating physical robot models. | |
| 18 | ||
| 19 | ## Building | |
| 20 | ||
| 21 | Run the `build.sh` file in this directory. You need to have built | |
| 22 | the ros-noetic-blender image (in the `../blender` directory) first. | |
| 23 | ||
| 24 | ## Testing | |
| 25 | To verify that blender works, run the `run.sh` shell script. | |
| 26 | This will start blender and the half-dozen ROS nodes that control it. | |
| 27 | You should see a living, breating Eva; however, she is lobotimized: | |
| 28 | there's no brain, she cannot actually see you, and will not react. |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for eva-ros | |
| 4 | # | |
| 5 | docker build -t opencog/eva-ros . |
| … | … | @@ -0,0 +1,19 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | # Assorted grunge to let X11 use the 3D graphics acceleration. | |
| 11 | # 11311 is the roscore port | |
| 12 | docker run --name="eva-ros" -p 11311:11311 \ | |
| 13 | -e DISPLAY=:0.0 --privileged \ | |
| 14 | -v /dev/video0:/dev/video0 -v /dev/snd:/dev/snd \ | |
| 15 | -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 -v /dev/dri:/dev/dri \ | |
| 16 | -v /dev/shm:/dev/shm -it opencog/eva-ros | |
| 17 | ||
| 18 | xhost -local:root | |
| 19 | #clear |
| … | … | @@ -0,0 +1,32 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # eva.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics Eva blender head. | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work | |
| 15 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 16 | sleep 4; | |
| 17 | ||
| 18 | # Single Video (body) camera and face tracker | |
| 19 | tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL' | |
| 20 | # Publish the geometry messages | |
| 21 | tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL' | |
| 22 | tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL' | |
| 23 | ||
| 24 | # Spare-usage shell | |
| 25 | tmux new-window -n 'bash' '$SHELL' | |
| 26 | ||
| 27 | # Fix the annoying byobu display | |
| 28 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 29 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 30 | tmux attach | |
| 31 | ||
| 32 | echo "Started" |
| … | … | @@ -0,0 +1,32 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # eva.sh | |
| 4 | # | |
| 5 | # ROS + blender launch script for the Hanson Robotics Eva blender head. | |
| 6 | # This shell script is automatically started within the docker container. | |
| 7 | # It needs to run in the catkin_ws directory where the various ROS nodes | |
| 8 | # and blender models were installed. It assumes that catkin_make was | |
| 9 | # already run. | |
| 10 | ||
| 11 | source devel/setup.sh | |
| 12 | echo "Starting... this will take 15-20 seconds..." | |
| 13 | ||
| 14 | # Use byobu so that the scroll bars actually work | |
| 15 | byobu new-session -d -n 'roscore' 'roscore; $SHELL' | |
| 16 | sleep 4; | |
| 17 | ||
| 18 | # Single Video (body) camera and face tracker | |
| 19 | tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL' | |
| 20 | # Publish the geometry messages | |
| 21 | tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL' | |
| 22 | tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Sophia.blend -P autostart.py; $SHELL' | |
| 23 | ||
| 24 | # Spare-usage shell | |
| 25 | tmux new-window -n 'bash' '$SHELL' | |
| 26 | ||
| 27 | # Fix the annoying byobu display | |
| 28 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 29 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 30 | tmux attach | |
| 31 | ||
| 32 | echo "Started" |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep eva-ros |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep eva-ros` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm eva-ros | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,52 @@ |
| 1 | # | |
| 2 | # Base ROS noetic installation. | |
| 3 | # Bare bones install; does not launch any nodes. | |
| 4 | # | |
| 5 | # To build: | |
| 6 | # docker build -t opencog/ros-noetic-base . | |
| 7 | # | |
| 8 | # To run: | |
| 9 | # docker run --rm --name="noetic-base" -i -t opencog/ros-noetic-base | |
| 10 | # | |
| 11 | FROM ubuntu:20.04 | |
| 12 | MAINTAINER Mark Wigzell "markwigzell@gmail.com" | |
| 13 | ||
| 14 | # Avoid triggering apt-get dialogs (which may lead to errors). See: | |
| 15 | # http://stackoverflow.com/questions/25019183/docker-java7-install-fail | |
| 16 | ENV DEBIAN_FRONTEND noninteractive | |
| 17 | ||
| 18 | ENV LAST_OS_UPDATE 2022-02-25_2 | |
| 19 | RUN apt-get -y upgrade | |
| 20 | RUN apt-get -y update | |
| 21 | RUN apt-get -y install iproute2 iputils-ping apt-utils | |
| 22 | ||
| 23 | # Need software-properties-common for `add-apt-repository` command | |
| 24 | RUN apt-get -y install wget software-properties-common sudo | |
| 25 | RUN apt-get -y install --no-install-recommends xserver-xorg-core xauth x11-apps x11-utils | |
| 26 | RUN wget http://packages.ros.org/ros.key -O - | sudo apt-key add - | |
| 27 | RUN echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list | |
| 28 | RUN apt-get -y update | |
| 29 | # | |
| 30 | # Most robot bringup will require git-cloning the working repos. | |
| 31 | # Need byobu+tmux for ROS terminal control. | |
| 32 | # Need vim so that we can do at least some basic debugging. | |
| 33 | RUN apt-get -y install ros-noetic-ros-base ros-noetic-angles | |
| 34 | RUN apt-get -y install git tmux byobu vim | |
| 35 | ||
| 36 | # Make vim be usable instead of insane. | |
| 37 | COPY /scripts/.vimrc /root/ | |
| 38 | ||
| 39 | # Environment Variables | |
| 40 | ## Set Locale -- Catkin crashes on Krisčiunas, Mickevičius without this. | |
| 41 | RUN apt-get -y install locales | |
| 42 | RUN locale-gen en_US.UTF-8 | |
| 43 | ENV LANG en_US.UTF-8 | |
| 44 | ENV LANGUAGE en_US:en | |
| 45 | ENV LC_ALL en_US.UTF-8 | |
| 46 | ||
| 47 | RUN apt-get -y install python3-pip | |
| 48 | RUN pip install -U rosdep | |
| 49 | RUN rosdep init | |
| 50 | RUN rosdep update | |
| 51 | RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc | |
| 52 | CMD /bin/bash |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | ros-noetic-base | |
| 2 | =============== | |
| 3 | ||
| 4 | The base image for building other docker imagess that use ROS. The | |
| 5 | container installs and configures a fair variety of ROS packages | |
| 6 | needed for running ROS nodes. No actual ROS nodes are started. | |
| 7 | ||
| 8 | ## Building | |
| 9 | ||
| 10 | Run the `build.sh` file in this directory. You need to have first | |
| 11 | obtained (downloaded) the ubuntu:14.04 image from Docker. | |
| 12 | ||
| 13 | ## Testing | |
| 14 | To verify that things works, run the `run.sh` shell script. | |
| 15 | This should result in a shell prompt inside the docker container. | |
| 16 | You can start roscore simply by saying `roscore`. Of course, roscore | |
| 17 | by itself, does not do anything interesting... |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build the base image images. | |
| 6 | # | |
| 7 | docker build -t opencog/ros-noetic-base . |
| … | … | @@ -0,0 +1,11 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Just for fun, we will export the roscore port 11311 out of the | |
| 8 | # container. That way, if you run roscore inside the container, | |
| 9 | # and you can `rostopic list` outside of it! | |
| 10 | docker run --name="ros-base" \ | |
| 11 | -p 11311:11311 -it opencog/ros-noetic-base |
| … | … | @@ -0,0 +1,22 @@ |
| 1 | set wrapmargin=8 | |
| 2 | set ts=3 | |
| 3 | set showmode | |
| 4 | set noautoindent | |
| 5 | set encoding=utf-8 | |
| 6 | ||
| 7 | " Sets the color scheme to something easier on my eyes. | |
| 8 | colo evening | |
| 9 | ||
| 10 | " Only do this part when compiled with support for autocommands. | |
| 11 | if has("autocmd") | |
| 12 | " When editing a file, always jump to the last known cursor position. | |
| 13 | " Don't do it when the position is invalid or when inside an event handler | |
| 14 | " (happens when dropping a file on gvim). | |
| 15 | autocmd BufReadPost * | |
| 16 | \ if line("'\"") > 0 && line("'\"") <= line("$") | | |
| 17 | \ exe "normal g`\"" | | |
| 18 | \ endif | |
| 19 | ||
| 20 | endif " has("autocmd") | |
| 21 | ||
| 22 | " /etc/vimrc ends here |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep ros-base |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container.. ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep ros-base` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm ros-base | |
| 14 | fi |
| … | … | @@ -0,0 +1,55 @@ |
| 1 | # | |
| 2 | # Docker file for base ROS+Blender install | |
| 3 | # No ROS nodes are started. | |
| 4 | # | |
| 5 | # The primary difficulty here is that Blender wants Python3 | |
| 6 | # while ROS wants Python2, and so there are install conflicts. | |
| 7 | # | |
| 8 | # To build: | |
| 9 | # docker build -t opencog/ros-noetic-blender . | |
| 10 | # | |
| 11 | # To run: | |
| 12 | # docker run --rm --privileged -i -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 13 | # -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 \ | |
| 14 | # -t opencog/ros-noetic-blender | |
| 15 | # | |
| 16 | # The above should be sufficient to get blender running with full | |
| 17 | # 3D hardware acceleration on the local host (dri==direct rendering interface) | |
| 18 | # Note: /dev/dri=gpu, /dev/shm=gpu | |
| 19 | # | |
| 20 | FROM opencog/ros-noetic-base | |
| 21 | MAINTAINER Mark Wigzell "markwigzell@gmail.com" | |
| 22 | ||
| 23 | ENV LAST_OS_UPDATE 2020-04-23 | |
| 24 | ||
| 25 | ||
| 26 | # Blender with dependencies | |
| 27 | # Install x11-utils to get xdpyinfo, for X11 display debugging | |
| 28 | # mesa-utils provides glxinfo, handy for understanding the 3D support. | |
| 29 | # Blender needs python3 | |
| 30 | RUN apt-get -y install mesa-utils python3-yaml | |
| 31 | ENV LAST_OS_UPDATE 2022-02-25_2 | |
| 32 | ################################################################################ | |
| 33 | # ROS | |
| 34 | RUN apt-get -y install blender | |
| 35 | # We install ROS package and catkin package management | |
| 36 | RUN pip3 install rospkg catkin_pkg | |
| 37 | ||
| 38 | WORKDIR /catkin_ws/src | |
| 39 | RUN cp /opt/ros/noetic/setup.sh /etc/profile.d/ros_noetic.sh | |
| 40 | RUN bash -l -c "/usr/bin/python3 /opt/ros/noetic/bin/catkin_init_workspace" | |
| 41 | ||
| 42 | # Must run catkin at least once, even if there is nothing to build; | |
| 43 | # it creates the needed directory structure and the needed setup.sh. | |
| 44 | WORKDIR /catkin_ws | |
| 45 | RUN bash -l -c "/opt/ros/noetic/bin/catkin_make" | |
| 46 | ||
| 47 | # Empty ROS Enviroment Setup | |
| 48 | # The user is root; so ~/.bash_profile is /root/.bash_profile | |
| 49 | RUN echo source /catkin_ws/devel/setup.bash >> ~/.bash_profile && \ | |
| 50 | echo -e "\e[1;34m[$SELF_NAME] catkin devel setup\.bash sourced\e[0m" | |
| 51 | # ROS end | |
| 52 | ############################################################################# | |
| 53 | ||
| 54 | ENV DISPLAY :0.0 | |
| 55 | CMD /bin/bash |
| … | … | @@ -0,0 +1,18 @@ |
| 1 | ros-noetic-blender | |
| 2 | ================== | |
| 3 | ||
| 4 | A docker image that installs both ROS and blender, for demoing | |
| 5 | ROS-controlled blender animations. The image holds only the base | |
| 6 | packages needed for running blender and ROS together; no actual ROS | |
| 7 | nodes are started, no blender animations are run. | |
| 8 | ||
| 9 | ## Building | |
| 10 | ||
| 11 | Run the `build.sh` file in this directory. You need to have built | |
| 12 | the base ROS image (in the `../ros-base` directory) first. | |
| 13 | ||
| 14 | ## Testing | |
| 15 | To verify that blender works, run the `run.sh` shell script. | |
| 16 | This should result in a shell prompt inside the docker container. | |
| 17 | You can start blender simply by saying `blender`; it should display | |
| 18 | on your desktop. |
| … | … | @@ -0,0 +1,7 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # build.sh | |
| 4 | # | |
| 5 | # Build this docker image. | |
| 6 | # | |
| 7 | docker build -t opencog/ros-noetic-blender . |
| … | … | @@ -0,0 +1,16 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | # Enable local, non-network connections to X-Server | |
| 8 | xhost +local:root | |
| 9 | ||
| 10 | docker run --name="ros-blender" \ | |
| 11 | -p 11311:11311 \ | |
| 12 | --privileged -i -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0 \ | |
| 13 | -v /dev/dri:/dev/dri -v /dev/shm:/dev/shm -e DISPLAY=:0.0 \ | |
| 14 | -t opencog/ros-noetic-blender | |
| 15 | ||
| 16 | xhost -local:root |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep ros-blender |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container.. ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep ros-blender` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing.. ' | |
| 13 | docker rm ros-blender | |
| 14 | fi | |
| 15 | ||
| 16 | # Disable local X11 connections, just in case. | |
| 17 | xhost -local:root |
| … | … | @@ -0,0 +1,199 @@ |
| 1 | # | |
| 2 | # Container for ROS+OpenCog | |
| 3 | # | |
| 4 | # To build: | |
| 5 | # sudo docker build -t opencog/ros-noetic-opencog . | |
| 6 | # | |
| 7 | FROM opencog/ros-noetic-base | |
| 8 | MAINTAINER Mark Wigzell "markwigzell@gmail.com" | |
| 9 | ||
| 10 | # Install required packages | |
| 11 | ENV LAST_OS_UPDATE 2022-03-05 | |
| 12 | RUN apt-get -y update | |
| 13 | RUN apt-get -y upgrade | |
| 14 | # Base stuff for cogutil. All on one line, to avoid error | |
| 15 | # `Cannot create container with more than 127 parents` | |
| 16 | RUN apt-get -y install gcc g++ cmake binutils-dev libiberty-dev \ | |
| 17 | libboost-dev libboost-date-time-dev libboost-filesystem-dev \ | |
| 18 | libboost-program-options-dev libboost-regex-dev \ | |
| 19 | libboost-serialization-dev libboost-system-dev libboost-thread-dev \ | |
| 20 | cxxtest | |
| 21 | ||
| 22 | # Additional stuff for the AtomSpace: cython and guile. | |
| 23 | # RocksDB is needed for the RocksStorageNode | |
| 24 | # We need rlwrap+telnet for the CogServer. | |
| 25 | # Octomap is for spacetime, needed by PLN. | |
| 26 | RUN apt-get -y install guile-3.0-dev cython librocksdb-dev telnet rlwrap \ | |
| 27 | liboctomap-dev | |
| 28 | ||
| 29 | # Need wget to download link-grammar source. | |
| 30 | RUN apt-get install -y wget flex libpcre2-dev locales | |
| 31 | ||
| 32 | # ------------------------------------------------------------- | |
| 33 | # Need assorted locales for Link Grammar | |
| 34 | RUN (echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ | |
| 35 | echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 36 | echo "th_TH.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 37 | echo "de_DE.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 38 | echo "fa_IR.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 39 | echo "ar_AE.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 40 | echo "he_IL.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 41 | echo "kk_KZ.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 42 | echo "lt_LT.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
| 43 | echo "tr_TR.UTF-8 UTF-8" >> /etc/locale.gen) | |
| 44 | ||
| 45 | # WTF. In debian wheezy, it is enough to just say locale-gen without | |
| 46 | # any arguments. But in Ubuntu, we need to be explicit. I'm confused. | |
| 47 | # RUN locale-gen | |
| 48 | # Note also: under Ubuntu, fa_IR.UTF-8 causes locale-gen to fail, | |
| 49 | # must use the naked fa_IR | |
| 50 | # Note also: Kazakh is kk_KZ not kz_KZ | |
| 51 | RUN locale-gen en_US.UTF-8 ru_RU.UTF-8 he_IL.UTF-8 th_TH.UTF-8 \ | |
| 52 | de_DE.UTF-8 lt_LT.UTF-8 fa_IR ar_AE.UTF-8 kk_KZ.UTF-8 tr_TR.UTF-8 | |
| 53 | ||
| 54 | # ------------------------------------------------------------- | |
| 55 | # Right now, just clone the OpenCog sources. They will be built | |
| 56 | # later on. | |
| 57 | WORKDIR /opencog | |
| 58 | RUN git clone https://github.com/opencog/cogutil.git | |
| 59 | RUN git clone https://github.com/opencog/atomspace.git | |
| 60 | RUN git clone https://github.com/opencog/atomspace-rocks.git | |
| 61 | RUN git clone https://github.com/opencog/cogserver.git | |
| 62 | RUN git clone https://github.com/opencog/atomspace-cog.git | |
| 63 | RUN git clone https://github.com/opencog/lg-atomese.git | |
| 64 | RUN git clone https://github.com/opencog/unify.git | |
| 65 | RUN git clone https://github.com/opencog/ure.git | |
| 66 | RUN git clone https://github.com/opencog/spacetime.git | |
| 67 | RUN git clone https://github.com/opencog/pln.git | |
| 68 | RUN git clone https://github.com/opencog/relex.git | |
| 69 | RUN git clone https://github.com/opencog/opencog.git | |
| 70 | ||
| 71 | # ------------------------------------------------------------- | |
| 72 | # Download and build Link Grammar. | |
| 73 | WORKDIR /src | |
| 74 | ||
| 75 | # Touch this tag to grab the latest version of LinkGrammar. | |
| 76 | ENV LAST_LG_UPDATE 2022-11-26_1 | |
| 77 | ||
| 78 | # Download the current released version of link-grammar. | |
| 79 | # We do NOT want to git-clone this; the git version is unstable; | |
| 80 | # it also requires extra tools and mish-mash to build it. | |
| 81 | # RUN http://www.abisource.com/downloads/link-grammar/current/link-grammar-5*.tar.gz | |
| 82 | # The wget tries to guess the correct file to download w/ wildcard | |
| 83 | # But that won't work. | |
| 84 | RUN wget -r --no-parent -nH --cut-dirs=2 http://www.abisource.com/downloads/link-grammar/current/ | |
| 85 | ||
| 86 | # Unpack the sources, too. | |
| 87 | RUN tar -zxf current/link-grammar-5*.tar.gz | |
| 88 | ||
| 89 | # Build the libraries and command-line parser only | |
| 90 | # Assumes that the sources have already been unpacked. | |
| 91 | RUN (cd link-grammar-5*; mkdir build; cd build; \ | |
| 92 | ../configure; make -j12; make install; ldconfig) | |
| 93 | ||
| 94 | RUN adduser --disabled-password --gecos "Link Parser User" link-parser | |
| 95 | ||
| 96 | USER link-parser | |
| 97 | RUN (cd /home/link-parser; echo "export LANG=en_US.UTF-8" >> .bash_aliases) | |
| 98 | CMD bash | |
| 99 | ||
| 100 | RUN export LANG=en_US.UTF-8 | |
| 101 | ||
| 102 | # ------------------------------------------------------------- | |
| 103 | USER root | |
| 104 | WORKDIR /opencog | |
| 105 | ||
| 106 | # Change line below on rebuild. Will use Docker cache up to this line, | |
| 107 | # twigging this date will update the opencog sources. | |
| 108 | ENV LAST_SOFTWARE_UPDATE 2023-01-11 | |
| 109 | ||
| 110 | # Git pull for all packages | |
| 111 | RUN cd /opencog/ && find . -maxdepth 1 -mindepth 1 -type d \ | |
| 112 | -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \; | |
| 113 | ||
| 114 | # Build the base software. | |
| 115 | RUN (mkdir /opencog/cogutil/build; cd /opencog/cogutil/build; \ | |
| 116 | cmake ..; make -j6; make install) | |
| 117 | RUN (mkdir /opencog/atomspace/build; cd /opencog/atomspace/build; \ | |
| 118 | cmake ..; make -j12; make install) | |
| 119 | RUN (mkdir /opencog/cogserver/build; cd /opencog/cogserver/build; \ | |
| 120 | cmake ..; make -j12; make install) | |
| 121 | RUN (mkdir /opencog/atomspace-rocks/build; cd /opencog/atomspace-rocks/build; \ | |
| 122 | cmake ..; make -j12; make install) | |
| 123 | RUN (mkdir /opencog/atomspace-cog/build; cd /opencog/atomspace-cog/build; \ | |
| 124 | cmake ..; make -j12; make install) | |
| 125 | RUN (mkdir /opencog/lg-atomese/build; cd /opencog/lg-atomese/build; \ | |
| 126 | cmake ..; make -j12; make install) | |
| 127 | RUN (mkdir /opencog/unify/build; cd /opencog/unify/build; \ | |
| 128 | cmake ..; make -j12; make install) | |
| 129 | RUN (mkdir /opencog/ure/build; cd /opencog/ure/build; \ | |
| 130 | cmake ..; make -j12; make install) | |
| 131 | RUN (mkdir /opencog/spacetime/build; cd /opencog/spacetime/build; \ | |
| 132 | cmake ..; make -j12; make install) | |
| 133 | RUN (mkdir /opencog/pln/build; cd /opencog/pln/build; \ | |
| 134 | cmake ..; make -j12; make install) | |
| 135 | RUN (mkdir /opencog/opencog/build; cd /opencog/opencog/build; \ | |
| 136 | cmake ..; make -j12; make install) | |
| 137 | ||
| 138 | # ------------------------------------------------------------- | |
| 139 | # Additional stuff needed to build and run relex. | |
| 140 | # Need unzip to unzip JWNL. | |
| 141 | RUN apt-get -y install wordnet-dev wordnet-sense-index \ | |
| 142 | ant libcommons-logging-java libgetopt-java unzip | |
| 143 | ||
| 144 | # Download and install JWNL; its needed for relex. | |
| 145 | WORKDIR /src | |
| 146 | RUN wget http://downloads.sourceforge.net/project/jwordnet/jwnl/JWNL%201.4/jwnl14-rc2.zip | |
| 147 | RUN (unzip jwnl14-rc2.zip jwnl14-rc2/jwnl.jar ; \ | |
| 148 | mkdir /usr/local/share/java ; \ | |
| 149 | mv -v jwnl14-rc2/jwnl.jar /usr/local/share/java ; \ | |
| 150 | rm -v jwnl14-rc2.zip ; rmdir jwnl14-rc2 ; \ | |
| 151 | chmod -v 0644 /usr/local/share/java/jwnl.jar) | |
| 152 | ||
| 153 | COPY /scripts/install-ubuntu-relex.sh /opencog/relex/install-scripts/ | |
| 154 | RUN (cd /opencog/relex; install-scripts/install-ubuntu-relex.sh; ant build; ant install) | |
| 155 | ||
| 156 | # ------------------------------------------------------------- | |
| 157 | # Build the unit tests. This is .. optional, but we do it anyway, | |
| 158 | # for right now, just to sanity-check things. | |
| 159 | # WORKDIR /opencog/cogutil/build | |
| 160 | # RUN bash -l -c "make -j6 tests" | |
| 161 | # | |
| 162 | # WORKDIR /opencog/atomspace/build | |
| 163 | # RUN bash -l -c "make -j12 tests" | |
| 164 | # | |
| 165 | # WORKDIR /opencog/opencog/build | |
| 166 | # RUN bash -l -c "make -j12 tests" | |
| 167 | # | |
| 168 | COPY /scripts/.guile /root/ | |
| 169 | COPY /scripts/unit-test.sh /root/ | |
| 170 | COPY /scripts/tmux.sh /root/ | |
| 171 | ||
| 172 | # Pre-compile the guile modules. We could say `guild comple ...`, but | |
| 173 | # this is easier. This avoids fly compilation during container start. | |
| 174 | RUN (bash -l -c "echo \"(use-modules (opencog))\" | guile ; \ | |
| 175 | echo \"(use-modules (opencog atom-types))\" | guile ; \ | |
| 176 | echo \"(use-modules (opencog exec))\" | guile ; \ | |
| 177 | echo \"(use-modules (opencog logger))\" | guile ; \ | |
| 178 | echo \"(use-modules (opencog cogserver))\" | guile ; \ | |
| 179 | echo \"(use-modules (opencog persist))\" | guile ; \ | |
| 180 | echo \"(use-modules (opencog persist-cog))\" | guile ; \ | |
| 181 | echo \"(use-modules (opencog persist-rocks))\" | guile ; \ | |
| 182 | echo \"(use-modules (opencog query))\" | guile ; \ | |
| 183 | echo \"(use-modules (opencog unify))\" | guile ; \ | |
| 184 | echo \"(use-modules (opencog ure))\" | guile ; \ | |
| 185 | echo \"(use-modules (opencog spacetime))\" | guile ; \ | |
| 186 | echo \"(use-modules (opencog pln))\" | guile ; \ | |
| 187 | echo \"(use-modules (opencog nlp))\" | guile ; \ | |
| 188 | echo \"(use-modules (opencog nlp chatbot))\" | guile ; \ | |
| 189 | echo \"(use-modules (opencog nlp chatbot-eva))\" | guile ; \ | |
| 190 | echo \"(use-modules (opencog nlp fuzzy))\" | guile ; \ | |
| 191 | echo \"(use-modules (opencog nlp lg-dict))\" | guile ; \ | |
| 192 | echo \"(use-modules (opencog nlp microplanning))\" | guile ; \ | |
| 193 | echo \"(use-modules (opencog nlp relex2logic))\" | guile ; \ | |
| 194 | echo \"(use-modules (opencog nlp sureal))\" | guile ") | |
| 195 | ||
| 196 | WORKDIR /root | |
| 197 | #ENTRYPOINT bash -l -c "./unit-test.sh; bash" | |
| 198 | ENTRYPOINT bash -l -c "./tmux.sh; bash" | |
| 199 | #CMD /bin/bash |
| … | … | @@ -0,0 +1,36 @@ |
| 1 | ros-opencog | |
| 2 | ============ | |
| 3 | ||
| 4 | A docker image that installs both ROS and OpenCog. The image holds | |
| 5 | only the base packages needed for running OpenCog and ROS together; | |
| 6 | The CogServer is not started, no ROS nodes are started. | |
| 7 | ||
| 8 | ## Building | |
| 9 | ||
| 10 | Run the `build.sh` file in this directory. You need to have built | |
| 11 | the base ROS image (in the `../ros-base` directory) first. | |
| 12 | ||
| 13 | ## Testing | |
| 14 | To verify that OpenCog works, run the `run.sh` shell script. | |
| 15 | This will create a tmux (byobu) session inside the docker container. | |
| 16 | There are several things you can try: | |
| 17 | ||
| 18 | * Navigate to the build directories in `/opencog` and run the unit | |
| 19 | tests there. | |
| 20 | ||
| 21 | * Start `guile` at the prompt, and then try `(use-modules (opencog))` | |
| 22 | ||
| 23 | * Try starting the cogserver! At the guile prompt: | |
| 24 | ``` | |
| 25 | (use-modules (opencog) (opencog cogserver)) | |
| 26 | (start-cogserver) | |
| 27 | (Concept "foobar" (stv 0.5 0.8)) | |
| 28 | ``` | |
| 29 | Then from another tmux prompt: | |
| 30 | ``` | |
| 31 | telnet localhost 17001 | |
| 32 | (use-modules (opencog)) | |
| 33 | (cog-node 'ConceptNode "foobar") | |
| 34 | ``` | |
| 35 | The above should display `(ConceptNode "foobar" (stv 0.5 0.80000001))`. | |
| 36 | of course! |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for ros-opencog | |
| 4 | # | |
| 5 | docker build -t opencog/ros-noetic-opencog . |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | docker run --name="cog-ros" -it opencog/ros-noetic-opencog | |
| 8 | ||
| 9 | clear |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | ; | |
| 2 | ; .guile -- commands to execute on guile REPL startup. | |
| 3 | ; | |
| 4 | ;; rlb's method for activiting realine ... | |
| 5 | (use-modules (ice-9 readline)) | |
| 6 | (activate-readline) | |
| 7 | ||
| 8 | (debug-enable 'backtrace) | |
| 9 | ;; (debug-enable 'debug) | |
| 10 | ||
| 11 | ; Record positions of source code expressions. | |
| 12 | (read-enable 'positions) | |
| 13 | ||
| 14 | (add-to-load-path "/usr/local/share/opencog/scm") |
| … | … | @@ -0,0 +1,55 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # RelEx install script for Ubuntu/Debian systems | |
| 4 | # Tested on Ubuntu 12.04 LTS (Precise Pangolin) | |
| 5 | # Tested on Ubuntu 14.04 LTS (Trusty Tahr) | |
| 6 | # | |
| 7 | # Usage: | |
| 8 | # git clone https://github.com/opencog/relex | |
| 9 | # cd relex | |
| 10 | # install-scripts/install-ubuntu-dependencies.sh | |
| 11 | # (note: will ask for sudo password) | |
| 12 | # ant run | |
| 13 | # | |
| 14 | # Authors: David Hart, Cosmo Harrigan | |
| 15 | ||
| 16 | ## Ubuntu/Debian Packages | |
| 17 | sudo apt-get -y update | |
| 18 | sudo apt-get -y install build-essential python-dev swig zlib1g-dev unzip wget | |
| 19 | sudo apt-get -y install wordnet-dev wordnet-sense-index | |
| 20 | sudo apt-get -y install openjdk-9-jdk | |
| 21 | sudo apt-get -y install maven | |
| 22 | ||
| 23 | # Link Grammar | |
| 24 | wget -r --no-parent --no-check-certificate -nH --cut-dirs=3 http://www.abisource.com/downloads/link-grammar/current/ | |
| 25 | tar -xvf link-grammar-5.*.tar.gz | |
| 26 | rm link-grammar-5.*.tar.gz* | |
| 27 | rm -rf index.html* robots.txt | |
| 28 | pushd link-grammar-5.* | |
| 29 | JAVA_HOME=/usr/lib/jvm/java-9-openjdk-amd64 ./configure | |
| 30 | make -j6 | |
| 31 | sudo make install | |
| 32 | sudo ln -v -s /usr/local/lib/liblink-grammar.so.5 /usr/lib/liblink-grammar.so.5 | |
| 33 | popd | |
| 34 | sudo ldconfig | |
| 35 | ||
| 36 | MVN_USER=`whoami` | |
| 37 | LINKGRAMMAR_JAR=`find ./link-grammar* -name linkgrammar*.jar` | |
| 38 | LINKGRAMMAR_VERSION=`echo $LINKGRAMMAR_JAR | grep -oP '(?<=-)\d+\.\d+\.\d+(?=\.)'` | |
| 39 | ||
| 40 | if grep -q '^vagrant:' /etc/passwd; then | |
| 41 | cd /home/vagrant/relex | |
| 42 | MVN_USER=vagrant | |
| 43 | fi | |
| 44 | ||
| 45 | sudo -u $MVN_USER mvn install:install-file \ | |
| 46 | -DskipTests \ | |
| 47 | -Dfile=$LINKGRAMMAR_JAR \ | |
| 48 | -DgroupId=org.opencog \ | |
| 49 | -DartifactId=linkgrammar \ | |
| 50 | -Dversion=$LINKGRAMMAR_VERSION \ | |
| 51 | -Dpackaging=jar | |
| 52 | ||
| 53 | # RelEx | |
| 54 | sudo -u $MVN_USER mvn package -DskipTests | |
| 55 | sudo -u $MVN_USER mvn install -DskipTests |
| … | … | @@ -0,0 +1,20 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # tmux.sh | |
| 4 | # | |
| 5 | # Run some tmux (byobu) terminals. | |
| 6 | # | |
| 7 | # Use byobu so that the scroll bars actually work | |
| 8 | byobu new-session -d -n 'bash' '$SHELL' | |
| 9 | ||
| 10 | tmux new-window -n 'b2' '$SHELL' | |
| 11 | tmux new-window -n 'b3' '$SHELL' | |
| 12 | tmux new-window -n 'b4' '$SHELL' | |
| 13 | ||
| 14 | # Spare-usage shell | |
| 15 | tmux new-window -n 'bash' '$SHELL' | |
| 16 | ||
| 17 | # Fix the annoying byobu display | |
| 18 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 19 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 20 | tmux attach |
| … | … | @@ -0,0 +1,25 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # unit-test.sh | |
| 4 | # | |
| 5 | # Run the OpenCog unit tests on container startup. | |
| 6 | # Provide a spare teminal in the meanwhile. | |
| 7 | # | |
| 8 | echo "Will Run OpenCog unit tests..." | |
| 9 | ||
| 10 | # Use byobu so that the scroll bars actually work | |
| 11 | byobu new-session -d -n 'bash' '$SHELL' | |
| 12 | ||
| 13 | tmux new-window -n 'utils' 'cd /opencog/cogutil/build && make test; $SHELL' | |
| 14 | tmux new-window -n 'atoms' 'cd /opencog/atomspace/build && make test; $SHELL' | |
| 15 | tmux new-window -n 'servr' 'cd /opencog/opencog/build && make test; $SHELL' | |
| 16 | ||
| 17 | # Spare-usage shell | |
| 18 | tmux new-window -n 'bash' '$SHELL' | |
| 19 | ||
| 20 | # Fix the annoying byobu display | |
| 21 | echo "tmux_left=\"session\"" > $HOME/.byobu/status | |
| 22 | echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status | |
| 23 | tmux attach | |
| 24 | ||
| 25 | echo "Started" |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep cog-ros |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep cog-ros` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm cog-ros | |
| 14 | fi |
| … | … | @@ -0,0 +1,84 @@ |
| 1 | OpenCog Docker Containers | |
| 2 | ------------------------- | |
| 3 | This directory contains docker configurations for some of OpenCog's | |
| 4 | projects. Some of the notable images include: | |
| 5 | ||
| 6 | * `opencog/atomspace` -- Core AtomSpace only. | |
| 7 | * `opencog/atomspace-py` -- AtomSpace plus many Python tools. | |
| 8 | * `opencog/learn` -- Learning subsystem. | |
| 9 | * `opencog/lang-pairs` -- Tabulate and visualize word pairs from | |
| 10 | text corpora. | |
| 11 | ||
| 12 | Older, obsolete images can be found in the [archive](../archive) | |
| 13 | directory. If someone sent you here, and you can't find what you were | |
| 14 | told about, then it is probably in the archive. | |
| 15 | ||
| 16 | ## Docker setup | |
| 17 | 1. Install docker. On Debian/Ubuntu, `apt install docker.io`. Be sure to | |
| 18 | ad your userid to the `/etc/group` file, like so: | |
| 19 | `sudo usermod -aG docker $USER`. Log out and log back in, so that | |
| 20 | this new membership can become active. | |
| 21 | ||
| 22 | 2. Alternately, follow the | |
| 23 | [docker.com instructions](https://docs.docker.com/engine/installation/) | |
| 24 | for setting up docker. They will want you to create an account. But | |
| 25 | this is not needed. If you do create an account, be sure to say | |
| 26 | `sudo docker login` or | |
| 27 | ||
| 28 | 3. (Caution: dockerhub images appear to be out-of-date, and its not | |
| 29 | clear how to fix this. So please do NOT do this step.) | |
| 30 | Pull opencog images from dockerhub by running `./docker-build.sh -a` | |
| 31 | ||
| 32 | 4. The above pull should have downloaded the latest images. These | |
| 33 | are rebuilt weekly, and thus should be up-to-date, more or less. | |
| 34 | If not, and the absolute very latest is needed, then the docker | |
| 35 | images can be rebuilt. Use `./docker-build.sh -h` to get a list | |
| 36 | of available options. | |
| 37 | ||
| 38 | ## Overview | |
| 39 | List the current set of docker images with the command `docker images`. | |
| 40 | The most notable include: | |
| 41 | ||
| 42 | * `opencog/opencog-deps` -- A base operating system image, with | |
| 43 | most required dependencies installed. | |
| 44 | ||
| 45 | * `opencog/atomspace` -- An image containing the core AtomSpace. | |
| 46 | The AtomSpace is needed by all other subsystems. | |
| 47 | ||
| 48 | * `opencog/atomspace-py` -- The AtomSpace, plus a large collection of | |
| 49 | Python tools commonly used for machine learning and DL/NN work. | |
| 50 | ||
| 51 | * `opencog/learn` -- An image containing the language-learning | |
| 52 | subproject. | |
| 53 | ||
| 54 | The above three images "don't actually do anything"; they just provide | |
| 55 | baseline software installs. | |
| 56 | ||
| 57 | Actual demos, which "do actual stuff", are listed below. These need to | |
| 58 | be built individually; they cannot be downloaded pre-made. Go to the | |
| 59 | relevant directory, and follow the instructions there. | |
| 60 | ||
| 61 | * `opencog/lang-pairs` -- Word-pair counting and visualization. Demo | |
| 62 | of the very first step of the language-learning project. | |
| 63 | ||
| 64 | ## Docker Cheat Sheet | |
| 65 | * `docker images` | |
| 66 | * `docker rmi <image-hex>` | |
| 67 | * `docker ps -a` | |
| 68 | * `docker create --name foo -it opencog/atomspace` | |
| 69 | * `docker start -i <container-name>` | |
| 70 | * `docker stop <container-name>` | |
| 71 | * `docker rm <container-name>` | |
| 72 | * `docker container cp <some-file> <container>:<path> | |
| 73 | * `docker attach <container-name>` | |
| 74 | ||
| 75 | ## Notes | |
| 76 | 1. Both `tmux` and `byobu` are installed, so you can use either for | |
| 77 | multiple windows/panes. | |
| 78 | ||
| 79 | ## TODO | |
| 80 | 1. Add more images to github workflow for automated publishing | |
| 81 | ||
| 82 | ## Bonus | |
| 83 | There are some "bonus" containers, which might be useful: | |
| 84 | * `claude-code` -- Container with Anthropic's Claude Code installed. |
| … | … | @@ -0,0 +1,52 @@ |
| 1 | # | |
| 2 | # Container with AtomSpace plus extra python and node.js stuff. | |
| 3 | # | |
| 4 | # Usage: | |
| 5 | # 1. docker build -t opencog/atomspace-py . | |
| 6 | # 2. docker create --name atompy -it opencog/atomspace-py | |
| 7 | # 3. docker start -i atompy | |
| 8 | # | |
| 9 | # | |
| 10 | ARG OS_VERSION=latest | |
| 11 | ARG BASE_IMAGE=opencog/atomspace:${OS_VERSION} | |
| 12 | FROM ${BASE_IMAGE} | |
| 13 | ||
| 14 | # Install Debian-managed packages to get base python abilities. | |
| 15 | RUN apt-get -y update && apt-get -y upgrade && apt-get -y autoremove | |
| 16 | RUN apt-get -y install python3-pip python3-venv | |
| 17 | ||
| 18 | # Install Debian-managed packages to get base node.js abilities. | |
| 19 | RUN apt-get -y install npm | |
| 20 | ||
| 21 | # Everything else happens as the user. | |
| 22 | USER opencog | |
| 23 | WORKDIR /home/opencog | |
| 24 | ||
| 25 | # Set up NPM repos so that they install as the user. | |
| 26 | RUN mkdir -p ~/.npm-global | |
| 27 | RUN npm config set prefix ~/.npm-global | |
| 28 | RUN echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc | |
| 29 | ENV PATH=~/.npm-global/bin:$PATH | |
| 30 | ||
| 31 | # Create python gaol located at a popular location | |
| 32 | # Activate manually wih `source ~/.venv/bin/activate` | |
| 33 | RUN python3 -m venv .venv | |
| 34 | ||
| 35 | # Use uv as a replacement for pipx, poetry, pyenv, virtualenv, twine. | |
| 36 | RUN .venv/bin/pip install uv | |
| 37 | ||
| 38 | # Other misc stuff | |
| 39 | RUN .venv/bin/pip install requests websockets | |
| 40 | ||
| 41 | # Model Context Protocol MCP python sdk | |
| 42 | # This SDK is not available on older OS'es, so just || true so that | |
| 43 | # the Docker build does not fail. Of course, its a silent failure, but | |
| 44 | # who cares. No one will be using it. | |
| 45 | RUN .venv/bin/pip install mcp || true | |
| 46 | ||
| 47 | # Opencog installed itself here; we want it available in the venv. | |
| 48 | ENV PYTHONPATH=/usr/local/lib/python3.12/dist-packages:$PYTHONPATH | |
| 49 | ||
| 50 | CMD /bin/bash | |
| 51 | ||
| 52 | ONBUILD USER root |
| … | … | @@ -0,0 +1,76 @@ |
| 1 | # | |
| 2 | # Container with just the core AtomSpace framework installed. | |
| 3 | # This includes the cogserver, atomspce-rocks and atomspace-cog. | |
| 4 | # It does NOT include nlp, unify, ure, pln or opencog. | |
| 5 | # | |
| 6 | # Steps: | |
| 7 | # 1. docker build --no-cache -t opencog/atomspace . | |
| 8 | # 2. docker create --name atomspace -p 17001:17001 -p 18080:18080 | |
| 9 | # -v /ABSOLUTE/PATH/TO/YOUR/WORKING/DIRECTORY/On/Your/PC/:/opencog | |
| 10 | # -w /opencog | |
| 11 | # -it opencog/atomspace | |
| 12 | # 3. docker start -i atomspace | |
| 13 | # | |
| 14 | ||
| 15 | ARG OS_VERSION=latest | |
| 16 | ARG BASE_IMAGE=opencog/opencog-deps:${OS_VERSION} | |
| 17 | FROM ${BASE_IMAGE} | |
| 18 | ||
| 19 | # The apt installs below will fail, unless we are at the latest. | |
| 20 | # Bump the date, if there are DNS failures! | |
| 21 | ENV LAST_APT_UPDATE=2025-08-08 | |
| 22 | RUN apt-get -y update; apt-get -y upgrade; apt-get -y autoremove | |
| 23 | ||
| 24 | # Basic tools that allow this image to be minimally usable. | |
| 25 | # * Networking tools (ping, ifconfig, telnet, netcat) | |
| 26 | # * Terminal sharing tools (tmux, byobu) | |
| 27 | # * Debug tools (gdb, xxd, jq) | |
| 28 | # * Webserver (apache2, php) | |
| 29 | # | |
| 30 | # Oddly, the xxd package is sometimes missing; use --ignore-missing. | |
| 31 | # The || true is needed to prevent docker from dying when xxd is not | |
| 32 | # found. | |
| 33 | RUN apt-get -y --ignore-missing install \ | |
| 34 | lsof \ | |
| 35 | net-tools iputils-ping netcat-openbsd traceroute iptraf \ | |
| 36 | rlwrap telnet \ | |
| 37 | tmux byobu \ | |
| 38 | gdb time xxd jq \ | |
| 39 | apache2 php \ | |
| 40 | || true | |
| 41 | ||
| 42 | # Install cogutil | |
| 43 | ENV LAST_COGUTIL_UPDATE=2025-12-10 | |
| 44 | RUN /tmp/octool -c && ccache -C | |
| 45 | ||
| 46 | # Install core AtomSpace. | |
| 47 | ENV LAST_ATOMSPACE_UPDATE=2025-11-20 | |
| 48 | RUN /tmp/octool -a && ccache -C | |
| 49 | ||
| 50 | USER opencog | |
| 51 | WORKDIR /home/opencog | |
| 52 | ||
| 53 | # Setup the workspace for developers | |
| 54 | COPY /scripts/ /home/opencog | |
| 55 | RUN sudo chown -R opencog:opencog . | |
| 56 | RUN sudo chown -R opencog:opencog .[a-z]* | |
| 57 | ||
| 58 | # XXX FIXME - despite efforts, the timestamp on | |
| 59 | # /usr/local/lib/guile/3.0/site-ccache/opencog.go | |
| 60 | # is older than that on | |
| 61 | # /usr/local/share/guile/site/3.0/opencog.scm | |
| 62 | # So hack around this by forcing a compile. | |
| 63 | RUN guile -c "(use-modules (opencog) (opencog exec) (opencog cogserver) (opencog persist) (opencog persist-cog) (opencog persist-rocks))" | |
| 64 | ||
| 65 | # RUN guile -c "(use-modules (opencog persist-pgres))" | |
| 66 | ||
| 67 | # Docker EXPOSE says "we listen on these ports". Which is not quite | |
| 68 | # true, because the default cogserver publishes on these ports. But | |
| 69 | # it is considered to be "best practices" to announce this to the world. | |
| 70 | EXPOSE 17001 | |
| 71 | EXPOSE 18080 | |
| 72 | EXPOSE 18888 | |
| 73 | ||
| 74 | CMD /bin/bash | |
| 75 | ||
| 76 | ONBUILD USER root |
| … | … | @@ -0,0 +1,42 @@ |
| 1 | Base AtomSpace container | |
| 2 | ------------------------ | |
| 3 | ||
| 4 | The container here includes a copy of the core AtomSpace framework, | |
| 5 | including the AtomSpace, the CogServer, the RocksStorageNode and the | |
| 6 | CogStorageNode. It does *not* include nlp, unify, ure or pln. | |
| 7 | ||
| 8 | ## Building | |
| 9 | ||
| 10 | The container is built by the script in the directory below: | |
| 11 | `../docker-build.sh -s`. | |
| 12 | ||
| 13 | ## Testing | |
| 14 | Optional. To verify that the core AtomSpace is working: | |
| 15 | ||
| 16 | * Run the container with `./run.sh`. This will put you into a prompt | |
| 17 | in the container. | |
| 18 | ||
| 19 | * Start `guile` at the bash prompt, and say | |
| 20 | ``` | |
| 21 | (use-modules (opencog)) | |
| 22 | (Concept "foobar" (stv 0.5 0.8)) | |
| 23 | ``` | |
| 24 | ||
| 25 | * The CogServer can be started also. To verify this, start either | |
| 26 | byobu or tmux, and open a few terminal shells (F2 on byobu, or | |
| 27 | `ctrl-b c` on tmux.) Then, in one of the panels, start guile | |
| 28 | and say | |
| 29 | ``` | |
| 30 | (use-modules (opencog) (opencog cogserver)) | |
| 31 | (start-cogserver) | |
| 32 | (Concept "foobar" (stv 0.5 0.8)) | |
| 33 | ``` | |
| 34 | Then toggle to another byobu/tmux panel (F3/F4 to move left/right | |
| 35 | in byobu, or `ctrl-b p`/`ctrl-b n` to move left/right in tmux) | |
| 36 | ``` | |
| 37 | rlwrap telnet localhost 17001 | |
| 38 | scm | |
| 39 | (cog-node 'ConceptNode "foobar") | |
| 40 | ``` | |
| 41 | The above should display `(ConceptNode "foobar" (stv 0.5 0.8))`. | |
| 42 | Of course! |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. | |
| 4 | # | |
| 5 | # ./stop.sh | |
| 6 | ||
| 7 | docker run --name="base-atomspace" -it opencog/atomspace | |
| 8 | ||
| 9 | # clear |
| … | … | @@ -0,0 +1 @@ |
| 1 | BYOBU_BACKEND=tmux |
| … | … | @@ -0,0 +1,3 @@ |
| 1 | BACKGROUND=k | |
| 2 | FOREGROUND=w | |
| 3 | MONOCHROME=0 |
| … | … | @@ -0,0 +1,4 @@ |
| 1 | BYOBU_DARK="\#333333" | |
| 2 | BYOBU_LIGHT="\#EEEEEE" | |
| 3 | BYOBU_ACCENT="\#75507B" | |
| 4 | BYOBU_HIGHLIGHT="\#DD4814" |
| … | … | @@ -0,0 +1,2 @@ |
| 1 | # BYOBU_DATE="%Y-%m-%d " | |
| 2 | # BYOBU_TIME="%H:%M:%S" |
| … | … | @@ -0,0 +1 @@ |
| 1 | source $BYOBU_PREFIX/share/byobu/keybindings/common |
| … | … | @@ -0,0 +1,4 @@ |
| 1 | unbind-key -n C-a | |
| 2 | set -g prefix ^A | |
| 3 | set -g prefix2 ^A | |
| 4 | bind a send-prefix |
| … | … | @@ -0,0 +1 @@ |
| 1 | source $BYOBU_PREFIX/share/byobu/profiles/common |
| … | … | @@ -0,0 +1 @@ |
| 1 | source $BYOBU_PREFIX/share/byobu/profiles/tmux |
| … | … | @@ -0,0 +1 @@ |
| 1 | [ -r /usr/share/byobu/profiles/bashrc ] && . /usr/share/byobu/profiles/bashrc #byobu-prompt# |
| … | … | @@ -0,0 +1,41 @@ |
| 1 | # status - Byobu's default status enabled/disabled settings | |
| 2 | # | |
| 3 | # Override these in $BYOBU_CONFIG_DIR/status | |
| 4 | # where BYOBU_CONFIG_DIR is XDG_CONFIG_HOME if defined, | |
| 5 | # and $HOME/.byobu otherwise. | |
| 6 | # | |
| 7 | # Copyright (C) 2009-2011 Canonical Ltd. | |
| 8 | # | |
| 9 | # Authors: Dustin Kirkland <kirkland@byobu.org> | |
| 10 | # | |
| 11 | # This program is free software: you can redistribute it and/or modify | |
| 12 | # it under the terms of the GNU General Public License as published by | |
| 13 | # the Free Software Foundation, version 3 of the License. | |
| 14 | # | |
| 15 | # This program is distributed in the hope that it will be useful, | |
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | # GNU General Public License for more details. | |
| 19 | # | |
| 20 | # You should have received a copy of the GNU General Public License | |
| 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 22 | ||
| 23 | # Status beginning with '#' are disabled. | |
| 24 | ||
| 25 | # Screen has two status lines, with 4 quadrants for status | |
| 26 | screen_upper_left="color" | |
| 27 | screen_upper_right="color whoami hostname ip_address menu" | |
| 28 | screen_lower_left="color logo distro release #arch session" | |
| 29 | screen_lower_right="color network #disk_io custom #entropy raid reboot_required updates_available #apport #services #mail users uptime #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap disk #time_utc date time" | |
| 30 | ||
| 31 | tmux_right="load_average disk_io date time" | |
| 32 | tmux_left="session" | |
| 33 | ||
| 34 | ||
| 35 | # Tmux has one status line, with 2 halves for status | |
| 36 | # tmux_left="logo #distro release #arch session" | |
| 37 | # You can have as many tmux right lines below here, and cycle through them using Shift-F5 | |
| 38 | # tmux_right="#network #disk_io #custom #entropy raid reboot_required updates_available #apport #services #mail #users uptime #fan_speed #cpu_temp #battery #wifi_quality #processes load_average cpu_count cpu_freq memory #swap disk #whoami #hostname #ip_address #time_utc date time" | |
| 39 | #tmux_right="network #disk_io #custom entropy raid reboot_required updates_available #apport #services #mail users uptime fan_speed cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk whoami hostname ip_address #time_utc date time" | |
| 40 | #tmux_right="network #disk_io custom #entropy raid reboot_required updates_available #apport #services #mail users uptime #fan_speed #cpu_temp battery wifi_quality #processes load_average cpu_count cpu_freq memory #swap #disk #whoami #hostname ip_address #time_utc date time" | |
| 41 | #tmux_right="#network disk_io #custom entropy #raid #reboot_required #updates_available #apport #services #mail #users #uptime fan_speed cpu_temp #battery #wifi_quality #processes #load_average #cpu_count #cpu_freq #memory #swap whoami hostname ip_address #time_utc disk date time" |
| … | … | @@ -0,0 +1,78 @@ |
| 1 | # statusrc - Byobu's default status configurations | |
| 2 | # | |
| 3 | # Override these in $BYOBU_CONFIG_DIR/statusrc | |
| 4 | # where BYOBU_CONFIG_DIR is XDG_CONFIG_HOME if defined, | |
| 5 | # and $HOME/.byobu otherwise. | |
| 6 | # | |
| 7 | # Copyright (C) 2009-2011 Canonical Ltd. | |
| 8 | # | |
| 9 | # Authors: Dustin Kirkland <kirkland@byobu.org> | |
| 10 | # | |
| 11 | # This program is free software: you can redistribute it and/or modify | |
| 12 | # it under the terms of the GNU General Public License as published by | |
| 13 | # the Free Software Foundation, version 3 of the License. | |
| 14 | # | |
| 15 | # This program is distributed in the hope that it will be useful, | |
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | # GNU General Public License for more details. | |
| 19 | # | |
| 20 | # You should have received a copy of the GNU General Public License | |
| 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 22 | ||
| 23 | # Configurations that you can override; if you leave these commented out, | |
| 24 | # Byobu will try to auto-detect them. | |
| 25 | ||
| 26 | # This should be auto-detected for most distro, but setting it here will save | |
| 27 | # some call to lsb_release and the like. | |
| 28 | #BYOBU_DISTRO=Ubuntu | |
| 29 | ||
| 30 | # Default: depends on the distro (which is either auto-detected, either set | |
| 31 | # via $DISTRO) | |
| 32 | #LOGO="\o/" | |
| 33 | ||
| 34 | # Abbreviate the release to N characters | |
| 35 | # By default, this is disabled. But if you set RELEASE_ABBREVIATED=1 | |
| 36 | # and your lsb_release is "precise", only "p" will be displayed | |
| 37 | #RELEASE_ABBREVIATED=1 | |
| 38 | ||
| 39 | # Default: / | |
| 40 | #MONITORED_DISK=/ | |
| 41 | ||
| 42 | # Minimum disk throughput that triggers the notification (in kB/s) | |
| 43 | # Default: 50 | |
| 44 | #DISK_IO_THRESHOLD=50 | |
| 45 | ||
| 46 | # Default: eth0 | |
| 47 | #MONITORED_NETWORK=eth0 | |
| 48 | ||
| 49 | # Unit used for network throughput (either bits per second or bytes per second) | |
| 50 | # Default: bits | |
| 51 | #NETWORK_UNITS=bytes | |
| 52 | ||
| 53 | # Minimum network throughput that triggers the notification (in kbit/s) | |
| 54 | # Default: 20 | |
| 55 | #NETWORK_THRESHOLD=20 | |
| 56 | ||
| 57 | # You can add an additional source of temperature here | |
| 58 | #MONITORED_TEMP=/proc/acpi/thermal_zone/THM0/temperature | |
| 59 | ||
| 60 | # Default: C | |
| 61 | #TEMP=F | |
| 62 | ||
| 63 | #SERVICES="eucalyptus-nc|NC eucalyptus-cloud|CLC eucalyptus-walrus eucalyptus-cc|CC eucalyptus-sc|SC" | |
| 64 | ||
| 65 | #FAN=$(find /sys -type f -name fan1_input | head -n1) | |
| 66 | ||
| 67 | # You can set this to 1 to report your external/public ip address | |
| 68 | # Default: 0 | |
| 69 | #IP_EXTERNAL=0 | |
| 70 | ||
| 71 | # The users notification normally counts ssh sessions; set this configuration to '1' | |
| 72 | # to instead count number of distinct users logged onto the system | |
| 73 | # Default: 0 | |
| 74 | #USERS_DISTINCT=0 | |
| 75 | ||
| 76 | # Set this to zero to hide seconds int the time display | |
| 77 | # Default 1 | |
| 78 | #TIME_SECONDS=0 |
| … | … | @@ -0,0 +1,21 @@ |
| 1 | " Either 'wrapmargin' is in effect or 'textwidth' but not both. | |
| 2 | " Lets try living with 'textwidth' and see what that's like. March 2021 | |
| 3 | " hmm | |
| 4 | set wrapmargin=8 | |
| 5 | " set textwidth=80 | |
| 6 | set ts=3 | |
| 7 | set showmode | |
| 8 | set noautoindent | |
| 9 | set encoding=utf-8 | |
| 10 | ||
| 11 | " Only do this part when compiled with support for autocommands. | |
| 12 | if has("autocmd") | |
| 13 | " When editing a file, always jump to the last known cursor position. | |
| 14 | " Don't do it when the position is invalid or when inside an event handler | |
| 15 | " (happens when dropping a file on gvim). | |
| 16 | autocmd BufReadPost * | |
| 17 | \ if line("'\"") > 0 && line("'\"") <= line("$") | | |
| 18 | \ exe "normal g`\"" | | |
| 19 | \ endif | |
| 20 | ||
| 21 | endif " has("autocmd") |
| … | … | @@ -0,0 +1,75 @@ |
| 1 | #! /usr/bin/env -S guile -l ./cogserver.scm -- | |
| 2 | !# | |
| 3 | ; | |
| 4 | ; cogserver.scm | |
| 5 | ; | |
| 6 | ; Load assorted modules and start the cogserver. Start this by saying | |
| 7 | ; `./cogserver.scm` at the shell prompt. It will start the cogserver, | |
| 8 | ; and place you at a guile scheme prompt. The cogserver will stop when | |
| 9 | ; you exit. | |
| 10 | ; | |
| 11 | ; This file is here as an example! Edit this as you wish, and add | |
| 12 | ; whatever modules or configuration that you want. | |
| 13 | ; | |
| 14 | ; Configurable parameters are pulled from the shell environment. | |
| 15 | ; | |
| 16 | (use-modules (system repl common)) | |
| 17 | (use-modules (opencog) (opencog logger)) | |
| 18 | (use-modules (opencog persist)) | |
| 19 | (use-modules (opencog cogserver)) | |
| 20 | (use-modules (srfi srfi-1)) | |
| 21 | ||
| 22 | ; Try fishing a prompt string from the shell environment. | |
| 23 | (define env-prompt (getenv "PROMPT")) | |
| 24 | (when (not env-prompt) | |
| 25 | (set! env-prompt "scheme@atomspace")) | |
| 26 | ||
| 27 | ; Prompt magic, copied from `module/system/repl/common.scm` | |
| 28 | ; This makes the scheme shell prompt work correctly, even when | |
| 29 | ; exceptions are caught. | |
| 30 | (define (cog-prompt) | |
| 31 | (let ((level (length (cond | |
| 32 | ((fluid-ref *repl-stack*) => cdr) | |
| 33 | (else '()))))) | |
| 34 | (if (zero? level) | |
| 35 | (string-append env-prompt "> ") | |
| 36 | (format #f "~A [~A]> " env-prompt level)))) | |
| 37 | ||
| 38 | (repl-default-prompt-set! cog-prompt) | |
| 39 | ||
| 40 | ; Some additional environment-variable stuffs. | |
| 41 | (define env-port (getenv "PORT")) | |
| 42 | (if (not env-port) | |
| 43 | (set! env-port 17001) | |
| 44 | (set! env-port(string->number env-port))) | |
| 45 | ||
| 46 | (define env-web-port (getenv "WEB_PORT")) | |
| 47 | (if (not env-web-port) | |
| 48 | (set! env-web-port 18080) | |
| 49 | (set! env-web-port(string->number env-web-port))) | |
| 50 | ||
| 51 | (define env-srv-prompt (getenv "OCPROMPT")) | |
| 52 | (when (not env-srv-prompt) | |
| 53 | (set! env-srv-prompt "cogserver> ")) | |
| 54 | ||
| 55 | (define env-logfile (getenv "LOGFILE")) | |
| 56 | (when (not env-logfile) | |
| 57 | (set! env-logfile "/tmp/cogserver.log")) | |
| 58 | ||
| 59 | ; Start the cogserver using the configured parameters. | |
| 60 | ; Start the cogserver *after* opening the DB and setting frames. | |
| 61 | ; That way, any remote procs waiting on the socket don't start | |
| 62 | ; sending data until *after* the DB is opened. | |
| 63 | (start-cogserver | |
| 64 | #:port env-port | |
| 65 | #:scmprompt (string-append env-prompt "> ") | |
| 66 | #:prompt env-srv-prompt | |
| 67 | #:logfile env-logfile | |
| 68 | #:web env-web-port | |
| 69 | ;;; #:web 0 ;; Uncommenting this will disable the websocket port. | |
| 70 | ; Random websites will try to talk to the websockets port, so it | |
| 71 | ; should be disabled, if you're not using it. I don't know why it | |
| 72 | ; is being targeted. | |
| 73 | ) | |
| 74 | ||
| 75 | ; ----------------------------------------------------------- |
| … | … | @@ -0,0 +1,83 @@ |
| 1 | # | |
| 2 | # Images with all the dependencies for development installed. | |
| 3 | # | |
| 4 | # Steps to build & run: | |
| 5 | # 1. docker build --no-cache -t opencog/opencog-deps . | |
| 6 | # 2. docker run --rm -it opencog/opencog-deps | |
| 7 | ||
| 8 | # Default to Ubuntu 24.04 LTS (Noble Numbat) | |
| 9 | ARG BASE_OS=ubuntu:24.04 | |
| 10 | FROM ${BASE_OS} | |
| 11 | ||
| 12 | ENV DEBIAN_FRONTEND=noninteractive | |
| 13 | ||
| 14 | # Bump this date, in order to force the apt-update to run again. | |
| 15 | # Otherwise, it will use the cached Docker container, which might | |
| 16 | # be stale or be missing security updates. | |
| 17 | ENV LAST_OS_UPDATE=2025-12-16 | |
| 18 | RUN apt-get update && apt-get -y upgrade | |
| 19 | ||
| 20 | # Install apt utilities | |
| 21 | RUN apt-get -y install apt-transport-https sudo wget tzdata apt-utils | |
| 22 | ||
| 23 | # Debian does not have software-properties-common; this is an ubuntu pkg | |
| 24 | RUN apt-get -y --ignore-missing install software-properties-common || true | |
| 25 | ||
| 26 | # This container is used by circle-ci unit tests, and they seem to | |
| 27 | # be happier when ssh is installed. Seems this is NOT installed by | |
| 28 | # ocpkg, so we do it here. | |
| 29 | RUN apt-get -y install openssh-client | |
| 30 | ||
| 31 | # Install ocpkg. Bump the date to get the latest ocpkg installed; | |
| 32 | # Otherwise, this docker build will be cached with an old octool. | |
| 33 | # And with the old versions of those packages that octool installs. | |
| 34 | ENV LAST_OCPKG_UPDATE=2025-12-16 | |
| 35 | ||
| 36 | # The OCPKG_URL can be overridden by specifying | |
| 37 | # docker build --build-arg OCPKG_URL=https://some.where.else.com/ockpg | |
| 38 | ARG GITHUB_NAME="opencog" | |
| 39 | ENV GITHUB_NAME=${GITHUB_NAME} | |
| 40 | ARG OCPKG_URL=https://raw.githubusercontent.com/${GITHUB_NAME}/ocpkg/master/ocpkg | |
| 41 | RUN echo OCPKG_URL=$OCPKG_URL | |
| 42 | ADD $OCPKG_URL /tmp/octool | |
| 43 | RUN chmod 755 /tmp/octool; sync; | |
| 44 | ||
| 45 | # octool -r Add software repositories | |
| 46 | # -d Install base/system build dependencies | |
| 47 | # -v Verbose output for 'apt-get' commands | |
| 48 | RUN /tmp/octool -rdv | |
| 49 | ||
| 50 | # Environment Variables | |
| 51 | ENV PATH=/usr/lib/ccache:$PATH | |
| 52 | ||
| 53 | ## Set Locale -- Link Grammar expects this. | |
| 54 | RUN locale-gen en_US.UTF-8 | |
| 55 | ENV LANG=en_US.UTF-8 | |
| 56 | ENV LANGUAGE=en_US:en | |
| 57 | ENV LC_ALL=en_US.UTF-8 | |
| 58 | ||
| 59 | # octool -l -- Install Link Grammar release tarball | |
| 60 | # This is required for circleci-testing of the atomspace. | |
| 61 | # The build of lg-atomese breaks without this. | |
| 62 | ENV LAST_LG_UPDATE=2025-10-28 | |
| 63 | RUN /tmp/octool -v -l default | |
| 64 | ||
| 65 | # TODO: Remove this user and replace with usage of `-u` flag during runtime. | |
| 66 | # Create and switch user. The user is privileged with no password required | |
| 67 | RUN adduser --disabled-password --gecos "OpenCog Developer" opencog | |
| 68 | RUN adduser opencog sudo | |
| 69 | RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
| 70 | ||
| 71 | # video provides access to any GPU's on this device. | |
| 72 | RUN usermod -a -G video opencog | |
| 73 | USER opencog | |
| 74 | WORKDIR /home/opencog | |
| 75 | ||
| 76 | # Setup config files | |
| 77 | ## Don't mount host volumes to opencog's home directory inside the | |
| 78 | ## container, if you do you will not find the contents copied below | |
| 79 | COPY /scripts/ /home/opencog | |
| 80 | RUN sudo chown -R opencog:opencog .guile .gdbinit | |
| 81 | ||
| 82 | # For images built on this | |
| 83 | ONBUILD USER root |
| … | … | @@ -0,0 +1,99 @@ |
| 1 | # For more see http://wiki.opencog.org/w/Development_standards#GDB | |
| 2 | ||
| 3 | # ---------------------------------------------------------------------------- | |
| 4 | # Guile garbage collection uses these, ignore them. | |
| 5 | # ---------------------------------------------------------------------------- | |
| 6 | handle SIGPWR noprint nostop | |
| 7 | handle SIGXCPU noprint nostop | |
| 8 | set print thread-events off | |
| 9 | ||
| 10 | # ---------------------------------------------------------------------------- | |
| 11 | # Print OpenCog Objects | |
| 12 | # ---------------------------------------------------------------------------- | |
| 13 | set overload-resolution on | |
| 14 | ||
| 15 | define poc | |
| 16 | if $argc == 0 | |
| 17 | help patom | |
| 18 | else | |
| 19 | whatis $arg0 | |
| 20 | printf "%s", opencog::oc_to_string($arg0)._M_dataplus._M_p | |
| 21 | end | |
| 22 | end | |
| 23 | ||
| 24 | document poc | |
| 25 | Prints opencog object information. | |
| 26 | Syntax: poc <opencog object> | |
| 27 | Example: | |
| 28 | poc h - Prints the hypergraph corresponding to h | |
| 29 | end | |
| 30 | ||
| 31 | # ---------------------------------------------------------------------------- | |
| 32 | # Print opencog::AtomSpace | |
| 33 | # ---------------------------------------------------------------------------- | |
| 34 | define patomspace | |
| 35 | if $argc == 0 | |
| 36 | help patomspace | |
| 37 | else | |
| 38 | printf "%s", $arg0.to_string()._M_dataplus._M_p | |
| 39 | end | |
| 40 | end | |
| 41 | ||
| 42 | document patomspace | |
| 43 | Prints opencog::AtomSpace information. | |
| 44 | Syntax: patomspace <atomspace> | |
| 45 | Example: | |
| 46 | patomspace as - Prints the whole atomspace as | |
| 47 | end | |
| 48 | ||
| 49 | # ---------------------------------------------------------------------------- | |
| 50 | # For debugging python | |
| 51 | # See https://wiki.python.org/moin/DebuggingWithGdb | |
| 52 | # As of December 2021, this still runs on python2.7 and not python3 | |
| 53 | # ---------------------------------------------------------------------------- | |
| 54 | add-auto-load-safe-path /usr/lib/debug/usr/bin/python2.7-gdb.py | |
| 55 | ||
| 56 | # print python frame | |
| 57 | define pyf | |
| 58 | if $rip >= &PyEval_EvalFrameEx | |
| 59 | if $rip < &PyEval_EvalCodeEx | |
| 60 | x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval | |
| 61 | x/s ((PyStringObject*)f->f_code->co_name)->ob_sval | |
| 62 | echo py line # | |
| 63 | p f->f_lineno | |
| 64 | end | |
| 65 | end | |
| 66 | end | |
| 67 | document pyf | |
| 68 | show python stack frame | |
| 69 | end | |
| 70 | ||
| 71 | # print python backtrace | |
| 72 | define pbt | |
| 73 | set $i = 0 | |
| 74 | set $j = 0 | |
| 75 | set $prev = 0 | |
| 76 | while $i < 105 | |
| 77 | select $i | |
| 78 | if $rip >= &PyEval_EvalFrameEx | |
| 79 | if $rip < &PyEval_EvalCodeEx | |
| 80 | if $prev !=f | |
| 81 | echo c frame # | |
| 82 | p $i | |
| 83 | echo py frame # | |
| 84 | p $j | |
| 85 | set $j = $j+1 | |
| 86 | x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval | |
| 87 | x/s ((PyStringObject*)f->f_code->co_name)->ob_sval | |
| 88 | echo line # | |
| 89 | p f->f_lineno | |
| 90 | $prev = f | |
| 91 | end | |
| 92 | end | |
| 93 | end | |
| 94 | set $i = $i+1 | |
| 95 | end | |
| 96 | end | |
| 97 | document pbt | |
| 98 | show python backtrace | |
| 99 | end |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | ; To make working with arrow keys easier | |
| 2 | (use-modules (ice-9 readline)) | |
| 3 | (activate-readline) | |
| 4 | ||
| 5 | ; Enable showing of backtrace on error | |
| 6 | (debug-enable 'backtrace) | |
| 7 | ||
| 8 | ; Record positions of source code expressions. | |
| 9 | (read-enable 'positions) |
| … | … | @@ -0,0 +1,23 @@ |
| 1 | # | |
| 2 | # Container with AtomSpace plus Anthropic Claude Code | |
| 3 | # | |
| 4 | # Usage: | |
| 5 | # 1. docker build -t opencog/claude-code . | |
| 6 | # 2. docker create --name aclaw -it opencog/claude-code | |
| 7 | # 3. docker start -i aclaw | |
| 8 | # | |
| 9 | FROM opencog/atomspace-py:latest | |
| 10 | ||
| 11 | # Everything else happens as the user. | |
| 12 | USER opencog | |
| 13 | WORKDIR /home/opencog | |
| 14 | ||
| 15 | # Install Anthropic Claude Code | |
| 16 | RUN npm install -g @anthropic-ai/claude-code | |
| 17 | ||
| 18 | # The OAuth token needs to be refreshed from time to time. | |
| 19 | RUN curl -O https://raw.githubusercontent.com/RavenStorm-bit/claude-token-refresh/main/claude_token_refresh.py && chmod +x claude_token_refresh.py | |
| 20 | ||
| 21 | CMD /bin/bash | |
| 22 | ||
| 23 | ONBUILD USER root |
| … | … | @@ -0,0 +1,211 @@ |
| 1 | #!/bin/bash | |
| 2 | # | |
| 3 | # Notes: | |
| 4 | # 1. Builds all the images for development. You can also pull the | |
| 5 | # images from docker registry, but they are a bit bulky. | |
| 6 | # 2. If your user is not a member of the docker group you can add it | |
| 7 | # by running `sudo adduser $USER docker`. Log out and log back in | |
| 8 | # to get this change. After this is done, you will be able to run | |
| 9 | # this script without root privilege. | |
| 10 | # 3. If run without `-u` option, images will not be rebuilt, unless | |
| 11 | # the base ubuntu image is updated. | |
| 12 | ||
| 13 | # Exit on error | |
| 14 | set -e | |
| 15 | ||
| 16 | # Environment Variables | |
| 17 | ## Use cache by default unless the -u options is passed | |
| 18 | CACHE_OPTION="" | |
| 19 | ||
| 20 | ## This file/symlinks name | |
| 21 | SELF_NAME=$(basename $0) | |
| 22 | DIR_NAME=$(dirname $0) | |
| 23 | ||
| 24 | # ----------------------------------------------------------------------------- | |
| 25 | # Main Execution | |
| 26 | if [ $# -eq 0 ]; then NO_ARGS=true; fi | |
| 27 | ||
| 28 | while getopts "abcehjlmprstu" flag; do | |
| 29 | case $flag in | |
| 30 | a) PULL_DEV_IMAGES=true ;; | |
| 31 | b) BUILD_OPENCOG_BASE_IMAGE=true ;; | |
| 32 | l) BUILD_LEARN_IMAGE=true ;; | |
| 33 | p) BUILD_ATOMSPACE_PYTHON_IMAGE=true ;; | |
| 34 | s) BUILD_ATOMSPACE_IMAGE=true ;; | |
| 35 | u) CACHE_OPTION=--no-cache ;; | |
| 36 | h) SHOW_USAGE=true ;; | |
| 37 | \?) | |
| 38 | SHOW_USAGE=true | |
| 39 | # exit 1 | |
| 40 | ;; | |
| 41 | *) UNKNOWN_FLAGS=true ;; | |
| 42 | esac | |
| 43 | done | |
| 44 | ||
| 45 | shift "$(($OPTIND - 1))" | |
| 46 | ||
| 47 | BASE_OS=$1 | |
| 48 | if [[ -z $BASE_OS ]]; then | |
| 49 | # Default to Ubuntu 24.04 LTS (Noble Numbat) | |
| 50 | # BASE_OS=ubuntu:20.04 # Focal Fossa | |
| 51 | # BASE_OS=ubuntu:22.04 # Jammy Jellyfish | |
| 52 | BASE_OS=ubuntu:24.04 # Noble Numbat | |
| 53 | # BASE_OS=ubuntu:25.10 # Questing Quokka | |
| 54 | # BASE_OS=debian:bookworm # June 2023 | |
| 55 | # BASE_OS=debian:trixie # August 2025 | |
| 56 | fi | |
| 57 | BASE_OS=${BASE_OS//-/:} # Convert dashes to colons | |
| 58 | OS_VERSION=${BASE_OS//:/-} # Convert colons to dashes | |
| 59 | ||
| 60 | if [[ -z $1 ]]; then # If net specified, its "latest" | |
| 61 | OS_VERSION=latest # For dockerhub.io downloads | |
| 62 | fi | |
| 63 | ||
| 64 | DOCKER_NAME=$2 | |
| 65 | if [[ -z $DOCKER_NAME ]]; then | |
| 66 | DOCKER_NAME="opencog" | |
| 67 | fi | |
| 68 | GITHUB_NAME=$3 | |
| 69 | if [[ -z $GITHUB_NAME ]]; then | |
| 70 | GITHUB_NAME="opencog" | |
| 71 | fi | |
| 72 | ||
| 73 | # Functions | |
| 74 | usage() { | |
| 75 | printf "Usage: ./%s [OPTIONS] [BASE_OS] [DOCKER_NAME] [GITHUB_NAME] | |
| 76 | ||
| 77 | OPTIONS: | |
| 78 | -a Pull the 'latest' images from hub.docker.com/u/${DOCKER_NAME}/ | |
| 79 | These are currently based on ${BASE_OS} | |
| 80 | -b Build the ${DOCKER_NAME}/opencog-deps image. Provides all | |
| 81 | dependencies and development tools used by ${DOCKER_NAME}. | |
| 82 | -s Build the ${DOCKER_NAME}/atomspace image. Builds all core | |
| 83 | AtomSpace packages. | |
| 84 | -p Build the ${DOCKER_NAME}/atomspace-py image. Installs | |
| 85 | additional node.js and Python packages commonly | |
| 86 | used in machine learning and DL/NN. | |
| 87 | -l Build the ${DOCKER_NAME}/learn image. | |
| 88 | ||
| 89 | -u Ignore the docker image cache when building. This will | |
| 90 | cause the container(s) to be built from scratch. | |
| 91 | -h This help message. | |
| 92 | ||
| 93 | BASE_OS: The following have been recently tested: | |
| 94 | ubuntu:20.04 # aka Focal Fossa | |
| 95 | ubuntu:22.04 # aka Jammy Jellyfish | |
| 96 | ubuntu:24.04 # aka Noble Numbat | |
| 97 | ubuntu:25.10 # aka Questing Quokka | |
| 98 | debian:bookworm # Released June 2023 | |
| 99 | debian:trixie # Released August 2025 | |
| 100 | latest (or unspecified/blank) defaults to ${BASE_OS} | |
| 101 | ||
| 102 | Since gcc-11 or later is needed, debian:bullseye (Aug 2021) won't work. | |
| 103 | ||
| 104 | DOCKER_NAME: The Docker account to use (default 'opencog'). | |
| 105 | GITHUB_NAME: The GitHub account to use (default 'opencog') \n" "$SELF_NAME" | |
| 106 | } | |
| 107 | ||
| 108 | if [ $SHOW_USAGE ]; then | |
| 109 | usage | |
| 110 | exit 0 | |
| 111 | fi | |
| 112 | ||
| 113 | # ----------------------------------------------------------------------------- | |
| 114 | # Sanity check | |
| 115 | ||
| 116 | if [ $UNKNOWN_FLAGS ] ; then usage; exit 1 ; fi | |
| 117 | if [ $NO_ARGS ] ; then usage ; fi | |
| 118 | ||
| 119 | if ! command -v docker &> /dev/null | |
| 120 | then | |
| 121 | echo "" | |
| 122 | echo "Error: docker could not be found!" | |
| 123 | echo "You can fix this on Debian/Ubuntu by saying:" | |
| 124 | echo "$ sudo apt install docker.io" | |
| 125 | exit 1 | |
| 126 | fi | |
| 127 | ||
| 128 | # ----------------------------------------------------------------------------- | |
| 129 | ## Shared docker build options | |
| 130 | ||
| 131 | OCPKG_OPTION="" | |
| 132 | if [ ! -z "$OCPKG_URL" ]; then | |
| 133 | OCPKG_OPTION="--build-arg OCPKG_URL=$OCPKG_URL" | |
| 134 | fi | |
| 135 | BASE_OS_OPTION="--build-arg BASE_OS=$BASE_OS" | |
| 136 | OS_VERSION_OPTION="--build-arg OS_VERSION=$OS_VERSION" | |
| 137 | GITHUB_OPTION="--build-arg GITHUB_NAME=$GITHUB_NAME" | |
| 138 | ||
| 139 | BUILD_OPTIONS="$CACHE_OPTION $BASE_OS_OPTION $OS_VERSION_OPTION $OCPKG_OPTION $GITHUB_OPTION" | |
| 140 | ||
| 141 | # ----------------------------------------------------------------------------- | |
| 142 | ## Build opencog/opencog-deps image. | |
| 143 | build_opencog_deps() { | |
| 144 | echo "---- Starting build of ${DOCKER_NAME}/opencog-deps:${OS_VERSION} ----" | |
| 145 | docker build $BUILD_OPTIONS -t ${DOCKER_NAME}/opencog-deps:${OS_VERSION} base | |
| 146 | echo "---- Finished build of ${DOCKER_NAME}/opencog-deps:${OS_VERSION} ----" | |
| 147 | } | |
| 148 | ||
| 149 | ## If the opencog/opencog-deps image hasn't been built yet then build it. | |
| 150 | check_opencog_deps() { | |
| 151 | if [ -z "$(docker images ${DOCKER_NAME}/opencog-deps | grep -i opencog-deps)" ]; then | |
| 152 | build_opencog_deps | |
| 153 | fi | |
| 154 | } | |
| 155 | ||
| 156 | # ----------------------------------------------------------------------------- | |
| 157 | ## Build opencog/atomspace image. | |
| 158 | build_atomspace() { | |
| 159 | check_opencog_deps | |
| 160 | echo "---- Starting build of ${DOCKER_NAME}/atomspace:${OS_VERSION} ----" | |
| 161 | docker build $BUILD_OPTIONS -t ${DOCKER_NAME}/atomspace:${OS_VERSION} atomspace | |
| 162 | echo "---- Finished build of ${DOCKER_NAME}/atomspace:${OS_VERSION} ----" | |
| 163 | } | |
| 164 | ||
| 165 | ## If the opencog/atomspace image hasn't been built yet then build it. | |
| 166 | check_atomspace() { | |
| 167 | if [ -z "$(docker images ${DOCKER_NAME}/atomspace | grep -i atomspace)" ]; then | |
| 168 | build_atomspace | |
| 169 | fi | |
| 170 | } | |
| 171 | ||
| 172 | # ----------------------------------------------------------------------------- | |
| 173 | ## Pull all images needed for development from hub.docker.com/u/opencog/ | |
| 174 | pull_dev_images() { | |
| 175 | echo "---- Starting pull of opencog development images ----" | |
| 176 | docker pull ${DOCKER_NAME}/opencog-deps | |
| 177 | docker pull ${DOCKER_NAME}/atomspace | |
| 178 | docker pull ${DOCKER_NAME}/atomspace-py | |
| 179 | docker pull ${DOCKER_NAME}/learn | |
| 180 | echo "---- Finished pull of opencog development images ----" | |
| 181 | } | |
| 182 | ||
| 183 | # ----------------------------------------------------------------------------- | |
| 184 | # NOTE: To avoid repetion of builds don't reorder the sequence here. | |
| 185 | ||
| 186 | if [ $PULL_DEV_IMAGES ]; then | |
| 187 | pull_dev_images | |
| 188 | exit 0 | |
| 189 | fi | |
| 190 | ||
| 191 | if [ $BUILD_OPENCOG_BASE_IMAGE ]; then | |
| 192 | build_opencog_deps | |
| 193 | fi | |
| 194 | ||
| 195 | if [ $BUILD_ATOMSPACE_IMAGE ]; then | |
| 196 | build_atomspace | |
| 197 | fi | |
| 198 | ||
| 199 | if [ $BUILD_ATOMSPACE_PYTHON_IMAGE ]; then | |
| 200 | echo "---- Starting build of ${DOCKER_NAME}/atomspace-py:${OS_VERSION} ----" | |
| 201 | docker build $BUILD_OPTIONS -t ${DOCKER_NAME}/atomspace-py:${OS_VERSION} ${DIR_NAME}/atomspace-py | |
| 202 | echo "---- Finished build of ${DOCKER_NAME}/atomspace-py:${OS_VERSION} ----" | |
| 203 | fi | |
| 204 | ||
| 205 | if [ $BUILD_LEARN_IMAGE ] ; then | |
| 206 | echo "---- Starting build of ${DOCKER_NAME}/learn:${OS_VERSION} ----" | |
| 207 | docker build $BUILD_OPTIONS -t ${DOCKER_NAME}/learn:${OS_VERSION} ${DIR_NAME}/learn | |
| 208 | echo "---- Finished build of ${DOCKER_NAME}/learn:${OS_VERSION} ----" | |
| 209 | fi | |
| 210 | ||
| 211 | # ----------------------------------------------------------------------------- |
| … | … | @@ -0,0 +1,44 @@ |
| 1 | # | |
| 2 | # Container with crude language data. | |
| 3 | # Experimental. This does NOT do anything interesting! Demo only. | |
| 4 | # | |
| 5 | # Steps: | |
| 6 | # 1. docker build -t opencog/lang-model . | |
| 7 | # 2. docker create --name lang-model -p 17001:19014 | |
| 8 | # -it opencog/lang-model | |
| 9 | # Note: the -p flag is external_port:internal_port | |
| 10 | # The scripts in this container start a cogserver on 19014 | |
| 11 | # 3. docker start -i lang-model | |
| 12 | # 4. cd experiments/run-word-pairs | |
| 13 | # 5. . 0-pipeline.sh | |
| 14 | # 6. . pairs-en-conf.sh | |
| 15 | # 7. Run either tmux or byobu according to taste. | |
| 16 | # 8. guile -l scm/cogserver-nav.scm | |
| 17 | # Wait until the guile command prompt appears. | |
| 18 | # | |
| 19 | # 9. Outside of the container, connect to the cogserver: | |
| 20 | # rlwrap telnet localhost 17001 | |
| 21 | # Then try various commands: help, status, top, etc. | |
| 22 | ||
| 23 | FROM opencog/learn | |
| 24 | ||
| 25 | USER opencog | |
| 26 | WORKDIR /home/opencog | |
| 27 | ||
| 28 | RUN mkdir /home/opencog/data | |
| 29 | WORKDIR /home/opencog/data | |
| 30 | ||
| 31 | # RUN wget --progress=bar:force:noscroll https://linas.org/datasets/r13-all-in-one.tar.bz2 | |
| 32 | RUN curl https://linas.org/datasets/r13-all-in-one.tar.bz2 -o r13-all-in-one.tar.bz2 | |
| 33 | RUN tar -jxf r13-all-in-one.tar.bz2 | |
| 34 | RUN rm r13-all-in-one.tar.bz2 | |
| 35 | ||
| 36 | COPY /scripts/ /home/opencog | |
| 37 | ||
| 38 | # Setup the workspace for developers | |
| 39 | WORKDIR /home/opencog | |
| 40 | RUN sudo chown -R opencog:opencog experiments | |
| 41 | ||
| 42 | CMD /bin/bash | |
| 43 | ||
| 44 | ONBUILD USER root |
| … | … | @@ -0,0 +1,30 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # 0-pipeline.sh | |
| 4 | # | |
| 5 | # Master file for configuration parameters for language learning. | |
| 6 | # This particular file is aimed at artificial-language/corpus | |
| 7 | # generation and processing. | |
| 8 | # ---------- | |
| 9 | ||
| 10 | # Location where processing scripts are installed. | |
| 11 | # export COMMON_DIR=/usr/local/share/opencog/learn/run-common | |
| 12 | export COMMON_DIR=/home/ubuntu/src/learn/run-common | |
| 13 | ||
| 14 | # Location where the RocksDB databases are kept. This allows different | |
| 15 | # experiments to re-use the same filenames, changing only the directory. | |
| 16 | # It is recommended that this be located on an SSD disk, for | |
| 17 | # performance. | |
| 18 | # If you are using Postgres, just delete `ROCKS_DATA_DIR`. | |
| 19 | # export ROCKS_DATA_DIR=/home/atomspace/data/ | |
| 20 | export ROCKS_DATA_DIR=/home/opencog/data/ | |
| 21 | ||
| 22 | # Directory in which configuration parameters (including this file) | |
| 23 | # are located. Obtained automatically; don't change. | |
| 24 | export CONFIG_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
| 25 | ||
| 26 | # The master config file, which is this file. Don't change. | |
| 27 | export MASTER_CONFIG_FILE=${CONFIG_DIR}/$( basename "${BASH_SOURCE[0]}" ) | |
| 28 | ||
| 29 | # File containing grammatical-class configuration | |
| 30 | # export GRAM_CONF_FILE=$CONFIG_DIR/4-gram-conf-en.sh |
| … | … | @@ -0,0 +1,219 @@ |
| 1 | ||
| 2 | Word-pairs Visualization Server | |
| 3 | =============================== | |
| 4 | The code in this directory configures and runs an AtomSpace | |
| 5 | providing access to word-pair correlation data, word-disjunct | |
| 6 | data, and word similarity scores. | |
| 7 | ||
| 8 | Instructions | |
| 9 | ------------ | |
| 10 | Get your hands on one of these datasets (or create your own; see | |
| 11 | the opencog/learn project for instructions how.) Contact Linas | |
| 12 | to get these datasets. | |
| 13 | ||
| 14 | * `run-1-marg-tranche-123.rdb` -- Requires 59GB to load word-pairs, | |
| 15 | 60 GB to be usable, so not eligible. | |
| 16 | ||
| 17 | * `run-1-t12-tsup-1-1-1.rdb` -- 6.4 GB to load word pairs and | |
| 18 | also disjuncts. 9 minutes to load everything. | |
| 19 | 7 GB after computing (w,d) MI | |
| 20 | ||
| 21 | * r13-one-sim200.rdb -- 8.2GB to load word-pairs, word-disjunct | |
| 22 | pairs and similarities. | |
| 23 | ||
| 24 | * r13-all-in-one.rdb -- trimmed, modified copy of `r14-sim200.rdb` | |
| 25 | It has the following stuff: | |
| 26 | -- Word pairs, from long ago. These are trimmed to remove all | |
| 27 | word-pairs with MI of 1.1 or less, leaving 3.9M pairs. | |
| 28 | -- word-pair MI that are appropriate, prior to this trim. | |
| 29 | -- word-disjunct pairs, with shape marginals on them. | |
| 30 | -- word-disjunct MI values. (plain, not including shapes) | |
| 31 | -- similarities for top-ranked 1000 words | |
| 32 | -- Requires 6.5 GB to load word-pairs only. | |
| 33 | -- Grows to 8.3 GB after loading word-disjunct pairs. | |
| 34 | -- Grows to 8.6 GB to load similarities. | |
| 35 | ||
| 36 | Then the usual: git clone and compile and install cogutils, the | |
| 37 | atomspace, the cogserver, atomspace-rocks and the learn project. | |
| 38 | ||
| 39 | Next, configure the config files to suit your tastes: edit the | |
| 40 | files `0-pipeline.sh` and `pairs-en-conf.sh` in this directory. | |
| 41 | Source them, they set environment variables. To source, say this: | |
| 42 | ``` | |
| 43 | . 0-pipeline.sh | |
| 44 | . pairs-en-conf.sh | |
| 45 | ``` | |
| 46 | ||
| 47 | Next, start the cogserver. Doing this will automatically load | |
| 48 | the datasets: | |
| 49 | ``` | |
| 50 | guile -l scm/cogserver-nav.scm | |
| 51 | ``` | |
| 52 | When the above gets to the guile prompt, it will be ready to serve | |
| 53 | data to the visualizer. | |
| 54 | ||
| 55 | General Exploration | |
| 56 | =================== | |
| 57 | A scheme prompt is directly accessible via the cogserver: | |
| 58 | ``` | |
| 59 | rlwrap telnet localhost 19014 | |
| 60 | scm | |
| 61 | (format #t "Hello world\n") | |
| 62 | ``` | |
| 63 | ||
| 64 | There are three types of data in this dataset: word-word pairs, | |
| 65 | word-disjunct pairs and word-similarities. The first example | |
| 66 | is for word-word pairs, showing how to find related words. | |
| 67 | ||
| 68 | Many words are NOT in the dataset, so random experimentation | |
| 69 | may result in no replies. | |
| 70 | ||
| 71 | To get a list of all word-word pairs, with a given word on the right: | |
| 72 | ``` | |
| 73 | (pair-stars 'left-stars (WordNode "end")) | |
| 74 | ``` | |
| 75 | ||
| 76 | This will return a long list, the last part of which is: | |
| 77 | ``` | |
| 78 | (EvaluationLink (ctv 1 0 19) | |
| 79 | (LgLinkNode "ANY") | |
| 80 | (ListLink (WordNode "cold") (WordNode "end"))) | |
| 81 | (EvaluationLink (ctv 1 0 10) | |
| 82 | (LgLinkNode "ANY") | |
| 83 | (ListLink (WordNode "seen") (WordNode "end"))) | |
| 84 | (EvaluationLink (ctv 1 0 34) | |
| 85 | (LgLinkNode "ANY") | |
| 86 | (ListLink (WordNode "quick") (WordNode "end"))) | |
| 87 | (EvaluationLink (ctv 1 0 18) | |
| 88 | (LgLinkNode "ANY") | |
| 89 | (ListLink (WordNode "horrible") (WordNode "end"))) | |
| 90 | ``` | |
| 91 | Ignore the `ctv` (this is an observation count) | |
| 92 | ||
| 93 | These "pairs" are "edges", the name of the edge is "ANY", | |
| 94 | and there's a bunch of numerical data hanging off each edge. | |
| 95 | ||
| 96 | The "relatedness" of a word-pair can be obtained by looking | |
| 97 | at it's mutual information (MI). View this as follows: | |
| 98 | ``` | |
| 99 | (pair-freq 'pair-fmi | |
| 100 | (Evaluation (LgLink "ANY") (List (Word "horrible") (Word "end")))) | |
| 101 | ``` | |
| 102 | The above returns a single floating point number, in the range of | |
| 103 | about -20 to about +20, indicating the MI of the pair. The higher, | |
| 104 | the better. | |
| 105 | ||
| 106 | Pairs, with the word on the left: | |
| 107 | ``` | |
| 108 | (pair-stars 'right-stars (Word "end")) | |
| 109 | ``` | |
| 110 | ||
| 111 | The "other end" of a given word (the other vertex at the | |
| 112 | end of an edge) can be gotten with: | |
| 113 | ``` | |
| 114 | (pair-stars 'right-duals (Word "end")) | |
| 115 | (pair-stars 'left-duals (Word "end")) | |
| 116 | ||
| 117 | Simplified Navigation API | |
| 118 | ------------------------- | |
| 119 | To simplify data access, there's a thin wrapper which can be used to | |
| 120 | navigate the word-pair graph. Given a word, it will move "forward", | |
| 121 | returning the top N related words, ranked in MI order. The "backward" | |
| 122 | move moves left. The edge-score is a single floating point number for | |
| 123 | that word-pair. | |
| 124 | ||
| 125 | ``` | |
| 126 | ;; Examples | |
| 127 | ;; | |
| 128 | ;; Create a navigator for the given matrix and ranking objects | |
| 129 | ;; In this case, pair-stars and pair-freq ... | |
| 130 | ;; All of these arguments should be taken from a config file. | |
| 131 | ;; | |
| 132 | (define (pair-score EDGE) (pair-freq 'pair-fmi EDGE)) | |
| 133 | (define pair-nav | |
| 134 | (make-nav pair-stars 'right-duals 'left-duals pair-score 10)) | |
| 135 | ||
| 136 | ;; Examples | |
| 137 | (pair-nav 'forward (Word "end")) | |
| 138 | (pair-nav 'backward (Word "end")) | |
| 139 | ||
| 140 | ;; Scores, from the forwards-list | |
| 141 | (pair-nav 'edge-score (Word "end") (Word "chapter")) | |
| 142 | (pair-nav 'edge-score (Word "end") (Word "notes")) | |
| 143 | (pair-nav 'edge-score (Word "end") (Word "badly")) | |
| 144 | ||
| 145 | ;; From the backwards list | |
| 146 | (pair-nav 'edge-score (Word "rear") (Word "end")) | |
| 147 | (pair-nav 'edge-score (Word "far") (Word "end")) | |
| 148 | ``` | |
| 149 | ||
| 150 | Word-disjunct pairs | |
| 151 | ------------------- | |
| 152 | A lot like the above, except: | |
| 153 | ``` | |
| 154 | (cset-stars 'right-stars (WordNode "end")) | |
| 155 | ``` | |
| 156 | ||
| 157 | Similarity examples | |
| 158 | ------------------- | |
| 159 | The dataset also contains similarity scores for the top most-frequent | |
| 160 | 1000 words (the "triangle number" of (1001 x 1000 / 2) pairs; about | |
| 161 | half a million). | |
| 162 | ||
| 163 | Raw access: | |
| 164 | ``` | |
| 165 | (sim-stars 'left-basis-size) | |
| 166 | (sim-stars 'right-duals (Word "end")) | |
| 167 | (sim-obj 'describe) | |
| 168 | (sim-obj 'pair-similarity (sim-stars 'get-pair (Word "end") (Word "well"))) | |
| 169 | ``` | |
| 170 | The above is nasty in it's native form, so the wrapper in `navigate.scm` | |
| 171 | comes to the rescue: | |
| 172 | ||
| 173 | ``` | |
| 174 | ;; First, build the API: | |
| 175 | ;; | |
| 176 | (define (sim-fmi EDGE) | |
| 177 | (cog-value-ref (sim-obj 'pair-similarity EDGE) 0)) | |
| 178 | (define (sim-vmi EDGE) | |
| 179 | (cog-value-ref (sim-obj 'pair-similarity EDGE) 1)) | |
| 180 | ||
| 181 | (define sim-fmi-nav | |
| 182 | (make-nav sim-stars 'right-duals 'left-duals sim-fmi 10)) | |
| 183 | (define sim-vmi-nav | |
| 184 | (make-nav sim-stars 'right-duals 'left-duals sim-vmi 10)) | |
| 185 | ||
| 186 | ;; Now, actually use the API: | |
| 187 | ;; | |
| 188 | (sim-fmi-nav 'forward (Word "end")) | |
| 189 | (sim-fmi-nav 'edge-score (Word "end") (Word "out")) | |
| 190 | ``` | |
| 191 | The dataset contains two different similarity scores, the "fmi" | |
| 192 | fractional-MI and the "vmi" variational-MI. The vmi is just the fmi | |
| 193 | offset the the mean of the log of the frequency. | |
| 194 | ||
| 195 | Lots of other similarity scores are possible; they're just not in | |
| 196 | this dataset. That is, the dataset just caches some pre-computed | |
| 197 | values, as otherwise it is fairly CPU-intensive to compute. | |
| 198 | (Typically about 10 sims per second, but you need thousands of | |
| 199 | these to see which ones are the best/closest. Almost all words | |
| 200 | are NOT similar!) | |
| 201 | ||
| 202 | Documentation | |
| 203 | ============= | |
| 204 | All matrix objects have built-in documentation. For example: | |
| 205 | ``` | |
| 206 | (pair-freq 'help) | |
| 207 | (pair-freq 'describe) | |
| 208 | (pair-stars 'help) | |
| 209 | (pair-stars 'describe) | |
| 210 | ``` | |
| 211 | ||
| 212 | TODO: | |
| 213 | ----- | |
| 214 | This: | |
| 215 | ``` | |
| 216 | ;;; (cog-atomspace-ro!) ;; No ... this fails somehow. | |
| 217 | ``` | |
| 218 | ||
| 219 | ======== |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | # | |
| 2 | # Configuration for a production OpenCog server - English MST | |
| 3 | # | |
| 4 | SERVER_PORT = 19014 | |
| 5 | LOG_FILE = /tmp/run-14.log | |
| 6 | ||
| 7 | # Other possible log levels are "error", "warn", "info", "debug" and "fine" | |
| 8 | # LOG_LEVEL = debug | |
| 9 | LOG_LEVEL = info | |
| 10 | LOG_TO_STDOUT = false | |
| 11 | ||
| 12 | # ANSI prompts are colorful. | |
| 13 | PROMPT = "run-14> " | |
| 14 | ANSI_PROMPT = "[0;32mrun-14[1;32m> [0m" | |
| 15 | SCM_PROMPT = "guile-run-14> " | |
| 16 | ANSI_SCM_PROMPT = "[0;34mguile-run-14[1;34m> [0m" | |
| 17 | ANSI_ENABLED = true |
| … | … | @@ -0,0 +1,17 @@ |
| 1 | # | |
| 2 | # Configuration for a production OpenCog server - English MST | |
| 3 | # | |
| 4 | SERVER_PORT = 19014 | |
| 5 | LOG_FILE = /tmp/public-pairs.log | |
| 6 | ||
| 7 | # Other possible log levels are "error", "warn", "info", "debug" and "fine" | |
| 8 | # LOG_LEVEL = debug | |
| 9 | LOG_LEVEL = info | |
| 10 | LOG_TO_STDOUT = false | |
| 11 | ||
| 12 | # ANSI prompts are colorful. | |
| 13 | PROMPT = "en-pairs> " | |
| 14 | ANSI_PROMPT = "[0;32men-pairs[1;32m> [0m" | |
| 15 | SCM_PROMPT = "guile-en-pairs> " | |
| 16 | ANSI_SCM_PROMPT = "[0;34mguile-en-pairs[1;34m> [0m" | |
| 17 | ANSI_ENABLED = true |
| … | … | @@ -0,0 +1,19 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Configuration parameters for disjunct distributions. | |
| 4 | # | |
| 5 | # IPv4 hostname and port number of where the cogserver is running. | |
| 6 | export HOSTNAME=localhost | |
| 7 | export PORT=19014 | |
| 8 | ||
| 9 | export PROMPT="(pairs-en)" | |
| 10 | ||
| 11 | export COGSERVER_CONF=${CONFIG_DIR}/cogserver/cogserver-pairs.conf | |
| 12 | ||
| 13 | export MST_DB=${ROCKS_DATA_DIR}/r14-imp-q0.7-c0.9-n0.rdb | |
| 14 | export PAIRS_DB=${ROCKS_DATA_DIR}/run-1-en_pairs-tranche-123.rdb | |
| 15 | export ALL_DB=${ROCKS_DATA_DIR}/run-1-t12-tsup-1-1-1.rdb | |
| 16 | export ALL_DB=${ROCKS_DATA_DIR}/r13-one-sim200.rdb | |
| 17 | export ALL_DB=${ROCKS_DATA_DIR}/r13-all-in-one.rdb | |
| 18 | ||
| 19 | export STORAGE_NODE="(RocksStorageNode \"rocks://${ALL_DB}\")" |
| … | … | @@ -0,0 +1,48 @@ |
| 1 | ; | |
| 2 | ; cogserver-nav.scm | |
| 3 | ; | |
| 4 | ; Run everything needed to get ready to allow visualization of | |
| 5 | ; the language-learning word-pairs and word-disjunct datasets. | |
| 6 | ; | |
| 7 | ; Starts the CogServer, opens the database, loads the word-pairs, | |
| 8 | ; disjuncts and similarity scores in the database (which usually | |
| 9 | ; takes about 10-15 minutes.) | |
| 10 | ; | |
| 11 | (include "cogserver.scm") | |
| 12 | ||
| 13 | ; Load up the disjuncts -- this can take over half an hour! | |
| 14 | (display "Fetch all data. This may take 5-15 minutes.\n") | |
| 15 | ||
| 16 | ; Load the word-pairs. | |
| 17 | (define pair-obj (make-any-link-api)) | |
| 18 | (pair-obj 'fetch-pairs) | |
| 19 | (define pair-stars (add-pair-stars pair-obj)) | |
| 20 | (print-matrix-summary-report pair-stars) | |
| 21 | (define pair-freq (add-pair-freq-api pair-stars)) | |
| 22 | ||
| 23 | ; Load the word-disjunct data. | |
| 24 | (define cset-obj (make-pseudo-cset-api)) | |
| 25 | (cset-obj 'fetch-pairs) | |
| 26 | (define cset-stars (add-pair-stars cset-obj)) | |
| 27 | (print-matrix-summary-report cset-stars) | |
| 28 | (define cset-freq (add-pair-freq-api cset-stars)) | |
| 29 | ||
| 30 | ; Load the similarity scores | |
| 31 | (define (do-add-similarity-api LLOBJ) | |
| 32 | (define SIM-ID "shape-mi") | |
| 33 | (add-similarity-api LLOBJ #f SIM-ID)) | |
| 34 | ||
| 35 | (define sim-obj (do-add-similarity-api cset-obj)) | |
| 36 | (sim-obj 'fetch-pairs) | |
| 37 | (define sim-stars (add-pair-stars sim-obj)) | |
| 38 | ||
| 39 | ; Close the database to avoid accidental damage. | |
| 40 | (cog-close storage-node) | |
| 41 | ||
| 42 | ; Sigh It would be nice to mark the atomspace read-only, | |
| 43 | ; but that breaks things. Oh well. | |
| 44 | ;;; (cog-atomspace-ro!) | |
| 45 | ;;; (cog-push-atomspace) | |
| 46 | ||
| 47 | ; Now load additional navigation tools. | |
| 48 | (include "navigate.scm") |
| … | … | @@ -0,0 +1,66 @@ |
| 1 | #! /usr/bin/env -S guile | |
| 2 | !# | |
| 3 | ; | |
| 4 | ; cogserver.scm | |
| 5 | ; ATTENTION! This is a COPY of opencog/learn/run-common/cogserver.scm | |
| 6 | ; Editing this file is not recommended! | |
| 7 | ; | |
| 8 | ; Perform language-learning pipeline module loading and CogServer setup. | |
| 9 | ; Loads all needed modules, starts the CogServer, opens the database. | |
| 10 | ; | |
| 11 | ; Configurable parameters are pulled from the shell environment. | |
| 12 | ; | |
| 13 | (use-modules (system repl common)) | |
| 14 | (use-modules (opencog) (opencog logger)) | |
| 15 | (use-modules (opencog persist)) | |
| 16 | (use-modules (opencog matrix)) | |
| 17 | (use-modules (opencog nlp) (opencog learn)) | |
| 18 | (use-modules (opencog cogserver)) | |
| 19 | (use-modules (srfi srfi-1)) | |
| 20 | ||
| 21 | (define env-prompt (getenv "PROMPT")) | |
| 22 | ||
| 23 | ; Avoid mystery crash on cold startup. | |
| 24 | (when (not env-prompt) | |
| 25 | (format #t "Error: Learning pipeline not configured!\n") | |
| 26 | (format #t "Did you forget to source a config file?\n") | |
| 27 | (format #t "Config files are in the `run-config` directory.\n") | |
| 28 | (exit -1)) | |
| 29 | ||
| 30 | ; Prompt magic, copied from `module/system/repl/common.scm` | |
| 31 | (define (cog-prompt) | |
| 32 | (let ((level (length (cond | |
| 33 | ((fluid-ref *repl-stack*) => cdr) | |
| 34 | (else '()))))) | |
| 35 | (if (zero? level) | |
| 36 | (string-append env-prompt "> ") | |
| 37 | (format #f "~A [~A]> " env-prompt level)))) | |
| 38 | ||
| 39 | (repl-default-prompt-set! cog-prompt) | |
| 40 | ||
| 41 | ; Start the cogserver using the indicated config file. | |
| 42 | (start-cogserver (getenv "COGSERVER_CONF")) | |
| 43 | ||
| 44 | ; Open the database. | |
| 45 | (define sns (getenv "STORAGE_NODE")) | |
| 46 | (cond | |
| 47 | ((string-prefix? "(Rocks" sns) (use-modules (opencog persist-rocks))) | |
| 48 | ((string-prefix? "(Postgres" sns) (use-modules (opencog persist-sql))) | |
| 49 | ((string-prefix? "(Cog" sns) (use-modules (opencog persist-cog))) | |
| 50 | (else (throw 'bad-storage-node 'unknown | |
| 51 | (format #f "Unknown storage node type ~A\n" sns)))) | |
| 52 | ||
| 53 | (define storage-node (eval-string sns)) | |
| 54 | (cog-open storage-node) | |
| 55 | ||
| 56 | ; ----------------------------------------------------------- | |
| 57 | ; Enable automated server shutdown. This waits until the server | |
| 58 | ; is idle (taken to be a sign that there's no more text to be | |
| 59 | ; processed) and then exits guile. | |
| 60 | (define (exit-server) | |
| 61 | (block-until-idle 0.01) | |
| 62 | (cog-close storage-node) | |
| 63 | (block-until-idle 0.01) | |
| 64 | (exit 0)) | |
| 65 | ||
| 66 | ; ----------------------------------------------------------- |
| … | … | @@ -0,0 +1,154 @@ |
| 1 | ; | |
| 2 | ; navigate.scm | |
| 3 | ; | |
| 4 | ; Quick-n-dirty wrapper for getting word-pair similarity. | |
| 5 | ; Assumes that there are matrix objects and loaded data | |
| 6 | ; as descrbied in README.md | |
| 7 | ; | |
| 8 | ||
| 9 | ||
| 10 | (use-modules (srfi srfi-1)) | |
| 11 | ||
| 12 | ; General terminology: | |
| 13 | ; The "stars" are the edges, the duals are the other vertex. | |
| 14 | ; So, given a vertex, the left-stars are a list of all edges | |
| 15 | ; pointing at the vertex. The right-stars are all the edges | |
| 16 | ; pointing away from the vertex. The left-duals are all the | |
| 17 | ; vertices that have edges pointing at the target. The right-duals | |
| 18 | ; are all the vertices that have edges pointing away from the target. | |
| 19 | ; | |
| 20 | ; The MI is the mutual information of an edge. Get it by saying | |
| 21 | ; `(pair-freq 'pair-fmi edge-atom)` | |
| 22 | ; ----------------------------------------- | |
| 23 | ||
| 24 | ; Create a simple object with some methods on it ... | |
| 25 | (define (make-nav STARS-OBJ FWD-METHOD BACK-METHOD | |
| 26 | SCORE-EDGE NUM-TO-SHOW) | |
| 27 | " | |
| 28 | make-navigator -- Generic graph navigation object | |
| 29 | See examples for more info. | |
| 30 | " | |
| 31 | ; Make a short list in sorted order. | |
| 32 | (define (short-list FWD TARGET-VERTEX) | |
| 33 | ||
| 34 | ; Depending on whether FWD is #t or #f, | |
| 35 | ; get the edge pointing towards or away from the target. | |
| 36 | (define (get-edge OTHER-VERTEX) | |
| 37 | (if FWD | |
| 38 | (STARS-OBJ 'get-pair TARGET-VERTEX OTHER-VERTEX) | |
| 39 | (STARS-OBJ 'get-pair OTHER-VERTEX TARGET-VERTEX))) | |
| 40 | ||
| 41 | ; Define a compare function that compares two | |
| 42 | ; vertices... assuming both have the target-vertex | |
| 43 | ; in common. | |
| 44 | (define (compare-fun VTX-A VTX-B) | |
| 45 | (> (SCORE-EDGE (get-edge VTX-A)) | |
| 46 | (SCORE-EDGE (get-edge VTX-B)))) | |
| 47 | ||
| 48 | ; Get the list of all vertices that are joined | |
| 49 | ; by some edge to the target vertex. | |
| 50 | (define tail-verts | |
| 51 | (if FWD | |
| 52 | (STARS-OBJ FWD-METHOD TARGET-VERTEX) | |
| 53 | (STARS-OBJ BACK-METHOD TARGET-VERTEX))) | |
| 54 | ||
| 55 | ; Sort the list above, and then return the | |
| 56 | ; first NUM-TO-SHOW of that list. | |
| 57 | (take (sort tail-verts compare-fun) NUM-TO-SHOW)) | |
| 58 | ||
| 59 | ; Return an edge-score for the given edge. | |
| 60 | ; This is a trivial wrapper. | |
| 61 | (define (escore LEFT-VTX RIGHT-VTX) | |
| 62 | (SCORE-EDGE (STARS-OBJ 'get-pair LEFT-VTX RIGHT-VTX))) | |
| 63 | ||
| 64 | ; Call the various methods on the object. | |
| 65 | (lambda (message . args) | |
| 66 | (case message | |
| 67 | ((forward) (short-list #t args)) | |
| 68 | ((backward) (short-list #f args)) | |
| 69 | ((edge-score) (apply escore args)) | |
| 70 | (else "Ooops! unknown method!") | |
| 71 | )) | |
| 72 | ) | |
| 73 | ||
| 74 | ; ----------------------------------------- | |
| 75 | ||
| 76 | ; Create a simple object with some methods on it ... | |
| 77 | (define (make-navigator STARS-OBJ FWD-METHOD BACK-METHOD | |
| 78 | RANK-OBJ RANK-METHOD NUM-TO-SHOW) | |
| 79 | " | |
| 80 | make-navigator -- Generic graph navigation object | |
| 81 | See examples for more info. | |
| 82 | " | |
| 83 | (define (score-edge EDGE) (RANK-OBJ RANK-METHOD EDGE)) | |
| 84 | ||
| 85 | (make-nav STARS-OBJ FWD-METHOD BACK-METHOD score-edge NUM-TO-SHOW) | |
| 86 | ) | |
| 87 | ||
| 88 | ; ========================================================= | |
| 89 | ;; Examples | |
| 90 | ;; | |
| 91 | ;; Create a navigator for the given matrix and ranking objects | |
| 92 | ;; In this case, pair-stars and pair-freq ... | |
| 93 | ;; All of these arguments should be taken from a config file. | |
| 94 | ;; | |
| 95 | ; (define (pair-score EDGE) (pair-freq 'pair-fmi EDGE)) | |
| 96 | ; (define pair-nav | |
| 97 | ; (make-nav pair-stars 'right-duals 'left-duals pair-score 10)) | |
| 98 | ; | |
| 99 | ;; Examples | |
| 100 | ; (pair-nav 'forward (Word "end")) | |
| 101 | ; (pair-nav 'backward (Word "end")) | |
| 102 | ; | |
| 103 | ;; Scores, from the forwards-list | |
| 104 | ; (pair-nav 'edge-score (Word "end") (Word "chapter")) | |
| 105 | ; (pair-nav 'edge-score (Word "end") (Word "notes")) | |
| 106 | ; (pair-nav 'edge-score (Word "end") (Word "badly")) | |
| 107 | ; | |
| 108 | ;; From the backwards list | |
| 109 | ; (pair-nav 'edge-score (Word "rear") (Word "end")) | |
| 110 | ; (pair-nav 'edge-score (Word "far") (Word "end")) | |
| 111 | ; | |
| 112 | ;; ========================================================= | |
| 113 | ;; Like above, but for word similarity. | |
| 114 | ;; | |
| 115 | ;; First, build the API: | |
| 116 | ;; | |
| 117 | ; (define (sim-fmi EDGE) | |
| 118 | ; (cog-value-ref (sim-obj 'pair-similarity EDGE) 0)) | |
| 119 | ; (define (sim-vmi EDGE) | |
| 120 | ; (cog-value-ref (sim-obj 'pair-similarity EDGE) 1)) | |
| 121 | ; | |
| 122 | ; (define sim-fmi-nav | |
| 123 | ; (make-nav sim-stars 'right-duals 'left-duals sim-fmi 10)) | |
| 124 | ; (define sim-vmi-nav | |
| 125 | ; (make-nav sim-stars 'right-duals 'left-duals sim-vmi 10)) | |
| 126 | ; | |
| 127 | ;; Now, actually use the API: | |
| 128 | ;; | |
| 129 | ; (sim-fmi-nav 'forward (Word "end")) | |
| 130 | ; (sim-fmi-nav 'edge-score (Word "end") (Word "out")) | |
| 131 | ; | |
| 132 | ; | |
| 133 | ;; ========================================================= | |
| 134 | ;; ========================================================= | |
| 135 | ; | |
| 136 | ; | |
| 137 | ;;; print documentation: | |
| 138 | ; (pair-stars 'describe) | |
| 139 | ; (pair-freq 'describe) | |
| 140 | ; | |
| 141 | ;;; Examples of vertex weights: | |
| 142 | ; (pair-freq 'left-wild-logli (Word "start")) | |
| 143 | ; (pair-freq 'right-wild-logli (Word "start")) | |
| 144 | ; (pair-freq 'right-wild-fentropy (Word "start")) | |
| 145 | ; (pair-freq 'left-wild-fentropy (Word "start")) | |
| 146 | ; (pair-freq 'left-wild-fmi (Word "start")) | |
| 147 | ; (pair-freq 'right-wild-fmi (Word "start")) | |
| 148 | ; | |
| 149 | ;; The above could be placed in a popup menu over a vertex | |
| 150 | ;; (for example) or elsewhere. | |
| 151 | ; | |
| 152 | ;;; Examples of edge weights: | |
| 153 | ; (pair-freq 'pair-logli (pair-stars 'get-pair (Word "start") (Word "playing"))) | |
| 154 | ; (pair-freq 'pair-fmi (pair-stars 'get-pair (Word "start") (Word "playing"))) |
| … | … | @@ -0,0 +1,20 @@ |
| 1 | # | |
| 2 | # Container with Maximum-Spanning-Tree demo. | |
| 3 | # | |
| 4 | FROM opencog/learn:latest | |
| 5 | ||
| 6 | USER opencog | |
| 7 | WORKDIR /home/opencog | |
| 8 | ||
| 9 | # Set up the basic working directories | |
| 10 | RUN ./setup-for-experiments.sh | |
| 11 | ||
| 12 | # Copy in the fully-automated MST scripts. | |
| 13 | COPY --chown=opencog:opencog /scripts/ . | |
| 14 | ||
| 15 | # Copy in the demo Link Grammar dictionary. | |
| 16 | COPY --chown=opencog:opencog /demo-dict-mpg/ demo-dict-mpg | |
| 17 | ||
| 18 | CMD /bin/bash | |
| 19 | ||
| 20 | ONBUILD USER root |
| … | … | @@ -0,0 +1,237 @@ |
| 1 | lang-mst | |
| 2 | -------- | |
| 3 | Compute Maximum Spanning Tree (MST) disjuncts from text. | |
| 4 | ||
| 5 | This container provides a basic demo, together with a fully automated | |
| 6 | script, for counting MST disjuncts in text. It illustrates the second | |
| 7 | stage of the language-learning pipeline. It assumes that the first | |
| 8 | stage, from the `lang-pairs` container, has been done, and the resulting | |
| 9 | dataset is available. | |
| 10 | ||
| 11 | New users should follow the manual process, given below. Instructions | |
| 12 | for a fully-automated run are given at the end. | |
| 13 | ||
| 14 | Common setup | |
| 15 | ------------ | |
| 16 | Setup needed for both the manual demo, and the full-automated runs. | |
| 17 | ||
| 18 | 1. Create this Docker image: | |
| 19 | ``` | |
| 20 | docker build -t opencog/lang-mst . | |
| 21 | ``` | |
| 22 | 2. Create a container: | |
| 23 | `docker create --name mst-counter -it opencog/lang-mst` | |
| 24 | ||
| 25 | 3. (Optional) If you want access to the CogServer from outside the | |
| 26 | container, be sure to export the CogServer port: | |
| 27 | `docker create --name mst-counter -p 17003:17003 -it opencog/lang-mst` | |
| 28 | Note that this is a different port, from the pair-counting port; | |
| 29 | thus, you can run both at the same time. | |
| 30 | ||
| 31 | 4. Copy the word-pair database into the container. The default config | |
| 32 | files expect it at `data/mpg-parse.rdb`. The `lang-pairs` docker | |
| 33 | scripts previously dropped off the pairs DB at `data/word-pairs.rdb`. | |
| 34 | Thus: | |
| 35 | ``` | |
| 36 | docker container cp data/word-pairs.rdb mst-counter:/home/opencog/data/mpg-parse.rdb | |
| 37 | ``` | |
| 38 | ||
| 39 | 5. Copy the the text corpus into the container. The default config | |
| 40 | files expect it at `text/pair-counted`. Note that this is the | |
| 41 | place where the input corpus was moved to, during pair-counting, | |
| 42 | so if you just grab that, it will all work. | |
| 43 | ``` | |
| 44 | docker container cp text mst-counter:/home/opencog/ | |
| 45 | ``` | |
| 46 | ||
| 47 | 6. Start the container: `docker start -i mst-counter` | |
| 48 | This will drop you into a shell prompt inside the container. | |
| 49 | ||
| 50 | 7. Revise ownership of the data and text directories. The `docker cp` | |
| 51 | above fails to set these correctly. Inside the container: | |
| 52 | ``` | |
| 53 | sudo chown -R opencog:opencog text | |
| 54 | sudo chown -R opencog:opencog data | |
| 55 | ``` | |
| 56 | ||
| 57 | Manual processing | |
| 58 | ----------------- | |
| 59 | Manual processing consists mostly of setting up an environment, and | |
| 60 | then launching the MST counting scripts, and then monitoring progress. | |
| 61 | Short instructions: | |
| 62 | ||
| 63 | 0. If you haven't already done so, then: `docker start -i mst-counter`. | |
| 64 | ||
| 65 | 1. Set up the environment. Just cut-n-paste the below: | |
| 66 | ``` | |
| 67 | # Everything we need has already been set up in run-1. | |
| 68 | # Leave it as-is, in case you want to experiment there. | |
| 69 | # Do the actual MST counting in run-3. | |
| 70 | # Avoid confusion by removing the config for earlier and later stages. | |
| 71 | cd ~/experiments/ | |
| 72 | cp -pr run-1 run-3 | |
| 73 | cd run-3 | |
| 74 | rm -f 2-pair-conf.sh 4-gram-conf.sh | |
| 75 | ||
| 76 | # Use the default configuration. | |
| 77 | source 0-pipeline.sh | |
| 78 | source 3-mpg-conf.sh | |
| 79 | ||
| 80 | # Remove scripts for earlier and later stages (avoid confusion) | |
| 81 | cd run | |
| 82 | rm -rf 2-word-pairs 4-gram-class | |
| 83 | ||
| 84 | # Prepare to run the MST counting pipeline in byobu. | |
| 85 | cd 3-mst-parsing | |
| 86 | ``` | |
| 87 | ||
| 88 | 2. Start up a byobu/tmux session, just as before, for the word-pairs: | |
| 89 | ``` | |
| 90 | ./run-mst-shells.sh | |
| 91 | ``` | |
| 92 | ||
| 93 | 3. Use F3 and F4 to bounce between byobu/tmux panels. Navigate to the | |
| 94 | `cogserv` panel. Note that it is loading the word-pair dataset. This | |
| 95 | may take a while -- 5-10 minutes, half-an-hour or longer, depending on | |
| 96 | the dataset. | |
| 97 | ||
| 98 | 4. Navigate to the `telnet` panel. Explore. Run `top` in the telnet | |
| 99 | session, to see what the CogServer is doing. It will be idle. | |
| 100 | ||
| 101 | 5. Navigate to the `submit` panel, and run `./mst-submit.sh`. This will | |
| 102 | start passing the text files into the system. Their processing will | |
| 103 | stall, however, until the word-pairs are fully loaded. You can watch | |
| 104 | them in the `telnet` panel. | |
| 105 | ||
| 106 | 6. You can toggle to the `cogserv` and print some basic progress stats | |
| 107 | by saying `(monitor-parse-rate "hello world")` and `(cog-report-counts)` | |
| 108 | ||
| 109 | 7. Processing will continue for hours or days. Processing is done when | |
| 110 | the all of the telnet connections have closed, and the guile process | |
| 111 | goes idle. Manually exit guile. | |
| 112 | ||
| 113 | 8. Run `./compute-mst-marginals.sh` (in the `cogserv` panel, after | |
| 114 | exiting guile.) This computes marginal entropies and MI values, | |
| 115 | needed for the next stage of processing. | |
| 116 | ||
| 117 | ||
| 118 | Link Parser Demo | |
| 119 | ---------------- | |
| 120 | The resulting disjunct database can be used by the Link Grammar parser, | |
| 121 | as an "ordinary" dictionary, i.e. one containing per-word expressions. | |
| 122 | The only unusual aspect is that word categories are not used; all | |
| 123 | connectors are to specific words. | |
| 124 | ||
| 125 | 1. The RocksDB database can only be used by one user at a time, and so, | |
| 126 | because the CogServer is already using the database, a copy must be | |
| 127 | made. Go to the `spare` tab, and | |
| 128 | ``` | |
| 129 | cd ~/data | |
| 130 | cp -pr mpg-parse.rdb mpg-parse-copy.rdb | |
| 131 | ``` | |
| 132 | ||
| 133 | 2. Start the Link Grammar parser, using the demo dictionary provided. | |
| 134 | This dictionary is located in the `~/demo-dict-mpg` directory. It | |
| 135 | hard-codes the `mpg-parse-copy.rdb` file location in it. | |
| 136 | ``` | |
| 137 | cd ~ | |
| 138 | link-parser demo-dict-mpg -verbosity=3 | |
| 139 | ``` | |
| 140 | ||
| 141 | 3. Type in any sentence you wish. If the words appear in the dataset, | |
| 142 | and there are appropriate disjuncts on them, then the sentence will | |
| 143 | parse. | |
| 144 | ||
| 145 | The parser will be slow to startup, as portions of the database are | |
| 146 | loaded, including expressions for the `LEFT-WALL`, of which there will | |
| 147 | typically be millions. This size of this set is reduced only by | |
| 148 | clustering, done in a later stage. Once a lookup is done, the results | |
| 149 | are cached, so later access should be faster. The first-time lookup | |
| 150 | of words during parsing is likewise slow; subsequent access is cached. | |
| 151 | ||
| 152 | The dictionary is defined by the config files in `~/demo-dict-mpg`. | |
| 153 | You can copy and rename this directory as desired; you just have to | |
| 154 | start Link Grammar in the same directory where this is placed. | |
| 155 | Editing the `storage.dict` file to create a custom config. A typical | |
| 156 | change is to alter where the data is coming from. This is the line | |
| 157 | that starts with `#define storage-node`. | |
| 158 | ||
| 159 | Using a previously built container | |
| 160 | ---------------------------------- | |
| 161 | If you've followed the instructions above, and then stopped docker or | |
| 162 | rebooted, and want to restart that container, then here's how: | |
| 163 | ||
| 164 | 1. Restart the docker container. Use the `-i` flag to get an | |
| 165 | interactive shell: | |
| 166 | ``` | |
| 167 | docker start -i <container-name> | |
| 168 | ``` | |
| 169 | ||
| 170 | 2. To run the Link Grammar demo, follow the instructions above. | |
| 171 | ||
| 172 | 3. To restart processing after a hiatus, interpolate the earlier | |
| 173 | instructions. Typically, this requires restarting the cogserver, | |
| 174 | and then waiting for data to load. This can take tens of minutes | |
| 175 | or hours. | |
| 176 | ``` | |
| 177 | cd ~/experiments/run-3/run/3-mst-parsing | |
| 178 | ./run-mst-shells.sh | |
| 179 | ``` | |
| 180 | ||
| 181 | Semi-automated | |
| 182 | -------------- | |
| 183 | Some notes about the automation process. | |
| 184 | ||
| 185 | * Processing of texts is held off until all word-pairs are loaded. This | |
| 186 | is done with "gates" -- a mutex, called `mst-gate` is created. It is | |
| 187 | locked during word-pair loading, and unlocked when done. The text | |
| 188 | observers are blocked, waiting for this mutex. | |
| 189 | ||
| 190 | * When the submission of texts for counting has ended, the submit script | |
| 191 | calls `(finish-mst-submit)`. This can be re-defined to do anything, | |
| 192 | when called. By default its a no-op. The fully-automated scripts define | |
| 193 | it so that the CogServer exits. | |
| 194 | ||
| 195 | * When marginals compution finishes, the `/tmp/mst-marginals-done` file | |
| 196 | is touched. Docker uses this to self-halt the container that's running. | |
| 197 | Yes, this is a non-unique tag, if not running in docker, and it needs | |
| 198 | fixing. | |
| 199 | ||
| 200 | ||
| 201 | Fully automated | |
| 202 | --------------- | |
| 203 | The above has been condensed into a single script, `./autorun.sh`. | |
| 204 | It will start the docker container, move datasets into place, perform | |
| 205 | the processing, and halt the container when done. | |
| 206 | ||
| 207 | It expects the following: | |
| 208 | * A directory `data/mpg-parse.rdb` containing the pairs dataset. Get | |
| 209 | this by copying `../lang-pairs/data/word-pairs.rdb` from the previous | |
| 210 | pair-counting container. | |
| 211 | ``` | |
| 212 | cp -pr ../lang-pairs/data/word-pairs.rdb data/mpg-parse.rdb | |
| 213 | ``` | |
| 214 | ||
| 215 | * A directory `text/pair-counted` containing the text corpus to process. | |
| 216 | Get this by copying `../lang-pairs/text` into the current directory. | |
| 217 | ``` | |
| 218 | cp -pr ../lang-pairs/text . | |
| 219 | ``` | |
| 220 | ||
| 221 | That's it: the two copies above, then `./autorun.sh` | |
| 222 | ||
| 223 | Upon successful completion, it updates both the `text` and the `data` | |
| 224 | directories. The resulting `data/mpg-parse.rdb` will contain the MST | |
| 225 | disjuncts and marginals. | |
| 226 | ||
| 227 | It assumes that everything has been correctly configured. If it crashes, | |
| 228 | hangs, or if you're just antsy and need to see what's going on inside | |
| 229 | the container, just run | |
| 230 | ``` | |
| 231 | docker exec -it mst-counter-auto /bin/bash | |
| 232 | tmux attach | |
| 233 | ``` | |
| 234 | This will attach to the byobu/tmux session; the panel layout is | |
| 235 | identical to the manual-mode described above. | |
| 236 | ||
| 237 | ------ |
| … | … | @@ -0,0 +1,94 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # autorun.sh | |
| 4 | # | |
| 5 | # Fully-automated MST/MPG parsing. Assumes pair counting has been | |
| 6 | # done previously, and that both text and data files are in the | |
| 7 | # default locations. | |
| 8 | # | |
| 9 | # Creates a new container, if none exists, otherwise reuses an existing | |
| 10 | # container. Copies text data into it, performs MST counting, computes | |
| 11 | # marginals, and copies out the resulting dataset. | |
| 12 | # | |
| 13 | # Expects to find a text corpus in the `input-pages/pair-counted` directory. | |
| 14 | # Expects a database with word-pair marginals in `data/mst-parse.rdb` | |
| 15 | # | |
| 16 | # If used with the `-u` flag, then an existing container will be updated | |
| 17 | # with additional counting. Useful for splitting up large counting runs | |
| 18 | # into several stages. | |
| 19 | # | |
| 20 | # ----------------- | |
| 21 | ||
| 22 | MST_CONTAINER=mst-counter-auto | |
| 23 | TEXT_DIR=text | |
| 24 | DATA_DIR=data | |
| 25 | ||
| 26 | UPDATE=$1 | |
| 27 | ||
| 28 | if [[ -z "$(ls $TEXT_DIR)" ]]; then | |
| 29 | echo "Error: The $TEXT_DIR directory appears to be empty!" | |
| 30 | exit 1 | |
| 31 | fi | |
| 32 | ||
| 33 | if [[ -z "$(ls $DATA_DIR)" ]]; then | |
| 34 | echo "Error: The $DATA_DIR directory appears to be empty!" | |
| 35 | exit 1 | |
| 36 | fi | |
| 37 | ||
| 38 | # Avoid trashing current work. | |
| 39 | TAINER=`docker ps |grep $MST_CONTAINER |cut -f1 -d" "` | |
| 40 | if test x"$TAINER" != x; then | |
| 41 | echo "Container $MST_CONTAINER is already running!" | |
| 42 | echo "Running containers cannot be updated." | |
| 43 | echo "To stop the existing container, do this:" | |
| 44 | echo " docker stop -t 1 $MST_CONTAINER" | |
| 45 | echo "If you want a fresh container, then you must also do this:" | |
| 46 | echo " docker rm $MST_CONTAINER" | |
| 47 | exit 1 | |
| 48 | fi | |
| 49 | ||
| 50 | TAINER=`docker ps -a |grep $MST_CONTAINER |cut -f1 -d" "` | |
| 51 | if test x"$TAINER" == x; then | |
| 52 | # Start Fresh | |
| 53 | echo "Creating container $MST_CONTAINER" | |
| 54 | docker create --name $MST_CONTAINER -it opencog/lang-mst | |
| 55 | docker container cp $DATA_DIR/. $MST_CONTAINER:/home/opencog/data | |
| 56 | ||
| 57 | elif test x"$UPDATE" == x-u; then | |
| 58 | echo "Re-using existing container $MST_CONTAINER" | |
| 59 | else | |
| 60 | echo "The container $MST_CONTAINER already exists!" | |
| 61 | echo "If you want to update it with additional data," | |
| 62 | echo "then run this script with the -u flag." | |
| 63 | echo "If you want to start fresh, then remove it, like so:" | |
| 64 | echo " docker rm $MST_CONTAINER" | |
| 65 | exit 1 | |
| 66 | fi | |
| 67 | ||
| 68 | date | |
| 69 | docker container cp $TEXT_DIR/. $MST_CONTAINER:/home/opencog/text | |
| 70 | ||
| 71 | echo "Starting container $MST_CONTAINER" | |
| 72 | docker start $MST_CONTAINER | |
| 73 | docker exec -u 0 $MST_CONTAINER chown -R opencog:opencog /home/opencog/text | |
| 74 | docker exec -u 0 $MST_CONTAINER chown -R opencog:opencog /home/opencog/data | |
| 75 | docker exec -d $MST_CONTAINER /home/opencog/count-mst.sh | |
| 76 | sleep 10 | |
| 77 | ||
| 78 | echo "Waiting for MST counting to finish in container $MST_CONTAINER" | |
| 79 | echo "Caution: this may take hours, days or weeks!" | |
| 80 | echo "If you're nervous and can't stand the wait, try this:" | |
| 81 | echo " docker exec -it $MST_CONTAINER /bin/bash" | |
| 82 | echo " tmux attach" | |
| 83 | echo "and then prowl around in tmux with F3 and F4" | |
| 84 | echo "This script will not exit until all processing is done." | |
| 85 | ||
| 86 | docker exec $MST_CONTAINER /home/opencog/count-mst-done.sh | |
| 87 | ||
| 88 | echo "Done MST counting in container $MST_CONTAINER" | |
| 89 | ||
| 90 | echo "Copying MST dataset to $DATA_DIR" | |
| 91 | docker container cp $MST_CONTAINER:/home/opencog/data/. $DATA_DIR | |
| 92 | docker container cp $MST_CONTAINER:/home/opencog/text/. $TEXT_DIR | |
| 93 | echo "Done!" | |
| 94 | date |
| … | … | @@ -0,0 +1,6 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for opencog/lang-mst | |
| 4 | # | |
| 5 | docker build -t opencog/lang-mst . | |
| 6 | # docker build --no-cache -t opencog/lang-mst . |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | ||
| 2 | ")" "}" "]" ">" » 〉 ) 〕 》 】 ] 』 」 "’’" "’" '' ' | |
| 3 | "%" "," "." 。 ":" ";" "?" "!" ‽ ؟ ? ! … ... "”" "–" "‐" 、 ~ | |
| 4 | ¢ ₵ ™ ℠ : RPUNC+; | |
| 5 | ||
| 6 | "(" "{" "[" "<" « 〈 ( 〔 《 【 [ 『 「 `` „ “ ‘ '' ' … ... | |
| 7 | ¿ ¡ "$" | |
| 8 | £ ₤ € ¤ ₳ ฿ ₡ ₢ ₠ ₫ ৳ ƒ ₣ ₲ ₴ ₭ ₺ ℳ ₥ ₦ ₧ ₱ ₰ ₹ ₨ ₪ ﷼ ₸ ₮ ₩ ¥ ៛ 호점 | |
| 9 | † †† ‡ § ¶ © ® ℗ № "#": LPUNC+; |
| … | … | @@ -0,0 +1,19 @@ |
| 1 | Demo Atomese MST dictionary | |
| 2 | --------------------------- | |
| 3 | This is an example configuration for an AtomSpace-backed dictionary, | |
| 4 | configured for parsing using disjuncts that were mined from MST parses. | |
| 5 | Each disjunct is assigned a cost, based on it's MI. | |
| 6 | ||
| 7 | For general info about Link Grammar dictionaries running out of the | |
| 8 | AtomSpace, consult the Link Grammar documentation. | |
| 9 | ||
| 10 | * The `4.0.affix` file specifies punctuation that will be automatically | |
| 11 | split off of words. | |
| 12 | ||
| 13 | * The `storage.dict` file specifies assorted configuration data, | |
| 14 | including the location of MI data, and how to scale it to obtain | |
| 15 | LG-style "costs". | |
| 16 | ||
| 17 | Both of the above files are text files. To adjust the location of the | |
| 18 | dictionary, edit the `storage.dict` file and change the line that starts | |
| 19 | with `#define storage-node`. |
| … | … | @@ -0,0 +1,146 @@ |
| 1 | % | |
| 2 | % demo-dict-mpg -- Demo dictionary for disjunct parsing | |
| 3 | % | |
| 4 | % Configuration file for an Atomspace-based dictionary. It will use | |
| 5 | % disjunct data in the AtomSpace to perform (conventional) parsing. | |
| 6 | % If appropriate disjuncts cannot be found in the dictionary, (that is, | |
| 7 | % if a complete parse is not possible), then word-pairs will be used | |
| 8 | % to supplement the disjuncts. | |
| 9 | % | |
| 10 | % All config values can be left as-is; nothing here needs tweaking. | |
| 11 | % | |
| 12 | % See the `demo-atomese/storage.dict` file in the main Link Grammar | |
| 13 | % distribution for detailed documentation. | |
| 14 | ||
| 15 | % ----------------------- | |
| 16 | % Boilerplate: The dictionary is for English, the English locale | |
| 17 | % should be used, and a version number. | |
| 18 | ||
| 19 | #define dictionary-lang en; | |
| 20 | #define dictionary-locale en_US.UTF-8; | |
| 21 | #define dictionary-version-number 5.12.4; | |
| 22 | ||
| 23 | % Use a copy of the database; we assume the CogServer is running and | |
| 24 | % is using the "main" version. | |
| 25 | #define storage-node "(RocksStorageNode "rocks:///home/opencog/data/mpg-parse-copy.rdb")"; | |
| 26 | ||
| 27 | % Alternative: access the CogServer from outside the container: | |
| 28 | % #define storage-node "(CogStorageNode "cog://localhost:17003")"; | |
| 29 | ||
| 30 | % ----------------------- | |
| 31 | % Enable use of sections (disjuncts). | |
| 32 | #define enable-sections 1; | |
| 33 | ||
| 34 | % Decorate sections with extra pairs, to fill in for missing connectors. | |
| 35 | % Allow up to 2. Decorate sections with extra ANY connectors, as well. | |
| 36 | % High costs will make these unlikely to be used in parses. | |
| 37 | #define extra-pairs 2; | |
| 38 | #define extra-any 1; | |
| 39 | ||
| 40 | % Location where disjunct costs are stored. The cost will be obtained | |
| 41 | % from the floating point value located at the `cost-key` Value on the | |
| 42 | % Sections. It's assumed that this is a FloatValue, which is a vector; | |
| 43 | % the index specifies the location in this vector. | |
| 44 | #define cost-key "(Predicate "*-Mutual Info Key cover-section")"; | |
| 45 | #define cost-index 1; | |
| 46 | ||
| 47 | % If the value at the key+index above is less than this cutoff, | |
| 48 | % the Section will not be added to the local dictionary. | |
| 49 | % In this example, the raw cost is the MI, and MI of less than | |
| 50 | % 4 will be rejected. | |
| 51 | #define cost-cutoff 4.0; | |
| 52 | ||
| 53 | % Sections with a missing cost will be assigned this default. To | |
| 54 | % ignore sections with a missing cost, set it to some value less | |
| 55 | % than `cost-cutoff`. | |
| 56 | #define cost-default 4.01; | |
| 57 | ||
| 58 | % The cost used by LG will be a linear rescaling of the raw data above. | |
| 59 | % The rescaling is y=mx+b where m==`cost-scale` and b==`cost-offset` | |
| 60 | % and x== the value fished out of the vector above. | |
| 61 | % | |
| 62 | % The scale factor is negative, so as to flip the sign on the costs. | |
| 63 | % In the demo dictionary, the costs are provided by the MI, which is | |
| 64 | % "better", the more positive it is. The LG costs, however, are | |
| 65 | % "better" when they are smaller (less positive). Thus, a sign-flip | |
| 66 | % is called for. | |
| 67 | #define cost-scale -0.25; | |
| 68 | #define cost-offset 3.0; | |
| 69 | ||
| 70 | % Disjuncts with a cost larger than this will not be used during | |
| 71 | % parsing. This can be over-ridden with the !cost-max parser option. | |
| 72 | % This applies both to the available disjuncts, and the ones created | |
| 73 | % dynamically, from pairs. | |
| 74 | % | |
| 75 | % A disjunct can be supplemented with N=`extra-pairs` pairs. Each pair | |
| 76 | % can have a cost of at most 1.0. So it's reasonable to accept a max | |
| 77 | % disjunct cost of 3+2=5 | |
| 78 | #define max-disjunct-cost 5.0; | |
| 79 | ||
| 80 | % No more than this many disjuncts will be created for a word. If the | |
| 81 | % dictionary encodes for more than these, then disjuncts will be | |
| 82 | % selected randomly, to not exceed this limit. The selection is applied | |
| 83 | % after the above cost-max limit, and after some pre-pruning that avoids | |
| 84 | % the selection of disjuncts that cannot possibly be used. | |
| 85 | #define max-disjuncts 75000; | |
| 86 | ||
| 87 | % ----------------------- | |
| 88 | % Pair config. | |
| 89 | % | |
| 90 | % Novel sentences containing rarely-seen words might not be parsable, | |
| 91 | % even when the sections on them are decorated with extra connectors. | |
| 92 | % In this case, fall back to MST-style parsing, and create disjuncts | |
| 93 | % consisting of connectors obtained entirely from word-pairs. | |
| 94 | % | |
| 95 | % Allow disjuncts with up to two word-pair connectors. | |
| 96 | #define pair-disjuncts 2; | |
| 97 | ||
| 98 | % Location where pair MI values are stored. | |
| 99 | #define pair-predicate "(BondNode "ANY")"; | |
| 100 | #define pair-key "(Predicate "*-Mutual Info Key-*")"; | |
| 101 | #define pair-index 1; | |
| 102 | ||
| 103 | % For small dictionaries, an MI of zero or more should be allowed, as | |
| 104 | % otherwise there are just not enough pairs, and the ANY link starts | |
| 105 | % getting used. For larger dictionaries, an MI of 4 or larger makes | |
| 106 | % sense. | |
| 107 | #define pair-cutoff 0.0; | |
| 108 | ||
| 109 | % If there's no MI, just reject it. (Negative MI's are bad.) | |
| 110 | #define pair-default -10; | |
| 111 | ||
| 112 | % Map the MI interval [0,4] to [1,0]. Thus, any MI of more than 4 | |
| 113 | % gets a negative cost and encourages loop formation. Links with an | |
| 114 | % MI of less than 4 will get used, to "plug the hole", if there's | |
| 115 | % nothing better. | |
| 116 | #define pair-scale -0.25; | |
| 117 | #define pair-offset 1.0; | |
| 118 | ||
| 119 | % Keep in mind that the parser ranks parses from lowest to highest cost. | |
| 120 | % If word-pair links have a negative cost, the parser is incentivized to | |
| 121 | % add as many of these as possible, while still resulting in a planar | |
| 122 | % graph with many loops. Viz, "Maximal Planar Graphs" (MPG). Conversely, | |
| 123 | % if word-pair links have a positive cost, Minimal Spanning Trees (MST) | |
| 124 | % will be created (minimizing the total cost.) | |
| 125 | ||
| 126 | % Enable supplementation of pure pair-only disjuncts with "ANY" links. | |
| 127 | #define pair-with-any 1; | |
| 128 | ||
| 129 | % Default cost for `ANY` link types. The `ANY` link type is meant to | |
| 130 | % provide a desperate, last-chance opportunity to link to a word that | |
| 131 | % cannot otherwise link with disjuncts or word-pairs. It is given a | |
| 132 | % high cost, so that it is not used when other links are available. | |
| 133 | #define any-default 2.6; | |
| 134 | ||
| 135 | % Enable expressions that consist entirely of "ANY" link-types. | |
| 136 | #define any-disjuncts 1; | |
| 137 | ||
| 138 | % Enable the automatic generation of <UNKNOWN-WORD>. It will be | |
| 139 | % automatically added to the dictionary, with multi-ANY connectors | |
| 140 | % on it. The ANY connectors will be used, irresepctive of the other | |
| 141 | % `any` setting above. | |
| 142 | #define enable-unknown-word 1; | |
| 143 | ||
| 144 | % ----------------------- | |
| 145 | % Bogus entry. Cannot be empty. | |
| 146 | foo: UNITS+; |
| … | … | @@ -0,0 +1,22 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | # ./stop.sh | |
| 6 | ||
| 7 | MST_CONTAINER=mst-counter | |
| 8 | ||
| 9 | TAINER=`docker ps |grep $MST_CONTAINER |cut -f1 -d" "` | |
| 10 | if test x"$TAINER" != x; then | |
| 11 | echo "Container $MST_CONTAINER already running! Attaching to it..." | |
| 12 | # docker stop -t 1 $TAINER | |
| 13 | docker exec -it $MST_CONTAINER /bin/bash | |
| 14 | else | |
| 15 | STAINER=`docker ps -a |grep $MST_CONTAINER |cut -f1 -d" "` | |
| 16 | if test x"$STAINER" != x; then | |
| 17 | echo "Container $MST_CONTAINER already exists! Starting it..." | |
| 18 | else | |
| 19 | docker create --name $MST_CONTAINER -p 17003:17003 -it opencog/lang-mst | |
| 20 | fi | |
| 21 | docker start -i $MST_CONTAINER | |
| 22 | fi |
| … | … | @@ -0,0 +1,23 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # count-mst-done.sh | |
| 4 | # | |
| 5 | # Wait until MST counting and marginals computation is done, | |
| 6 | # and then stop the docker container. | |
| 7 | # | |
| 8 | # ----------- | |
| 9 | ||
| 10 | sleep 60 | |
| 11 | ||
| 12 | # Wait for evidence that marginals have been computed. | |
| 13 | while [[ ! -f /tmp/mst-marginals-done ]] ; do | |
| 14 | sleep 60 | |
| 15 | done | |
| 16 | ||
| 17 | # Shut down the tmux session. | |
| 18 | tmux kill-session | |
| 19 | ||
| 20 | # Stop the main entry point. We would like to do `kill -9 1` but | |
| 21 | # docker does not allow PID 1 to be killed. But PID 1 is just | |
| 22 | # running /bin/sh bash so once bash exits, then so will PID 1. | |
| 23 | pkill -9 bash |
| … | … | @@ -0,0 +1,37 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # count-mst.sh | |
| 4 | # | |
| 5 | # Fully-automated MST counting, specialized for the current | |
| 6 | # Docker setup. | |
| 7 | # ----------------- | |
| 8 | ||
| 9 | # Fix up ownership of the data files | |
| 10 | sudo chown -R opencog:opencog text | |
| 11 | sudo chown -R opencog:opencog data | |
| 12 | ||
| 13 | # Everything we need has already been set up in run-1. | |
| 14 | # Leave it as-is, in case the user wants to experiment there. | |
| 15 | # Do the actual MST counting in run-3. | |
| 16 | # Avoid confusion by removing the config for earlier and later stages. | |
| 17 | cd ~/experiments/ | |
| 18 | cp -pr run-1 run-3 | |
| 19 | cd run-3 | |
| 20 | rm -f 2-pair-conf.sh 4-gram-conf.sh | |
| 21 | ||
| 22 | # Use the default configuration. | |
| 23 | source 0-pipeline.sh | |
| 24 | source 3-mpg-conf.sh | |
| 25 | ||
| 26 | # Remove scripts for earlier and later stages (avoid confusion) | |
| 27 | cd run | |
| 28 | rm -rf 2-word-pairs 4-gram-class | |
| 29 | ||
| 30 | # Remove semaphore, just in case. | |
| 31 | rm -f /tmp/mst-marginals-done | |
| 32 | ||
| 33 | # Run the MST counting pipeline in byobu. | |
| 34 | cd 3-mst-parsing | |
| 35 | ./run-all-mst.sh | |
| 36 | ||
| 37 | echo "Done MST counting. Good bye!" |
| … | … | @@ -0,0 +1,23 @@ |
| 1 | # | |
| 2 | # Container for word-pair counting; both demo and fully-automated. | |
| 3 | # | |
| 4 | FROM opencog/learn:latest | |
| 5 | ||
| 6 | USER opencog | |
| 7 | WORKDIR /home/opencog | |
| 8 | ||
| 9 | # Install a very simple pair visualizer. | |
| 10 | RUN mkdir src && cd src && git clone https://github.com/opencog/cogprotolab.git | |
| 11 | RUN sudo chown opencog:opencog /var/www/html/ | |
| 12 | RUN sudo cp -pr src/cogprotolab/vis-word-pairs/* /var/www/html/ | |
| 13 | ||
| 14 | # Set up the basic working directories | |
| 15 | RUN ./setup-for-experiments.sh | |
| 16 | ||
| 17 | # Copy in the fully-automated pair-counter. | |
| 18 | COPY --chown=opencog:opencog /scripts/ . | |
| 19 | COPY --chown=opencog:opencog /demo-dict-pair/ demo-dict-pair | |
| 20 | ||
| 21 | CMD /bin/bash | |
| 22 | ||
| 23 | ONBUILD USER root |
| … | … | @@ -0,0 +1,262 @@ |
| 1 | lang-pairs | |
| 2 | ---------- | |
| 3 | This container provides a basic demo, together with a fully automated | |
| 4 | script, for counting of word-pairs in text. It consist of three parts: | |
| 5 | ||
| 6 | * A tutorial demonstrating word-pair counting using the | |
| 7 | [language learning](https://github.com/opencog/learn/) pipeline. | |
| 8 | * A script that fully automates the processing of text for pair-counting. | |
| 9 | * A simple web-based visualizer for the resulting dataset. | |
| 10 | ||
| 11 | Nearby word-pairs are sampled from input text, and a count is maintained | |
| 12 | for how often they are seen. These counts are recorded in the AtomSpace, | |
| 13 | and written to a persistent database: the RocksB `StorageNode`. This | |
| 14 | database can be reopened at a later time, without having to redo | |
| 15 | counting. | |
| 16 | ||
| 17 | Given observed frequencies of word-pairs, the mutual information | |
| 18 | between them can be calculated. See Wikipedia, | |
| 19 | [pointwise mutual information](https://en.wikipedia.org/wiki/Pointwise_mutual_information). | |
| 20 | After counting, batch scripts compute this (see instructions below). | |
| 21 | After these are computed, an Apache webserver is started inside this | |
| 22 | container. Using a web browser to access it will bring up a simple | |
| 23 | word-pair visualizer. | |
| 24 | ||
| 25 | The demo can take half-a-day or several days (or longer) to run, | |
| 26 | depending on the quantity of input text. It will need 4 to 12GB of RAM, | |
| 27 | again, depending on the text. | |
| 28 | ||
| 29 | This demos only the very first step of a much longer and more complicated | |
| 30 | learning system. That system aims to extract syntactic and semantic | |
| 31 | structure from arbitrary data (not just text). The second step can be | |
| 32 | found in the [`lang-mst`](../lang-mst) directory. Docker demos for | |
| 33 | later stages will be set up "any day now" (The expression "any day now" | |
| 34 | is a sarcastic remark, popular in Texas, meaning "not soon". | |
| 35 | The learning system is a work in progress, and is unstable.) | |
| 36 | ||
| 37 | A beginning user should run the demo "manually" the first time, in order | |
| 38 | to get familiar with the basic steps. Instructions for a fully automated | |
| 39 | script are at the very end of this file. | |
| 40 | ||
| 41 | Basic Setup | |
| 42 | ----------- | |
| 43 | 0. Install docker, if you have not already done so: | |
| 44 | `sudo apt install docker.io` | |
| 45 | 1. Run `../docker-build.sh -a` and `../docker-build.sh -l` to build | |
| 46 | the pre-requisite containers. | |
| 47 | 2. Create this Docker image: | |
| 48 | ``` | |
| 49 | docker build -t opencog/lang-pairs . | |
| 50 | ``` | |
| 51 | 3. Create a container (an instance of the image): | |
| 52 | `docker create --name pair-counter -p 8080:80 -p 17002:17002 -p 18082:18082 -it opencog/lang-pairs` | |
| 53 | Note: the `-p` flag is `external_port:internal_port`. The first flag | |
| 54 | exposes the internal webserver on `localhost:8080` and the second | |
| 55 | flag exposes the CogServer to the outside world. The third exposes | |
| 56 | the CogServer WebSockets port; usefule for visualization. | |
| 57 | ||
| 58 | 4. Copy your input text files into the container, using the | |
| 59 | `docker container cp` command. The default configuration expects | |
| 60 | these files in the `text/input-pages` directory. For example: | |
| 61 | ``` | |
| 62 | docker container cp some-book.txt pair-counter:/home/opencog/text/input-pages | |
| 63 | ``` | |
| 64 | You can place multiple files into arbitrary subdirectories; all | |
| 65 | files and subdirectories will be explored during counting. | |
| 66 | For more info about docker copy, see the | |
| 67 | [docker container docs](https://docs.docker.com/engine/reference/commandline/container/). | |
| 68 | ||
| 69 | Configuration | |
| 70 | ------------- | |
| 71 | Get familiar with the general outlines of the configuration files | |
| 72 | and scripting system. | |
| 73 | ||
| 74 | 1. Start the container: `docker start -i pair-counter` | |
| 75 | This will drop you into a shell prompt inside the container. | |
| 76 | 2. Change ownership of the input text files. Run | |
| 77 | `sudo chown -R opencog:opencog text` ***IMPORTANT! Don't forget to do this!*** | |
| 78 | 3. `cd ~/experiments/run-1` | |
| 79 | 4. Review the config files; change if desired. The defaults are fine | |
| 80 | for an initial run. Later on, you can copy them to | |
| 81 | `experiments/run-2`, `experiments/run-3` and so on, for modified | |
| 82 | extended runs. | |
| 83 | 5. `source 0-pipeline.sh` # Load environment variables from config file. | |
| 84 | 6. `run/run-tmux.sh` # Set up multiple byobu terminals. | |
| 85 | 7. Review the [language-learning project](https://github.com/opencog/learn) | |
| 86 | README's and follow instructions there ... | |
| 87 | ||
| 88 | OK, so those instructions are overwhelming. The next section provides | |
| 89 | a simplified digest, just enough to get the basics for word-pairs | |
| 90 | running. | |
| 91 | ||
| 92 | Manual Counting | |
| 93 | --------------- | |
| 94 | First-time users should follow these instructions. | |
| 95 | ||
| 96 | A. Go to the `cogsrv` tab, and run `run/2-word-pairs/run-cogserver.sh` | |
| 97 | ||
| 98 | B. Go to the `telnet` tab, and run `rlwrap telnet localhost 17002` | |
| 99 | Then run `help` in the cogserver shell and get oriented. | |
| 100 | Then run `top` in the cogserver shell, to see the stats. | |
| 101 | ||
| 102 | C. Go to the `submit` tab, and run `run/2-word-pairs/pair-submit.sh` | |
| 103 | ||
| 104 | D. Go to the `cogsrv` tab, and poke around in the AtomSpace, as | |
| 105 | desired. It will take a while for processing to complete. So, | |
| 106 | for example, as you wait, you can look at the Atoms piling up: | |
| 107 | ``` | |
| 108 | (cog-report-counts) | |
| 109 | ``` | |
| 110 | E. Go to the `telnet` tab, and wait until the telnet stats clear ... | |
| 111 | This may take hours or days, depending on the dataset. | |
| 112 | Basically, the system is busy chewing on the data files, and the | |
| 113 | stats report remains busy until that work is done. | |
| 114 | Each file in `~/text/input-pages` is moved to ~/text/pair-counted` | |
| 115 | after it has been submitted. Thus, you can track progress by comparing | |
| 116 | `find ~/text/input-pages/ |wc` to `find ~/text/pair-counted/ |wc`. | |
| 117 | ||
| 118 | XXX below is auto done already?? | |
| 119 | ||
| 120 | F. Go to the `cogsrv` tab, and perform batch MI calculations. | |
| 121 | This may take minutes or hours, depending on the dataset. | |
| 122 | It is best not to start these until counting is done. | |
| 123 | ``` | |
| 124 | (define ala (make-any-link-api)) | |
| 125 | (define aca (add-count-api ala)) | |
| 126 | (define asa (add-pair-stars aca)) | |
| 127 | (batch-all-pair-mi asa) | |
| 128 | (print-matrix-summary-report asa) | |
| 129 | ``` | |
| 130 | ||
| 131 | G. That's it! The word-pair dataset is now complete. It can now be | |
| 132 | browsed in two different ways: with a web browser, looking at the | |
| 133 | pairs directly, or with the Link Grammar parser, which will use | |
| 134 | it to create MST parses. | |
| 135 | ||
| 136 | Web Demo | |
| 137 | -------- | |
| 138 | The web demo allows the word-pair dataset to be browsed "directly", | |
| 139 | using a web graph visualization package. | |
| 140 | ||
| 141 | 1. Go to the `cntl` tab and run `sudo service apache2 start` | |
| 142 | ||
| 143 | 2. Go to the `cogsrv` tab, load the browser navigation support: | |
| 144 | ``` | |
| 145 | (load "/home/opencog/src/cogprotolab/run-word-pairs/scm/navigate.scm") | |
| 146 | (define pair-stars asa) | |
| 147 | (define pair-freq (add-pair-freq-api pair-stars)) | |
| 148 | (define (pair-score EDGE) (pair-freq 'pair-fmi EDGE)) | |
| 149 | (define pair-nav | |
| 150 | (make-nav pair-stars 'right-duals 'left-duals pair-score 10)) | |
| 151 | ``` | |
| 152 | ||
| 153 | 3. Verify that the above is not insane. The following should print | |
| 154 | plausible results: | |
| 155 | ``` | |
| 156 | (pair-freq 'left-wild-fmi (Word "the")) | |
| 157 | (pair-nav 'forward (Word "the")) | |
| 158 | (pair-nav 'edge-score (Word "the") (Word "door")) | |
| 159 | ``` | |
| 160 | ||
| 161 | 4. On your local machine, connect to the webserver, using the port 8080 | |
| 162 | specified on `docker create` line above: | |
| 163 | ``` | |
| 164 | http://localhost:8080/ | |
| 165 | ``` | |
| 166 | or | |
| 167 | ``` | |
| 168 | http://172.17.0.1:8080/ | |
| 169 | ``` | |
| 170 | where `172.17.0.1` is the Docker container IP address; will vary, | |
| 171 | in general. | |
| 172 | ||
| 173 | Link Parser Demo | |
| 174 | ---------------- | |
| 175 | The word-pair database can be used by the Link Grammar parser to create | |
| 176 | Minimum Spanning Tree (MST) parses. These are parses where the links | |
| 177 | between words correspond to word-pairs that have appeared in the database. | |
| 178 | The parsing is done so as to minimize the total cost; equivalently, to | |
| 179 | maximize the total MI of all word-pairs used in the parse. (By design, | |
| 180 | the LG parser always minimizes costs; thus, the LG dictionary config file | |
| 181 | maps MI values to minus costs.) | |
| 182 | ||
| 183 | 1. The RocksDB database can only be used by one user at a time, and so, | |
| 184 | because the CogServer is already using the database, a copy must be | |
| 185 | made. Go to the `spare` tab, and | |
| 186 | ``` | |
| 187 | cd ~/data | |
| 188 | cp -pr word-pairs.rdb word-pairs-copy.rdb | |
| 189 | ``` | |
| 190 | ||
| 191 | 2. Start the Link Grammar parser, using the demo dictionary provided. | |
| 192 | This dictionary hard-codes the `word-pairs-copy.rdb` file location | |
| 193 | in it. | |
| 194 | ``` | |
| 195 | link-parser demo-dict-pair | |
| 196 | ``` | |
| 197 | ||
| 198 | 3. Type in any sentence you wish. If the words appear in the dataset, | |
| 199 | the sentence will parse. The parse is only as accurate as MST parses | |
| 200 | can be: in general, they are "OK", but not great. | |
| 201 | ||
| 202 | ||
| 203 | Development Tips | |
| 204 | ---------------- | |
| 205 | After pair-counting is completed, the easiest way to restart the | |
| 206 | CogServer is to invoke `run-common/cogserver-mst.scm`. This loads | |
| 207 | all word-pairs into the AtomSpace, and then provides a guile prompt | |
| 208 | to poke around in (It does NOT do any MST processing beyond loading | |
| 209 | the pairs.) | |
| 210 | ||
| 211 | ||
| 212 | Semi-automated Counting | |
| 213 | ----------------------- | |
| 214 | Most of the above has been condensed into a single script. | |
| 215 | ||
| 216 | 1. Start the container: `docker start -i pair-counter` | |
| 217 | This will drop you into a shell prompt inside the container. | |
| 218 | 2. (Optional) Review the config files; change if desired. The defaults | |
| 219 | are fine. | |
| 220 | 3. Run the `/home/opencog/count-pairs.sh` shell script. This will start | |
| 221 | the same tmux/byobu system as the manual instructions above, except | |
| 222 | that this time, all the various servers will be started | |
| 223 | automatically. Progress can be monitored as described above. | |
| 224 | 4. The shutdown is currently NOT automated. This allows you to review | |
| 225 | results, before shutting everything down. If satisfied, close the | |
| 226 | `tmux` session with | |
| 227 | ``` | |
| 228 | tmux kill-session | |
| 229 | ``` | |
| 230 | 5. The word-pair visualizer setup is *not* automated. If you also want | |
| 231 | that, you'll have the follow the last part of the manual instructions | |
| 232 | above. | |
| 233 | 6. The next step is MST counting; this is handled in the `lang-mst` | |
| 234 | docker image. You will need to save the database of results, in the | |
| 235 | `data/word-pairs.rdb` directory. Copy it out of the container: | |
| 236 | ``` | |
| 237 | docker container cp pair-counter:/home/opencog/data/word_pairs.rdb /your/favorite/place/for/data/ | |
| 238 | ``` | |
| 239 | This copy can be done before or after shutting down the container. | |
| 240 | ||
| 241 | 7. (Optional) During counting, the input text corpus was copied, file by | |
| 242 | file, to `text/pair-counted`, as each file was submitted for | |
| 243 | counting. These will be needed for the next stage, and you can | |
| 244 | minimize confusion by just saving this, as well. | |
| 245 | ``` | |
| 246 | docker container cp pair-counter:/home/opencog/text/pair-counted /your/favorite/place/for/text/ | |
| 247 | ``` | |
| 248 | ||
| 249 | Fully-automated Counting | |
| 250 | ------------------------ | |
| 251 | This can be fully automated. It assumes everything above is configured | |
| 252 | and is working. | |
| 253 | ||
| 254 | 1. Place a copy of the input text corpus in the `input-pages` directory. | |
| 255 | 2. Run `autorun.sh` | |
| 256 | 3. Wait until done. | |
| 257 | ||
| 258 | To process additional text in an existing container, place the new text | |
| 259 | into the `input-pages` directory, and run `autorun.sh -u`. Be sure to | |
| 260 | remove the earlier text, as otherwise it will be reprocessed a second time. | |
| 261 | ||
| 262 | ---- |
| … | … | @@ -0,0 +1,86 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # autorun.sh | |
| 4 | # | |
| 5 | # Fully-automated word-pair counting. Creates a new container, if none | |
| 6 | # exists. Copies text data into it, performs pair-counting, computes | |
| 7 | # marginals, and copies out the resulting dataset. | |
| 8 | # | |
| 9 | # Expects to find a text corpus in the `input-pages` directory. | |
| 10 | # | |
| 11 | # If used with the `-u` flag, then an existing container will be updated | |
| 12 | # with additional counting. Useful for splitting up large word-pair | |
| 13 | # counting runs into several stages. | |
| 14 | # | |
| 15 | # ----------------- | |
| 16 | ||
| 17 | # INPUT_DIR must match `run-config/2-pair-conf.sh` | |
| 18 | INPUT_DIR=input-pages | |
| 19 | TEXT_DIR=text | |
| 20 | DATA_DIR=data | |
| 21 | ||
| 22 | PAIR_CONTAINER=pair-counter-auto | |
| 23 | UPDATE=$1 | |
| 24 | ||
| 25 | if [[ -z "$(ls $INPUT_DIR)" ]]; then | |
| 26 | echo "Error: You forgot to put an input corpus into the $INPUT_DIR directory!" | |
| 27 | exit 1 | |
| 28 | fi | |
| 29 | ||
| 30 | # Avoid trashing current work. | |
| 31 | TAINER=`docker ps |grep $PAIR_CONTAINER |cut -f1 -d" "` | |
| 32 | if test x"$TAINER" != x; then | |
| 33 | echo "Container $PAIR_CONTAINER is already running!" | |
| 34 | echo "Running containers cannot be updated." | |
| 35 | echo "To stop the existing container, do this:" | |
| 36 | echo " docker stop -t 1 $PAIR_CONTAINER" | |
| 37 | echo "If you want a fresh container, then you must also do this:" | |
| 38 | echo " docker rm $PAIR_CONTAINER" | |
| 39 | exit 1 | |
| 40 | fi | |
| 41 | ||
| 42 | TAINER=`docker ps -a |grep $PAIR_CONTAINER |cut -f1 -d" "` | |
| 43 | if test x"$TAINER" == x; then | |
| 44 | # Start Fresh | |
| 45 | echo "Creating container $PAIR_CONTAINER" | |
| 46 | docker create --name $PAIR_CONTAINER -it opencog/lang-pairs | |
| 47 | elif test x"$UPDATE" == x-u; then | |
| 48 | echo "Re-using existing container $PAIR_CONTAINER" | |
| 49 | else | |
| 50 | echo "The container $PAIR_CONTAINER already exists!" | |
| 51 | echo "If you want to update it with additional pair data," | |
| 52 | echo "then run this script with the -u flag." | |
| 53 | echo "If you want to start fresh, then remove it, like so:" | |
| 54 | echo " docker rm $PAIR_CONTAINER" | |
| 55 | exit 1 | |
| 56 | fi | |
| 57 | ||
| 58 | date | |
| 59 | ||
| 60 | # Copy $INPUT_DIR as a whole. Note that `run-config/2-pair-conf.sh` | |
| 61 | # expects input located at `input-pages` and `run-config/0-pipeline.sh` | |
| 62 | # sets the basedir to `/home/opencog/text/` | |
| 63 | docker container cp $INPUT_DIR $PAIR_CONTAINER:/home/opencog/text/ | |
| 64 | ||
| 65 | echo "Starting container $PAIR_CONTAINER" | |
| 66 | docker start $PAIR_CONTAINER | |
| 67 | docker exec -u 0 $PAIR_CONTAINER chown -R opencog:opencog /home/opencog/text | |
| 68 | docker exec -d $PAIR_CONTAINER /home/opencog/count-pairs.sh | |
| 69 | sleep 10 | |
| 70 | ||
| 71 | echo "Waiting for pair counting to finish in container $PAIR_CONTAINER" | |
| 72 | echo "Caution: this may take hours, days or weeks!" | |
| 73 | echo "If you're nervous and can't stand the wait, try this:" | |
| 74 | echo " docker exec -it $PAIR_CONTAINER /bin/bash" | |
| 75 | echo " tmux attach" | |
| 76 | echo "and then prowl around in tmux with F3 and F4" | |
| 77 | ||
| 78 | docker exec $PAIR_CONTAINER /home/opencog/count-pairs-done.sh | |
| 79 | ||
| 80 | echo "Done pair counting in container $PAIR_CONTAINER" | |
| 81 | ||
| 82 | echo "Copying word-pairs dataset to $DATA_DIR" | |
| 83 | docker container cp $PAIR_CONTAINER:/home/opencog/text/. $TEXT_DIR | |
| 84 | docker container cp $PAIR_CONTAINER:/home/opencog/data/. $DATA_DIR | |
| 85 | echo "Done!" | |
| 86 | date |
| … | … | @@ -0,0 +1,6 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for opencog/lang-pairs | |
| 4 | # | |
| 5 | docker build -t opencog/lang-pairs . | |
| 6 | # docker build --no-cache -t opencog/lang-pairs . |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | ||
| 2 | ")" "}" "]" ">" » 〉 ) 〕 》 】 ] 』 」 "’’" "’" '' ' | |
| 3 | "%" "," "." 。 ":" ";" "?" "!" ‽ ؟ ? ! … ... "”" "–" "‐" 、 ~ | |
| 4 | ¢ ₵ ™ ℠ : RPUNC+; | |
| 5 | ||
| 6 | "(" "{" "[" "<" « 〈 ( 〔 《 【 [ 『 「 `` „ “ ‘ '' ' … ... | |
| 7 | ¿ ¡ "$" | |
| 8 | £ ₤ € ¤ ₳ ฿ ₡ ₢ ₠ ₫ ৳ ƒ ₣ ₲ ₴ ₭ ₺ ℳ ₥ ₦ ₧ ₱ ₰ ₹ ₨ ₪ ﷼ ₸ ₮ ₩ ¥ ៛ 호점 | |
| 9 | † †† ‡ § ¶ © ® ℗ № "#": LPUNC+; |
| … | … | @@ -0,0 +1,16 @@ |
| 1 | Demo Atomese word-pair dictionary | |
| 2 | --------------------------------- | |
| 3 | This is an example configuration for an AtomSpace-backed dictionary, | |
| 4 | configured for parsing using word-pair MI data. The resulting parses | |
| 5 | are Maximum Planar Graph parses: parses that draw links between words | |
| 6 | in such a way as to maximize the MI between word-pairs. | |
| 7 | ||
| 8 | For general info about Link Grammar dictionaries running out of the | |
| 9 | AtomSpace, consult the Link Grammar documentation. | |
| 10 | ||
| 11 | * The `4.0.affix` file specifies punctuation that will be automatically | |
| 12 | split off of words. | |
| 13 | ||
| 14 | * The `storage.dict` file specifies assorted configuration data, | |
| 15 | including the location of MI data, and how to scale it to obtain | |
| 16 | LG-style "costs". |
| … | … | @@ -0,0 +1,103 @@ |
| 1 | % | |
| 2 | % demo-dict-pair -- Demo dictionary for MST/MPG parsing. | |
| 3 | % | |
| 4 | % Configuration file for an Atomspace-based dictionary. It will use | |
| 5 | % word-pair data in the AtomSpace to perform MST/MPG parsing. If | |
| 6 | % word pairs are missing to complete a parse, then random word-pairs | |
| 7 | % will be used to fill in. | |
| 8 | % | |
| 9 | % All config values can be left as-is; nothing here needs tweaking. | |
| 10 | % | |
| 11 | % See the `demo-atomese/storage.dict` file in the main Link Grammar | |
| 12 | % distribution for detailed documentation. | |
| 13 | ||
| 14 | % ----------------------- | |
| 15 | % Boilerplate: The dictionary is for English, the English locale | |
| 16 | % should be used, and a version number. | |
| 17 | ||
| 18 | #define dictionary-lang en; | |
| 19 | #define dictionary-locale en_US.UTF-8; | |
| 20 | #define dictionary-version-number 5.12.4; | |
| 21 | ||
| 22 | % Use a copy of the database; we assume the CogServer is running and | |
| 23 | % is using the "main" version. Use MonoStorage instead of RocksSotrage, | |
| 24 | % its simpler, maybe faster. If this throws "Unsupported DB version '2'" | |
| 25 | % then comment this out, and use Rocks below. | |
| 26 | #define storage-node "(MonoStorage "monospace:///home/opencog/data/word-pairs-copy.rdb")"; | |
| 27 | % #define storage-node "(RocksStorage "rocks:///home/opencog/data/word-pairs-copy.rdb")"; | |
| 28 | ||
| 29 | % ----------------------- | |
| 30 | % Disable use of sections (disjuncts). | |
| 31 | #define enable-sections 0; | |
| 32 | ||
| 33 | % ----------------------- | |
| 34 | % Pair config. | |
| 35 | % | |
| 36 | % Create expressions that consist entirely of word-pair relationships. | |
| 37 | % Default of up to four connectors. | |
| 38 | #define pair-disjuncts 4; | |
| 39 | ||
| 40 | % Location where MI values are stored. | |
| 41 | #define pair-predicate "(BondNode "ANY")"; | |
| 42 | #define pair-key "(Predicate "*-Mutual Info Key-*")"; | |
| 43 | #define pair-index 1; | |
| 44 | ||
| 45 | % For small dictionaries, and MI or zero or more is needed, as | |
| 46 | % otherwise there are just not enough pairs, and the ANY link starts | |
| 47 | % getting uses. For larger dictionaries, an MI of 4 or larger makes | |
| 48 | % sense. | |
| 49 | #define pair-cutoff 0.0; | |
| 50 | ||
| 51 | % If there's no MI, just reject it. | |
| 52 | #define pair-default -10; | |
| 53 | ||
| 54 | % Map the MI interval [0,4] to [1,0]. Thus, any MI of more than 4 | |
| 55 | % gets a negative cost and encourages loop formation. Links with an | |
| 56 | % MI of less than 4 will get used, to "plug the hole", if there's | |
| 57 | % nothing better. | |
| 58 | #define pair-scale -0.25; | |
| 59 | #define pair-offset 1.0; | |
| 60 | ||
| 61 | % Keep in mind that the parser ranks parses from lowest to highest cost. | |
| 62 | % If word-pair links have a negative cost, the parser is incentivized to | |
| 63 | % add as many of these as possible, while still resulting in a planar | |
| 64 | % graph with many loops. Viz, "Maximal Planar Graphs" (MPG). Conversely, | |
| 65 | % if word-pair links have a positive cost, Minimal Spanning Trees (MST) | |
| 66 | % will be created (minimizing the total cost.) | |
| 67 | ||
| 68 | % A disjunct can consist of 4 pairs. Each pair can have a cost of at | |
| 69 | % most 1.0. So we have to accept a max disjunct cost of at least 4. | |
| 70 | #define max-disjunct-cost 4.5; | |
| 71 | ||
| 72 | % Supplement the above with additional connectors of type "ANY". | |
| 73 | % This has no effect, if `pair-disjuncts` is set to zero. | |
| 74 | #define pair-with-any 1; | |
| 75 | ||
| 76 | % Default cost for `ANY` link types. The `ANY` link type is meant to | |
| 77 | % provide a desperate, last-chance opportunity to link to a word that | |
| 78 | % does not appear in any disjuncts or word-pairs. Thus, its given some | |
| 79 | % high cost, so that it is not used when other links are available. | |
| 80 | % | |
| 81 | % Setting it to 1.6 allows two of them to be used to form a disjjunct. | |
| 82 | % If three are used, then this gets past the max-disjunct-cost. | |
| 83 | #define any-default 1.6; | |
| 84 | ||
| 85 | % Create expressions that consist entirely of "ANY" link-types. | |
| 86 | #define any-disjuncts 0; | |
| 87 | ||
| 88 | % Enable the automatic generation of <UNKNOWN-WORD>. It will be | |
| 89 | % automatically added to the dictionary, with multi-ANY connectors | |
| 90 | % on it. The ANY connectors will be used, irresepctive of the other | |
| 91 | % `any` setting above. | |
| 92 | #define enable-unknown-word 1; | |
| 93 | ||
| 94 | % No more than this many disjuncts will be created for a word. If the | |
| 95 | % dictionary encodes for more than these, then disjuncts will be | |
| 96 | % selected randomly, to not exceed this limit. The selection is applied | |
| 97 | % after the above cost-max limit, and after some pre-pruning that avoids | |
| 98 | % the selection of disjuncts that cannot possibly be used. | |
| 99 | #define max-disjuncts 75000; | |
| 100 | ||
| 101 | % ----------------------- | |
| 102 | % Bogus entry. Cannot be empty. | |
| 103 | foo: UNITS+; |
| … | … | @@ -0,0 +1,11 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | # ./stop.sh | |
| 6 | ||
| 7 | # The -p flag is external_port:internal_port | |
| 8 | docker create --name pair-counter -p 8080:80 -p 17002:17002 -it opencog/lang-pairs | |
| 9 | docker start -i pair-counter | |
| 10 | ||
| 11 | clear |
| … | … | @@ -0,0 +1,23 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # count-pairs-done.sh | |
| 4 | # | |
| 5 | # Wait until pair-counting and marginals computation is done, | |
| 6 | # and then stop the docker container. | |
| 7 | # | |
| 8 | # ----------- | |
| 9 | ||
| 10 | sleep 60 | |
| 11 | ||
| 12 | # Wait for evidence that marginals have been computed. | |
| 13 | while [[ ! -f /tmp/pair-marginals-done ]] ; do | |
| 14 | sleep 60 | |
| 15 | done | |
| 16 | ||
| 17 | # Shut down the tmux session. | |
| 18 | tmux kill-session | |
| 19 | ||
| 20 | # Stop the main entry point. We would like to do `kill -9 1` but | |
| 21 | # docker does not allow PID 1 to be killed. But PID 1 is just | |
| 22 | # running /bin/sh bash so once bash exits, then so will PID 1. | |
| 23 | pkill -9 bash |
| … | … | @@ -0,0 +1,33 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # count-pairs.sh | |
| 4 | # | |
| 5 | # Fully-automated word-pair counting, specialized for the current | |
| 6 | # Docker setup. | |
| 7 | # ----------------- | |
| 8 | ||
| 9 | # Everything we need has been copied into run-1. | |
| 10 | # Leave it as is, for the user to experiment in. | |
| 11 | # Do the actual work in run-2. | |
| 12 | # Avoid confusion by removing the config for the later stages. | |
| 13 | cd ~/experiments/ | |
| 14 | cp -pr run-1 run-2 | |
| 15 | cd run-2 | |
| 16 | rm -f 3-mpg-conf.sh 4-gram-conf.sh | |
| 17 | ||
| 18 | # Use the default configuration. | |
| 19 | source 0-pipeline.sh | |
| 20 | source 2-pair-conf.sh | |
| 21 | ||
| 22 | # Remove scripts for later stages (avoid confusion) | |
| 23 | cd run | |
| 24 | rm -rf 3-mst-parsing 4-gram-class | |
| 25 | ||
| 26 | # Remove semaphore, just in case. | |
| 27 | rm -f /tmp/pair-marginals-done | |
| 28 | ||
| 29 | # Run the pair-counting pipeline in byobu. | |
| 30 | cd 2-word-pairs | |
| 31 | ./run-all.sh | |
| 32 | ||
| 33 | echo "Done word-pair counting. Good bye!" |
| … | … | @@ -0,0 +1,30 @@ |
| 1 | # | |
| 2 | # Container with core learning repos. No data. | |
| 3 | # | |
| 4 | ARG OS_VERSION=latest | |
| 5 | ARG BASE_IMAGE=opencog/atomspace:${OS_VERSION} | |
| 6 | FROM ${BASE_IMAGE} | |
| 7 | ||
| 8 | # Install everything learn-related. | |
| 9 | RUN /tmp/octool -z && ccache -C | |
| 10 | ||
| 11 | # Uncomment to instal GPU stuff | |
| 12 | # RUN /tmp/octool -u && ccache -C | |
| 13 | ||
| 14 | # uncomment to install vision stuff | |
| 15 | # RUN /tmp/octool -n && ccache -C | |
| 16 | ||
| 17 | USER opencog | |
| 18 | WORKDIR /home/opencog | |
| 19 | ||
| 20 | # Compile the scheme files as the user. | |
| 21 | RUN guile -c "(use-modules (opencog matrix) (opencog lg) (opencog learn))" | |
| 22 | ||
| 23 | # Place a basic recommended configuration where the user can find it. | |
| 24 | COPY /scripts/ /home/opencog | |
| 25 | RUN sudo chown -R opencog:opencog setup-for-experiments.sh && \ | |
| 26 | chmod ugo+x setup-for-experiments.sh | |
| 27 | ||
| 28 | CMD /bin/bash | |
| 29 | ||
| 30 | ONBUILD USER root |
| … | … | @@ -0,0 +1,27 @@ |
| 1 | opencog/learn | |
| 2 | ------------- | |
| 3 | This docker image contains all of the tools needed for the "learn" | |
| 4 | subsystem, including the nlp subsystem. | |
| 5 | ||
| 6 | ## Building | |
| 7 | ||
| 8 | There are several ways to build: | |
| 9 | * Run `../docker-build.sh -a` and then `../docker-build.sh -l` | |
| 10 | where `docker-build.sh` is the shell script in the parent directory. | |
| 11 | ||
| 12 | * Run the `./build.sh` file in this directory. You need to have | |
| 13 | built the base AtomSpace image (in the `../atomspace` directory) first. | |
| 14 | ||
| 15 | To get fresh containers after github sources have changed, you will | |
| 16 | need to add the `--no-cache` flag to the `docker build` command. | |
| 17 | ||
| 18 | ## Running | |
| 19 | ||
| 20 | You can start the bare container by saying `./run.sh` in this directory. | |
| 21 | However, it might be more interesting to try the word-pair-counting | |
| 22 | experiment in the `../lang-pairs` directory. | |
| 23 | ||
| 24 | If you do run this container, then the first thing you'll want to do | |
| 25 | after starting it is to run the `setup-for-experiments.sh` shell script. | |
| 26 | This will initialize a reasonable working environment for doing learning | |
| 27 | experiments. |
| … | … | @@ -0,0 +1,6 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Build the docker image for opencog/learn | |
| 4 | # | |
| 5 | docker build -t opencog/learn . | |
| 6 | # docker build --no-cache -t opencog/learn . |
| … | … | @@ -0,0 +1,9 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Run the docker container. Stop any previously running copies. | |
| 4 | # | |
| 5 | ./stop.sh | |
| 6 | ||
| 7 | docker run --name="base-learn" -it opencog/learn | |
| 8 | ||
| 9 | clear |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # setup-for-experiments.sh | |
| 4 | # | |
| 5 | # Create a reasonable working environment for running experiments. | |
| 6 | # This provides a suggested configuration in which language-learning | |
| 7 | # experiments can be run. Just run this file to do that setup. | |
| 8 | ||
| 9 | mkdir text && mkdir text/input-pages | |
| 10 | mkdir data | |
| 11 | mkdir experiments && mkdir experiments/run-1 | |
| 12 | cp --preserve=mode,timestamps -r /usr/local/share/opencog/learn/run-config/*.sh experiments/run-1 | |
| 13 | cp --preserve=mode,timestamps -r /usr/local/share/opencog/learn/run-common experiments/run-common | |
| 14 | cp --preserve=mode,timestamps -r /usr/local/share/opencog/learn/run experiments/run-1 |
| … | … | @@ -0,0 +1,14 @@ |
| 1 | #! /bin/bash | |
| 2 | # | |
| 3 | # Stop any running containers previously started with 'run.sh' | |
| 4 | # | |
| 5 | TAINER=`docker ps |grep base-learn |cut -f1 -d" "` | |
| 6 | if test x"$TAINER" != x; then | |
| 7 | echo -n 'Stopping leftover container... ' | |
| 8 | docker stop -t 1 $TAINER | |
| 9 | fi | |
| 10 | TAINER=`docker ps -a |grep base-learn` | |
| 11 | if test x"$TAINER" != x; then | |
| 12 | echo -n 'Removing... ' | |
| 13 | docker rm base-learn | |
| 14 | fi |