OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-docker commits / c8dcd31

Install websockets for python
c8dcd3134f73044728d146e5c69b113c73fedd30
by Linas Vepštas <linasvepstas@gmail.com> · 2026-01-20T17:08:27.000Z

Changed files (220) +8832 -0

.github/dependabot.yml +7 -0
……@@ -0,0 +1,7 @@
1version: 2
2
3updates:
4 - package-ecosystem: "github-actions"
5 directory: "/"
6 schedule:
7 interval: "weekly"
.github/workflows/ci.xxx-yml-xxx +33 -0
……@@ -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
8name: CI
9
10on:
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
23jobs:
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
.github/workflows/publish-images.yml +152 -0
……@@ -0,0 +1,152 @@
1name: Publish images
2
3on:
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
18jobs:
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
.gitignore +14 -0
……@@ -0,0 +1,14 @@
1*.swp
2*~
3.tags
4tags
5
6# Just to avoid the removal of the README.md in buildbot/workspace/volume/
7buildbot/workspace/volume/atomspace/
8buildbot/workspace/volume/cogutil/
9buildbot/workspace/volume/master/
10buildbot/workspace/volume/moses/
11buildbot/workspace/volume/opencog/
12
13# For opencog/minecraft containers
14opencog/minecraft/data/
LICENSE +693 -0
……@@ -0,0 +1,693 @@
1Unless indicated otherwise (a license reference in file headers, or a
2LICENSE file in a directory), all OpenCog source files use the AGPL
3with additional permissions to link OpenCog libraries with non-AGPL
4works; the text of the OpenCog linking excpetion is located at the end
5of 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
19software and other kinds of works, specifically designed to ensure
20cooperation with the community in the case of network server software.
21
22 The licenses for most software and other practical works are designed
23to take away your freedom to share and change the works. By contrast,
24our General Public Licenses are intended to guarantee your freedom to
25share and change all versions of a program--to make sure it remains free
26software for all its users.
27
28 When we speak of free software, we are referring to freedom, not
29price. Our General Public Licenses are designed to make sure that you
30have the freedom to distribute copies of free software (and charge for
31them if you wish), that you receive source code or can get it if you
32want it, that you can change the software or use pieces of it in new
33free programs, and that you know you can do these things.
34
35 Developers that use our General Public Licenses protect your rights
36with two steps: (1) assert copyright on the software, and (2) offer
37you this License which gives you legal permission to copy, distribute
38and/or modify the software.
39
40 A secondary benefit of defending all users' freedom is that
41improvements made in alternate versions of the program, if they
42receive widespread use, become available for other developers to
43incorporate. Many developers of free software are heartened and
44encouraged by the resulting cooperation. However, in the case of
45software used on network servers, this result may fail to come about.
46The GNU General Public License permits making a modified version and
47letting the public access it on a server without ever releasing its
48source code to the public.
49
50 The GNU Affero General Public License is designed specifically to
51ensure that, in such cases, the modified source code becomes available
52to the community. It requires the operator of a network server to
53provide the source code of the modified version running there to the
54users of that server. Therefore, public use of a modified version, on
55a publicly accessible server, gives the public access to the source
56code of the modified version.
57
58 An older license, called the Affero General Public License and
59published by Affero, was designed to accomplish similar goals. This is
60a different license, not a version of the Affero GPL, but Affero has
61released a new version of the Affero GPL which permits relicensing under
62this license.
63
64 The precise terms and conditions for copying, distribution and
65modification 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
74works, such as semiconductor masks.
75
76 "The Program" refers to any copyrightable work licensed under this
77License. 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
81in a fashion requiring copyright permission, other than the making of an
82exact copy. The resulting work is called a "modified version" of the
83earlier work or a work "based on" the earlier work.
84
85 A "covered work" means either the unmodified Program or a work based
86on the Program.
87
88 To "propagate" a work means to do anything with it that, without
89permission, would make you directly or secondarily liable for
90infringement under applicable copyright law, except executing it on a
91computer or modifying a private copy. Propagation includes copying,
92distribution (with or without modification), making available to the
93public, and in some countries other activities as well.
94
95 To "convey" a work means any kind of propagation that enables other
96parties to make or receive copies. Mere interaction with a user through
97a computer network, with no transfer of a copy, is not conveying.
98
99 An interactive user interface displays "Appropriate Legal Notices"
100to the extent that it includes a convenient and prominently visible
101feature that (1) displays an appropriate copyright notice, and (2)
102tells the user that there is no warranty for the work (except to the
103extent that warranties are provided), that licensees may convey the
104work under this License, and how to view a copy of this License. If
105the interface presents a list of user commands or options, such as a
106menu, 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
111for making modifications to it. "Object code" means any non-source
112form of a work.
113
114 A "Standard Interface" means an interface that either is an official
115standard defined by a recognized standards body, or, in the case of
116interfaces specified for a particular programming language, one that
117is widely used among developers working in that language.
118
119 The "System Libraries" of an executable work include anything, other
120than the work as a whole, that (a) is included in the normal form of
121packaging a Major Component, but which is not part of that Major
122Component, and (b) serves only to enable use of the work with that
123Major Component, or to implement a Standard Interface for which an
124implementation 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
128produce 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
131the source code needed to generate, install, and (for an executable
132work) run the object code and to modify the work, including scripts to
133control those activities. However, it does not include the work's
134System Libraries, or general-purpose tools or generally available free
135programs which are used unmodified in performing those activities but
136which are not part of the work. For example, Corresponding Source
137includes interface definition files associated with source files for
138the work, and the source code for shared libraries and dynamically
139linked subprograms that the work is specifically designed to require,
140such as by intimate data communication or control flow between those
141subprograms and other parts of the work.
142
143 The Corresponding Source need not include anything that users
144can regenerate automatically from other parts of the Corresponding
145Source.
146
147 The Corresponding Source for a work in source code form is that
148same work.
149
150 2. Basic Permissions.
151
152 All rights granted under this License are granted for the term of
153copyright on the Program, and are irrevocable provided the stated
154conditions are met. This License explicitly affirms your unlimited
155permission to run the unmodified Program. The output from running a
156covered work is covered by this License only if the output, given its
157content, constitutes a covered work. This License acknowledges your
158rights 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
161convey, without conditions so long as your license otherwise remains
162in force. You may convey covered works to others for the sole purpose
163of having them make modifications exclusively for you, or provide you
164with facilities for running those works, provided that you comply with
165the terms of this License in conveying all material for which you do
166not control copyright. Those thus making or running the covered works
167for you must do so exclusively on your behalf, under your direction
168and control, on terms that prohibit them from making any copies of
169your copyrighted material outside their relationship with you.
170
171 Conveying under any other circumstances is permitted solely under
172the conditions stated below. Sublicensing is not allowed; section 10
173makes 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
178measure under any applicable law fulfilling obligations under article
17911 of the WIPO copyright treaty adopted on 20 December 1996, or
180similar laws prohibiting or restricting circumvention of such
181measures.
182
183 When you convey a covered work, you waive any legal power to forbid
184circumvention of technological measures to the extent such circumvention
185is effected by exercising rights under this License with respect to
186the covered work, and you disclaim any intention to limit operation or
187modification of the work as a means of enforcing, against the work's
188users, your or third parties' legal rights to forbid circumvention of
189technological measures.
190
191 4. Conveying Verbatim Copies.
192
193 You may convey verbatim copies of the Program's source code as you
194receive it, in any medium, provided that you conspicuously and
195appropriately publish on each copy an appropriate copyright notice;
196keep intact all notices stating that this License and any
197non-permissive terms added in accord with section 7 apply to the code;
198keep intact all notices of the absence of any warranty; and give all
199recipients 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,
202and 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
207produce it from the Program, in the form of source code under the
208terms 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
232works, which are not by their nature extensions of the covered work,
233and which are not combined with it such as to form a larger program,
234in or on a volume of a storage or distribution medium, is called an
235"aggregate" if the compilation and its resulting copyright are not
236used to limit the access or legal rights of the compilation's users
237beyond what the individual works permit. Inclusion of a covered work
238in an aggregate does not cause this License to apply to the other
239parts 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
244of sections 4 and 5, provided that you also convey the
245machine-readable Corresponding Source under the terms of this License,
246in 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
290from the Corresponding Source as a System Library, need not be
291included in conveying the object code work.
292
293 A "User Product" is either (1) a "consumer product", which means any
294tangible personal property which is normally used for personal, family,
295or household purposes, or (2) anything designed or sold for incorporation
296into a dwelling. In determining whether a product is a consumer product,
297doubtful cases shall be resolved in favor of coverage. For a particular
298product received by a particular user, "normally used" refers to a
299typical or common use of that class of product, regardless of the status
300of the particular user or of the way in which the particular user
301actually uses, or expects or is expected to use, the product. A product
302is a consumer product regardless of whether the product has substantial
303commercial, industrial or non-consumer uses, unless such uses represent
304the only significant mode of use of the product.
305
306 "Installation Information" for a User Product means any methods,
307procedures, authorization keys, or other information required to install
308and execute modified versions of a covered work in that User Product from
309a modified version of its Corresponding Source. The information must
310suffice to ensure that the continued functioning of the modified object
311code is in no case prevented or interfered with solely because
312modification has been made.
313
314 If you convey an object code work under this section in, or with, or
315specifically for use in, a User Product, and the conveying occurs as
316part of a transaction in which the right of possession and use of the
317User Product is transferred to the recipient in perpetuity or for a
318fixed term (regardless of how the transaction is characterized), the
319Corresponding Source conveyed under this section must be accompanied
320by the Installation Information. But this requirement does not apply
321if neither you nor any third party retains the ability to install
322modified object code on the User Product (for example, the work has
323been installed in ROM).
324
325 The requirement to provide Installation Information does not include a
326requirement to continue to provide support service, warranty, or updates
327for a work that has been modified or installed by the recipient, or for
328the User Product in which it has been modified or installed. Access to a
329network may be denied when the modification itself materially and
330adversely affects the operation of the network or violates the rules and
331protocols for communication across the network.
332
333 Corresponding Source conveyed, and Installation Information provided,
334in accord with this section must be in a format that is publicly
335documented (and with an implementation available to the public in
336source code form), and must require no special password or key for
337unpacking, reading or copying.
338
339 7. Additional Terms.
340
341 "Additional permissions" are terms that supplement the terms of this
342License by making exceptions from one or more of its conditions.
343Additional permissions that are applicable to the entire Program shall
344be treated as though they were included in this License, to the extent
345that they are valid under applicable law. If additional permissions
346apply only to part of the Program, that part may be used separately
347under those permissions, but the entire Program remains governed by
348this License without regard to the additional permissions.
349
350 When you convey a copy of a covered work, you may at your option
351remove any additional permissions from that copy, or from any part of
352it. (Additional permissions may be written to require their own
353removal in certain cases when you modify the work.) You may place
354additional permissions on material, added by you to a covered work,
355for which you have or can give appropriate copyright permission.
356
357 Notwithstanding any other provision of this License, for material you
358add to a covered work, you may (if authorized by the copyright holders of
359that 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
385restrictions" within the meaning of section 10. If the Program as you
386received it, or any part of it, contains a notice stating that it is
387governed by this License along with a term that is a further
388restriction, you may remove that term. If a license document contains
389a further restriction but permits relicensing or conveying under this
390License, you may add to a covered work material governed by the terms
391of that license document, provided that the further restriction does
392not survive such relicensing or conveying.
393
394 If you add terms to a covered work in accord with this section, you
395must place, in the relevant source files, a statement of the
396additional terms that apply to those files, or a notice indicating
397where to find the applicable terms.
398
399 Additional terms, permissive or non-permissive, may be stated in the
400form of a separately written license, or stated as exceptions;
401the above requirements apply either way.
402
403 8. Termination.
404
405 You may not propagate or modify a covered work except as expressly
406provided under this License. Any attempt otherwise to propagate or
407modify it is void, and will automatically terminate your rights under
408this License (including any patent licenses granted under the third
409paragraph of section 11).
410
411 However, if you cease all violation of this License, then your
412license from a particular copyright holder is reinstated (a)
413provisionally, unless and until the copyright holder explicitly and
414finally terminates your license, and (b) permanently, if the copyright
415holder fails to notify you of the violation by some reasonable means
416prior to 60 days after the cessation.
417
418 Moreover, your license from a particular copyright holder is
419reinstated permanently if the copyright holder notifies you of the
420violation by some reasonable means, this is the first time you have
421received notice of violation of this License (for any work) from that
422copyright holder, and you cure the violation prior to 30 days after
423your receipt of the notice.
424
425 Termination of your rights under this section does not terminate the
426licenses of parties who have received copies or rights from you under
427this License. If your rights have been terminated and not permanently
428reinstated, you do not qualify to receive new licenses for the same
429material 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
434run a copy of the Program. Ancillary propagation of a covered work
435occurring solely as a consequence of using peer-to-peer transmission
436to receive a copy likewise does not require acceptance. However,
437nothing other than this License grants you permission to propagate or
438modify any covered work. These actions infringe copyright if you do
439not accept this License. Therefore, by modifying or propagating a
440covered 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
445receives a license from the original licensors, to run, modify and
446propagate that work, subject to this License. You are not responsible
447for enforcing compliance by third parties with this License.
448
449 An "entity transaction" is a transaction transferring control of an
450organization, or substantially all assets of one, or subdividing an
451organization, or merging organizations. If propagation of a covered
452work results from an entity transaction, each party to that
453transaction who receives a copy of the work also receives whatever
454licenses to the work the party's predecessor in interest had or could
455give under the previous paragraph, plus a right to possession of the
456Corresponding Source of the work from the predecessor in interest, if
457the predecessor has it or can get it with reasonable efforts.
458
459 You may not impose any further restrictions on the exercise of the
460rights granted or affirmed under this License. For example, you may
461not impose a license fee, royalty, or other charge for exercise of
462rights granted under this License, and you may not initiate litigation
463(including a cross-claim or counterclaim in a lawsuit) alleging that
464any patent claim is infringed by making, using, selling, offering for
465sale, 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
470License of the Program or a work on which the Program is based. The
471work thus licensed is called the contributor's "contributor version".
472
473 A contributor's "essential patent claims" are all patent claims
474owned or controlled by the contributor, whether already acquired or
475hereafter acquired, that would be infringed by some manner, permitted
476by this License, of making, using, or selling its contributor version,
477but do not include claims that would be infringed only as a
478consequence of further modification of the contributor version. For
479purposes of this definition, "control" includes the right to grant
480patent sublicenses in a manner consistent with the requirements of
481this License.
482
483 Each contributor grants you a non-exclusive, worldwide, royalty-free
484patent license under the contributor's essential patent claims, to
485make, use, sell, offer for sale, import and otherwise run, modify and
486propagate the contents of its contributor version.
487
488 In the following three paragraphs, a "patent license" is any express
489agreement or commitment, however denominated, not to enforce a patent
490(such as an express permission to practice a patent or covenant not to
491sue for patent infringement). To "grant" such a patent license to a
492party means to make such an agreement or commitment not to enforce a
493patent against the party.
494
495 If you convey a covered work, knowingly relying on a patent license,
496and the Corresponding Source of the work is not available for anyone
497to copy, free of charge and under the terms of this License, through a
498publicly available network server or other readily accessible means,
499then you must either (1) cause the Corresponding Source to be so
500available, or (2) arrange to deprive yourself of the benefit of the
501patent license for this particular work, or (3) arrange, in a manner
502consistent with the requirements of this License, to extend the patent
503license to downstream recipients. "Knowingly relying" means you have
504actual knowledge that, but for the patent license, your conveying the
505covered work in a country, or your recipient's use of the covered work
506in a country, would infringe one or more identifiable patents in that
507country that you have reason to believe are valid.
508
509 If, pursuant to or in connection with a single transaction or
510arrangement, you convey, or propagate by procuring conveyance of, a
511covered work, and grant a patent license to some of the parties
512receiving the covered work authorizing them to use, propagate, modify
513or convey a specific copy of the covered work, then the patent license
514you grant is automatically extended to all recipients of the covered
515work and works based on it.
516
517 A patent license is "discriminatory" if it does not include within
518the scope of its coverage, prohibits the exercise of, or is
519conditioned on the non-exercise of one or more of the rights that are
520specifically granted under this License. You may not convey a covered
521work if you are a party to an arrangement with a third party that is
522in the business of distributing software, under which you make payment
523to the third party based on the extent of your activity of conveying
524the work, and under which the third party grants, to any of the
525parties who would receive the covered work from you, a discriminatory
526patent license (a) in connection with copies of the covered work
527conveyed by you (or copies made from those copies), or (b) primarily
528for and in connection with specific products or compilations that
529contain the covered work, unless you entered into that arrangement,
530or that patent license was granted, prior to 28 March 2007.
531
532 Nothing in this License shall be construed as excluding or limiting
533any implied license or other defenses to infringement that may
534otherwise 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
539otherwise) that contradict the conditions of this License, they do not
540excuse you from the conditions of this License. If you cannot convey a
541covered work so as to satisfy simultaneously your obligations under this
542License and any other pertinent obligations, then as a consequence you may
543not convey it at all. For example, if you agree to terms that obligate you
544to collect a royalty for further conveying from those to whom you convey
545the Program, the only way you could satisfy both those terms and this
546License 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
551Program, your modified version must prominently offer all users
552interacting with it remotely through a computer network (if your version
553supports such interaction) an opportunity to receive the Corresponding
554Source of your version by providing access to the Corresponding Source
555from a network server at no charge, through some standard or customary
556means of facilitating copying of software. This Corresponding Source
557shall include the Corresponding Source for any work covered by version 3
558of the GNU General Public License that is incorporated pursuant to the
559following paragraph.
560
561 Notwithstanding any other provision of this License, you have
562permission to link or combine any covered work with a work licensed
563under version 3 of the GNU General Public License into a single
564combined work, and to convey the resulting work. The terms of this
565License will continue to apply to the part which is the covered work,
566but the work with which it is combined will remain governed by version
5673 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
572the GNU Affero General Public License from time to time. Such new versions
573will be similar in spirit to the present version, but may differ in detail to
574address new problems or concerns.
575
576 Each version is given a distinguishing version number. If the
577Program specifies that a certain numbered version of the GNU Affero General
578Public License "or any later version" applies to it, you have the
579option of following the terms and conditions either of that numbered
580version or of any later version published by the Free Software
581Foundation. If the Program does not specify a version number of the
582GNU Affero General Public License, you may choose any version ever published
583by the Free Software Foundation.
584
585 If the Program specifies that a proxy can decide which future
586versions of the GNU Affero General Public License can be used, that proxy's
587public statement of acceptance of a version permanently authorizes you
588to choose that version for the Program.
589
590 Later license versions may give you additional or different
591permissions. However, no additional obligations are imposed on any
592author or copyright holder as a result of your choosing to follow a
593later version.
594
595 15. Disclaimer of Warranty.
596
597 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
598APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
599HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
600OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
601THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
602PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
603IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
604ALL 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
609WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
610THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
611GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
612USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
613DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
614PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
615EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
616SUCH DAMAGES.
617
618 17. Interpretation of Sections 15 and 16.
619
620 If the disclaimer of warranty and limitation of liability provided
621above cannot be given local legal effect according to their terms,
622reviewing courts shall apply local law that most closely approximates
623an absolute waiver of all civil liability in connection with the
624Program, unless a warranty or assumption of liability accompanies a
625copy 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
632possible use to the public, the best way to achieve this is to make it
633free 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
636to attach them to the start of each source file to most effectively
637state the exclusion of warranty; and each file should have at least
638the "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
656Also 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
659network, you should also make sure that it provides a way for users to
660get its source. For example, if your program is a web application, its
661interface could display a "Source" link that leads users to an archive
662of the code. There are many ways you could offer source, and different
663solutions will be better for different programs; see section 13 for the
664specific requirements.
665
666 You should also get your employer (if you work as a programmer) or school,
667if any, to sign a "copyright disclaimer" for the program, if necessary.
668For 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
674Linking this library statically or dynamically with other modules is making a
675combined work based on this library. Thus, the terms and conditions of the GNU
676Affero General Public License cover the whole combination.
677
678As a special exception, the copyright holders of this library give you
679permission to link this library with independent modules to produce an
680executable, regardless of the license terms of these independent modules,
681and to copy and distribute the resulting executable under terms of your choice,
682provided that you also meet, for each linked independent module, the terms
683and conditions of the license of that module. An independent module is a
684module which is not derived from or based on this library. If you modify
685this library, you may extend this exception to your version of the library,
686but you are not obligated to do so. If you do not wish to do so, delete this
687exception statement from your version.
688
689As such, it can be used to run, create and distribute a large class of
690MindAgents and other applications. When OpenCog is used unmodified as the core
691class library for an OpenCog instance, compiler for the combo language, or for
692a program written in the combo programming language it does not affect the
693licensing for distributing those programs directly.
README.md +106 -0
……@@ -0,0 +1,106 @@
1[![publish](https://github.com/opencog/docker/actions/workflows/publish-images.yml/badge.svg)](https://github.com/opencog/docker/actions)
2
3# OpenCog Docker library
4This repository contains various docker images for demoing and using
5various parts of the OpenCog project. Using the docker images here is
6the easiest way to get interesting parts of OpenCog running.
7
8By using Docker, most of the difficulty of installing and configuring
9the large variety of required packages and dependencies is eliminated.
10The individual docker files specify exactly what is needed to run a
11system or demo. Using these is as simple as saying `./build.sh` and
12then `./run.sh`.
13
14The most sophisticated demo is Eva, an animated female head, capable
15of seeing you (via a webcam), talking to you (via a chatbot), and
16engaging you (and your guests) in social interaction. She will
17make eye contact, and express her pleasure with smiles and looks
18of surprise and happiness.
19
20![Eva Splash 1](indigo/Eva-1-small.png) ![Eva Splash 2](indigo/Eva-2-small.png) ![Eva Splash 3](indigo/Eva-3-small.png)
21
22Another particularly interesting container is that for the OpenCog to
23MineCraft bridge, which allows OpenCog to operate an avatar running
24around in the MineCraft world.
25
26## Dockerfiles for Robot Operating System (ROS)
27Dockerfiles for demoing and working with various different robot heads
28and bodies, mostly those from
29[Hanson Robotics](https://www.hansonrobotics.com/). Several of the
30heads are modeled with blender, and so can be usefully worked with
31and controlled even without a physical robot.
32
33Sadly, the Eva demo has bitrotted. There have been some valiant efforts
34to bring Eva back to life, to be found in the [noetic](noetic) folder,
35but they stand incomplete. The primary roadblock is that Eva requires
36an older version of [blender](https://www.blender.org/), version 2.79,
37which dates back to 2016. Perhaps a blender expert could port Eva to
38a newer version.
39
40The ROS dockerfiles are contained in the [hydro](hydro),
41[indigo](indigo), [noetic](noetic) directories. Eva came in
42two forms: a basic animation and social interaction demo, in the
43[indigo/eva-owyl](indigo/eva-owyl) folder, and a full-featured
44system in the [indigo/eva-opencig](indigo/eva-opencog) folder.
45These no longer work, due to bitrot; the "good stuff", the last
46attempt to get everything working, is in the [noetic](noetic) folder.
47
48## Dockerfiles for OpenCog
49Opencog system dockerfiles can be found in the [opencog](opencog)
50directory. Up-to-date, current pre-built versions of these Docker
51containers can be downloaded from dockerhub. Simply go to the
52[opencog](opencog) directory, and run the `docker-build.sh` shell
53script. `docker-build.sh -h` for help, and `docker-build.sh -a`
54to download everything.
55
56### Obsolete demos
57If you have been sent here, and cannot find what you were told about,
58look in the [archive](archive) directory. It contains copies of all of
59the unsupported, abandond and obsolete projects that were once a part of
60OpenCog.
61
62### OpenCog demo
63The [lang-pairs](opencog/lang-pairs) container hosts a stand-alone
64word-pair visualization demo. If you have some files containing
65text, ideally more than a few thousand words and less than a few
66million, then this demo can process the files and extract the
67word-pair mutual information. This can then be viewed by aiming
68a web browser at the docker container. Just follow the directions
69in 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:
80Dockerhub's copies of opencog dockerfiles are here:
81https://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.
archive/README.md +285 -0
……@@ -0,0 +1,285 @@
1Obsolete OpenCog Docker Images
2------------------------------
3This directory contains all of the unmaintained, abandoned and
4obsolete docker configurations for some of OpenCog's older projects.
5The instructions below are a snapshot of the instructions, as they
6used to be, circa 2015, and so may feel anachronistic. The goal was
7to explain... *How to get started with using docker to deploy
8production servers, as well as for development.* ... and so on.
9
10Some 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
24All of the containers above are "empty", in that they contain no data,
25and thus, they don't "do anything".
26
27## Table of Contents
281. [Common Initial Setup](#common-initial-setup)
29 1. [Linux and UNIX-like Systems](#linux-and-unix-like-systems)
30 2. [Windows](#windows)
312. [Running Production Servers](#running-production-servers)
323. [Steps for OpenCog development](#steps-for-opencog-development)
334. [Steps for RelEx development](#steps-for-relex-development)
34RelEx is deprecated/obsolete.
355. [Steps for opencog-to-minecraft development](#steps-for-opencog-to-minecraft-development)
36Minecraft is obsolete.
37
38## Common Initial Setup
39The following sub-sections describe the steps required to configure docker on
40your OS, regardless of which project you are working on.
41
42### Linux and UNIX-like Systems
431. Follow the instructions [here](https://docs.docker.com/engine/installation/)
44 for setting up docker.
45
462. Pull images that are used for opencog development by running
47 `./docker-build.sh -a`
483. 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
594. 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
675. 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
741. Follow the instruction
75 [here](https://docs.docker.com/engine/installation/windows) for setting
76 docker,
77
782. Start the docker virtual machine using 'Docker Quickstart Terminal' as
79 described in the linked web-page from the previous step,
80
813. Pull images that are used for opencog development by running
82 `./docker-build.sh -a`
834. 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
925. 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
996. Run `./windows-run.sh`.
100
101## Running Production Servers
102Several different server containers are provided. The most important of
103these 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
1141. 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
1252. 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
1403. 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
1474. 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
1525. For using opencog shells follow instruction
153 [here](http://wiki.opencog.org/w/OpenCog_shell)
154
1556. Have fun hacking
156
1577. Exit container
158
159## Steps for RelEx development
160RelEx is deprecated/obsolete. It builds and works just fine, and is
161perfectly usable. However, it is no longer maintained, and is not
162recommended for any future development. See the (commented out)
163instructions in this README for details.
164
165RelEx is deprecated/obsolete.
166
1676. 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
1761. 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
1832. 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
190For some reason, the Jupyter container no longer builds. There is some
191bug with setting up the python environment. If you know how to use
192python, please fix this (these) config bugs (and remove this error
193message when done.)
194
1951. Build the image which has python and guile kernels installed with the following command.
196 ```
197 ./docker-build -j
198 ```
199This would build/pull necessary docker images.
200
2012. 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 ```
2063. For starting jupyter notebook run the following command.
207
208 ```
209 docker-compose -f opencog-jupyter.yml run --service-ports notes
210 ```
2114. Go to `0.0.0.0:8888/tree/notebooks` to interact with your notebooks.
212
213## Steps for opencog-to-minecraft development
214The minecraft code is currently bit-rotted, and will not build.
215See 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
2201. 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
2312. 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
2373. 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
2414. 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
2445. 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
249The perception code is currently bit-rotted, and will not build.
250See 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
2551. Install nvidia docker plugin by following instruction
256 [here](https://github.com/NVIDIA/nvidia-docker/wiki/Installation).
257
2582. Build openog/perception image by running
259 `docker build -t opencog/perception perception/` from this directory.
260
2613. 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
2711. Both `tmux` and `byobu` are installed, so you can use either for
272 multiple windows/panes.
273
2742. 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
2793. For more on docker-compose refer to https://docs.docker.com/compose/
280
281## TODO
2821. Update docker-compose configuration for minimizing steps to start
283 developing
284
2852. Add more images to github workflow for automated publishing
archive/bap/Dockerfile +57 -0
……@@ -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
17FROM opencog/cogutil
18
19RUN apt-get -y install opam
20
21# Switch away from the root user before doing opam work.
22USER opencog
23WORKDIR /home/opencog
24
25# Inits opam and install the OCaml compiler. Disable sandboxing
26# per https://github.com/ocaml/opam-repository/issues/20093
27RUN opam init --comp=4.09.0 --disable-sandboxing
28
29# Activate opam environment
30RUN eval `opam config env`
31
32RUN opam install -y core
33RUN opam install -y depext
34
35# Install bap and its dependencies
36RUN opam -y depext --install bap -y
37
38RUN eval $(opam env)
39
40# Install core atomspace.
41RUN /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
46COPY /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.
51RUN sudo chown -R opencog:opencog .ocamlinit
52
53# Docker defaults
54CMD /bin/bash
55
56# For images built on this
57ONBUILD USER root
archive/bap/scripts/.ocamlinit +13 -0
……@@ -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" ;;
archive/cogutil/Dockerfile +18 -0
……@@ -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
7FROM opencog/opencog-deps:latest
8
9# Install cogutil
10RUN /tmp/octool -c && ccache -C
11
12USER opencog
13
14# Docker defaults
15CMD bash
16
17# For images built on this
18ONBUILD USER root
archive/common.yml +24 -0
……@@ -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
6services:
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
archive/docker-build.sh +275 -0
……@@ -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
14set -e
15
16# Environment Variables
17## Use's cache by default unless the -u options is passed
18CACHE_OPTION=""
19
20## This file/symlinks name
21SELF_NAME=$(basename $0)
22
23# -----------------------------------------------------------------------------
24# Main Execution
25if [ $# -eq 0 ]; then NO_ARGS=true; fi
26
27while 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
48done
49
50shift "$(($OPTIND - 1))"
51DOCKER_NAME=$1
52if [[ -z $DOCKER_NAME ]]; then
53 DOCKER_NAME="opencog"
54fi
55GITHUB_NAME=$2
56if [[ -z $GITHUB_NAME ]]; then
57 GITHUB_NAME="opencog"
58fi
59
60# Functions
61usage() {
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
83Deprecated (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
93if [ $SHOW_USAGE ]; then
94 usage
95 exit 0
96fi
97
98# -----------------------------------------------------------------------------
99# Sanity check
100if ! command -v docker &> /dev/null
101then
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
106fi
107
108# -----------------------------------------------------------------------------
109## Build opencog/opencog-deps image.
110build_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.
122check_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.
130build_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.
144check_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.
152build_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.
165check_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.
173build_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.
182check_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/
190pull_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
203if [ $PULL_DEV_IMAGES ]; then
204 pull_dev_images
205 exit 0
206fi
207
208if [ $BUILD_OPENCOG_BASE_IMAGE ]; then
209 build_opencog_deps
210fi
211
212if [ $BUILD_COGUTIL_IMAGE ]; then
213 build_cogutil
214fi
215
216if [ $BUILD_ATOMSPACE_IMAGE ]; then
217 build_atomspace
218fi
219
220if [ $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 ----"
224fi
225
226if [ $BUILD_TOOL_IMAGE ]; then
227 build_dev_cli
228fi
229
230if [ $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 ----"
235fi
236
237if [ $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 ----"
242fi
243
244if [ $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 ----"
252fi
253
254if [ $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 ----"
265fi
266
267if [ $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 ----"
272fi
273
274if [ $UNKNOWN_FLAGS ] ; then usage; exit 1 ; fi
275if [ $NO_ARGS ] ; then usage ; fi
archive/docker-compose.yml +33 -0
……@@ -0,0 +1,33 @@
1# Usage: Follow the steps in the README file in the directory containing this file
2
3services:
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
archive/embodiment/Dockerfile +29 -0
……@@ -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
7FROM opencog/opencog-deps
8
9# Set locale
10RUN 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
14ADD opencog /opencog
15RUN mkdir -v -p /opencog/build
16WORKDIR /opencog/build
17RUN rm CMakeCache.txt
18RUN cmake ..
19RUN 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
24WORKDIR /opencog/scripts/embodiment
25RUN ./make_distribution
26
27# Start embodiment cogserver, spawner, router, etc. when container runs
28WORKDIR /opencog/build/dist/embodiment
29CMD ["/opencog/build/dist/embodiment/spawner"]
archive/embodiment/README.md +1 -0
……@@ -0,0 +1 @@
1Work in progress.
archive/minecraft.yml +36 -0
……@@ -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
5oc2mc:
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
22minecraft-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
archive/minecraft/.dockerignore +1 -0
……@@ -0,0 +1 @@
1data/*
archive/minecraft/Dockerfile +45 -0
……@@ -0,0 +1,45 @@
1FROM 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/
6RUN locale-gen en_US.UTF-8
7ENV LANG en_US.UTF-8
8ENV ROS_DISTRO kinetic
9
10## python3-dev & python3-setuptools are for spock included in this
11## instruction for minimizing layers
12RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
13RUN 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
22COPY ./ros_entrypoint.sh /
23
24# Spock installation
25RUN easy_install pip && pip install cryptography
26RUN 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;\
34RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
35RUN wget -qO- https://get.rvm.io | bash -s stable
36#RUN cat /etc/profile.d/rvm.sh | bash
37RUN /usr/local/rvm/bin/rvm requirements
38RUN /usr/local/rvm/bin/rvm install 2.4.6
39RUN /bin/bash -l -c "rvm use 2.4.6 --default"
40RUN /bin/bash -l -c "gem install tmuxinator"
41
42USER opencog
43RUN rosdep update
44ENTRYPOINT ["/ros_entrypoint.sh"]
45CMD ["bash"]
archive/minecraft/ros_entrypoint.sh +13 -0
……@@ -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
6set -e
7
8# setup ros environment
9source "/opt/ros/$ROS_DISTRO/setup.bash"
10
11# For oc2mc
12export PYTHONPATH=$PYTHONPATH:/oc2mc:/oc2mc/minecraft_bot/src
13exec "$@"
archive/moses/Dockerfile +25 -0
……@@ -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
15FROM opencog/cogutil
16
17# Install R
18RUN apt-get -y install r-base
19
20# Install moses
21RUN /tmp/octool -m && ccache -C
22
23# Docker Defaults
24USER opencog
25CMD bash
archive/opencog-ide.yml +25 -0
……@@ -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
10dev:
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.
archive/opencog-jupyter.yml +34 -0
……@@ -0,0 +1,34 @@
1# Follow the instructions below for setting using jupyter notebooks with opencog.
2#
3version: '3'
4services:
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"
archive/perception/.tmux.conf +6 -0
……@@ -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
6set-option -g mouse on
archive/perception/Dockerfile +21 -0
……@@ -0,0 +1,21 @@
1FROM gcr.io/tensorflow/tensorflow:latest-gpu
2
3RUN apt-get update
4
5# Install tools for developers.
6RUN 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
9RUN adduser --disabled-password --gecos "OpenCog Developer" opencog
10RUN adduser opencog sudo
11RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
12USER opencog
13WORKDIR /home/opencog
14
15COPY .tmux.conf /home/opencog/.tmux.conf
16
17# Docker defaults
18CMD bash
19
20# For images built on this
21ONBUILD USER root
archive/postgres/Dockerfile +22 -0
……@@ -0,0 +1,22 @@
1# docker build -t opencog/postgres
2
3FROM postgres:9.5
4
5# TODO: Change to build time argument. See https://github.com/docker/docker/issues/13490
6ENV POSTGRES_PASSWORD="cheese"
7
8ADD https://raw.githubusercontent.com/opencog/atomspace/master/opencog/persist/sql/multi-driver/atom.sql /tmp/atom.sql
9
10COPY configure.sh /docker-entrypoint-initdb.d/
11COPY start.sh /
12
13RUN 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
17ENV PGDATA=/data
18RUN /docker-entrypoint.sh postgres
19
20# Start postgres on default without going through the configuration steps.
21ENTRYPOINT ["/start.sh"]
22CMD ["postgres"]
archive/postgres/README.md +5 -0
……@@ -0,0 +1,5 @@
1Assuming 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,
2do the following
3
41. To start run the script `./run.sh`
52. To stop run `./stop.sh`
archive/postgres/configure.sh +41 -0
……@@ -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
13printf "___ Configuring for standard OpenCog use ___\n"
14
15psql -U postgres -c \
16 "CREATE USER opencog_user WITH SUPERUSER PASSWORD '$POSTGRES_PASSWORD'"
17psql -U postgres -c "CREATE DATABASE mycogdata OWNER opencog_user"
18
19printf "___ Create the database tables for standard OpenCog use ___\n"
20psql -U opencog_user -d mycogdata -a -f /tmp/atom.sql
21
22# For Unit testing
23printf "\n___ Configuring for OpenCog unit testing ___\n"
24psql -U postgres -c \
25 "CREATE USER opencog_tester WITH SUPERUSER PASSWORD '$POSTGRES_PASSWORD'"
26psql -U postgres -c "CREATE DATABASE opencog_test OWNER opencog_tester"
27
28## 'cheese' is the password for the next step
29printf "\n___ Create the database tables for OpenCog unit testing ___\n"
30psql -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
34PGUSER="${PGUSER:-postgres}" pg_ctl -D "$PGDATA" -m fast -w stop
35
36echo
37echo 'PostgreSQL init process complete; ready for start up.'
38echo
39
40# Exit from process as we don't want to start the server.
41exit 0
archive/postgres/run.sh +20 -0
……@@ -0,0 +1,20 @@
1#!/bin/bash
2
3cp ../base/scripts/odbc-localhost.ini ~/.odbc.ini
4
5STARTED="FALSE"
6
7for 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
14done
15
16if [ $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"
20fi
archive/postgres/start.sh +64 -0
……@@ -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
9set -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
16alter_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%
23ram_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
30if [ "$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
62else
63 exec "$@"
64fi
archive/postgres/stop.sh +6 -0
……@@ -0,0 +1,6 @@
1#!/bin/bash
2
3set -e
4echo "Stopping container opencog-postgres"
5docker stop opencog-postgres
6echo "Stopped container opencog-postgres"
archive/relex.yml +14 -0
……@@ -0,0 +1,14 @@
1# Usage: Follow the steps in the README file in the directory containing this file
2
3relex:
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
archive/relex/Dockerfile +95 -0
……@@ -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#
23FROM 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
27ENV DEBIAN_FRONTEND noninteractive
28
29ENV JAVA_HOME /usr/lib/jvm/java-1.11.0-openjdk-amd64
30
31RUN apt-get update ; apt-get -y upgrade ; apt-get -y autoclean
32
33# Java and basic build tools
34RUN 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
39RUN 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.
43RUN apt-get -y install locales && locale-gen en_US.UTF-8
44ENV LANG en_US.UTF-8
45ENV LANGUAGE en_US:en
46ENV LC_ALL en_US.UTF-8
47
48RUN mkdir /usr/local/share/java
49
50WORKDIR /home/Downloads/
51
52# JWNL - Never changes, so do this first.
53RUN 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.
60RUN 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.
70ADD https://raw.githubusercontent.com/opencog/ocpkg/master/ocpkg \
71 /tmp/octool
72RUN chmod 755 /tmp/octool; sync; /tmp/octool -l java
73
74# Relex -- changes often
75ADD https://github.com/opencog/relex/archive/master.tar.gz master.tar.gz
76RUN 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.
80RUN adduser --disabled-password --gecos "ReLex USER" relex
81RUN adduser relex sudo
82RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
83USER relex
84
85RUN sudo chown -R relex:relex .
86# Punch out ports
87## plain-text-server.sh port
88EXPOSE 3333
89## opencog-server.sh port
90EXPOSE 4444
91## link-grammar-server.sh port
92EXPOSE 9000
93
94WORKDIR /home/Downloads/relex-master/
95CMD /bin/bash
archive/relex/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for relex
4#
5docker build -t opencog/relex .
archive/relex/run-link-grammar.sh +9 -0
……@@ -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
6docker run --rm --name="relex-link-grammar" -p 9000:9000 \
7 -w /home/Downloads/relex-master opencog/relex /bin/sh link-grammar-server.sh
8
9clear
archive/relex/run-opencog-relex.sh +9 -0
……@@ -0,0 +1,9 @@
1#! /bin/bash
2#
3# Run the docker container. Stop any previously running copies.
4#
5./stop.sh relex-opencog
6docker run --rm --name="relex-opencog" -p 4444:4444 \
7 -w /home/Downloads/relex-master opencog/relex /bin/sh opencog-server.sh
8
9clear
archive/relex/run-plain.sh +9 -0
……@@ -0,0 +1,9 @@
1#! /bin/bash
2#
3# Run the docker container. Stop any previously running copies.
4#
5./stop.sh relex-plain
6docker run --rm --name="relex-plain" -p 3333:3333 \
7 -w /home/Downloads/relex-master opencog/relex /bin/sh plain-text-server.sh
8
9clear
archive/relex/stop.sh +18 -0
……@@ -0,0 +1,18 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5NAME=$1
6if test x"$1" == x; then
7 NAME=relex
8fi
9TAINER=`docker ps |grep $NAME |cut -f1 -d" "`
10if test x"$TAINER" != x; then
11 echo -n 'Stopping leftover container.. '
12 docker stop -t 1 $TAINER
13fi
14TAINER=`docker ps -a |grep $NAME |cut -f1 -d" "`
15if test x"$TAINER" != x; then
16 echo -n 'Removing.. '
17 docker rm $TAINER
18fi
archive/tools/cli/Dockerfile +33 -0
……@@ -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
14FROM opencog/atomspace:latest
15
16# Download data and install opencog.
17RUN /tmp/octool -ow && ccache -C
18
19# Install tools for developers.
20RUN apt-get -y install python3-dbg man valgrind gdb
21
22USER opencog
23WORKDIR /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
28COPY /scripts/ /home/opencog
29RUN sudo chown -R opencog:opencog .[a-z]*
30
31CMD /bin/bash
32
33ONBUILD USER root
archive/tools/cli/scripts/.tmux.conf +6 -0
……@@ -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
6set -g mouse on
archive/tools/distcc/Dockerfile +20 -0
……@@ -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
6FROM opencog/opencog-deps
7MAINTAINER David Hart "dhart@opencog.org"
8
9RUN apt-get -y update && \
10 apt-get -y install distcc
11
12# startdtiscc ignored since we're manually starting in non-daemon mode
13RUN sed -i s:STARTDISTCC="false":STARTDISTCC="true":g /etc/default/distcc
14RUN sed -i s:ALLOWEDNETS="127.0.0.1/24":ALLOWEDNETS="158.132.58.0/24":g /etc/default/distcc
15RUN sed -i s:LISTENER="127.0.0.1":LISTENER="0.0.0.0":g /etc/default/distcc
16RUN sed -i s:NICE="10":NICE="10":g /etc/default/distcc
17RUN sed -i s:JOBS="":JOBS="8":g /etc/default/distcc
18RUN sed -i s:ZEROCONF="false":ZEROCONF="true":g /etc/default/distcc
19
20CMD /usr/bin/distccd --allow 158.132.58.0/24 ; sleep infinity
archive/tools/ide/Dockerfile +21 -0
……@@ -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
12FROM opencog/opencog-dev:cli
13
14# Tools
15RUN apt-get -y install git-gui meld qtcreator
16
17# Workspace configuration
18COPY qtcreator-startup-script.sh /home/opencog/
19RUN chown opencog:opencog /home/opencog/qtcreator-startup-script.sh
20USER opencog
21CMD /home/opencog/qtcreator-startup-script.sh
archive/tools/ide/qtcreator-startup-script.sh +13 -0
……@@ -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
6tmux new-session -d -n "opencog-development";
7echo evaluating startup script... ;\
8tmux set-option -g set-remain-on-exit on ;\
9tmux bind-key R respawn-window ;\
10tmux split-window -d -v -p 25 ;\
11tmux send -t 1 qtcreator
12tmux send -t 1 Enter
13tmux attach
archive/tools/jupyter_notebook/Dockerfile +36 -0
……@@ -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.
4FROM opencog/opencog-dev:cli
5
6RUN 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
12RUN python3 -m pip install jupyter ipykernel tornado==4.5.3
13
14# Install guile-json as it is needed for guile-kernel
15WORKDIR /opt/
16
17RUN 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
25RUN 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
28WORKDIR /usr/local/share/jupyter/kernels
29
30RUN git clone --depth 1 https://github.com/jerry40/guile-kernel
31# Copy kernel description to the above folder
32COPY kernel.json /usr/local/share/jupyter/kernels/guile-kernel
33
34EXPOSE 8888
35USER opencog
36CMD [ "jupyter", "notebook", "--ip=0.0.0.0", "--port=8888" ]
archive/tools/jupyter_notebook/kernel.json +5 -0
……@@ -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}
archive/windows-run.sh +58 -0
……@@ -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
9export OPENCOG_SOURCE_DIR=$HOME/path/to/opencog
10export RELEX_SOURCE_DIR=$HOME/path/to/relex
11export ATOMSPACE_SOURCE_DIR=$HOME/path/to/atomspace
12export COGUTIL_SOURCE_DIR=$HOME/path/to/cogutil
13export 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
17docker create --name postgres opencog/postgres &> /dev/null
18
19docker 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
28docker 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
49echo "Starting postgres and relex"
50docker start relex postgres
51echo "Starting opencog_dev in 10 seconds"
52sleep 10
53docker start -i opencog_dev
54
55# Cleanup on exit from opencog_dev
56echo "Stopping postgres and relex"
57docker stop relex postgres
58echo "If you want to remove the containers run 'docker rm postgres relex'"
hydro/Dockerfile +29 -0
……@@ -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
12FROM ubuntu:12.04
13MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
14MAINTAINER David Hart "dhart@opencog.org"
15
16RUN apt-get -y update
17RUN apt-get -y install python-software-properties wget screen
18RUN wget http://packages.ros.org/ros.key -O - | apt-key add -
19RUN echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list
20RUN apt-get -y update
21RUN apt-get -y install ros-hydro-ros-base ros-hydro-rqt-common-plugins
22RUN apt-get -y install ros-hydro-robot ros-hydro-viz
23RUN apt-get -y install ros-hydro-mobile ros-hydro-perception ros-hydro-simulators
24
25RUN rosdep init
26RUN rosdep update
27RUN echo "source /opt/ros/hydro/setup.bash" >> ~/.bashrc
28ENV DISPLAY 0:0
29CMD /bin/bash
hydro/README.md +11 -0
……@@ -0,0 +1,11 @@
1# ROS Hydro release
2
3Older ROS Hydro packages.
4Include 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
hydro/dev/Dockerfile +16 -0
……@@ -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
6FROM opencog/ros-hydro-deps
7MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
8MAINTAINER David Hart "dhart@opencog.org"
9
10RUN apt-get -y update
11RUN apt-get -y install camorama geany
12RUN apt-get -y install cmake-curses-gui git mercurial subversion
13RUN apt-get -y install ros-hydro-gscam
14RUN apt-get -y install less meld vim-gnome
15
16CMD /bin/bash
hydro/openni/Dockerfile +29 -0
……@@ -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
7FROM opencog/ros-hydro-dev
8MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
9MAINTAINER David Hart "dhart@opencog.org"
10
11RUN apt-get -y update
12RUN apt-get -y install g++ python libusb-1.0-0-dev freeglut3-dev openjdk-7-jdk
13RUN apt-get -y install unzip
14
15ADD https://github.com/OpenNI/OpenNI/archive/master.zip /OpenNI.zip
16RUN 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
25WORKDIR /OpenNI-master/Platform/Linux/Build
26RUN make
27RUN make install
28
29CMD /bin/bash
hydro/percept/Dockerfile +21 -0
……@@ -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
7FROM opencog/ros-hydro-openni
8MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
9MAINTAINER David Hart "dhart@opencog.org"
10
11# RUN apt-get -y update
12
13ADD https://github.com/hansonrobotics/perception_synthesizer/archive/master.zip /perception_synthesizer.zip
14RUN unzip /perception_synthesizer.zip
15
16WORKDIR /perception_synthesizer-master/build
17RUN cmake ..
18RUN make
19RUN make install
20
21CMD /bin/bash
hydro/zenorsm/Dockerfile +150 -0
……@@ -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
8FROM opencog/ros-hydro-dev
9MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
10MAINTAINER David Hart "dhart@opencog.org"
11
12RUN apt-get -y update
13# Crap, didn't notice that it's installing blender...I think this can be removed? - AvdP
14RUN apt-get -y install blender
15
16RUN apt-get -y install python3-yaml
17RUN apt-get -y install python3-setuptools
18RUN easy_install3 pip
19RUN pip3 install rospkg catkin_pkg
20
21RUN 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
25WORKDIR /catkin_ws/src
26RUN apt-get -y install mplayer python-pycurl libcurl3
27RUN git clone https://github.com/Alex-van-der-Peet/ITFTalk
28
29# Install ITFListen and prerequisites
30WORKDIR /catkin_ws/src
31RUN apt-get -y install sox python-simplejson
32RUN git clone https://github.com/Alex-van-der-Peet/ITFListen
33
34# Install ITFParrot to test ITFListen -> ITFTalk
35WORKDIR /catkin_ws/src
36RUN 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
44RUN 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
73WORKDIR /catkin_ws/src
74RUN cp /opt/ros/hydro/setup.sh /etc/profile.d/ros_hydro.sh
75ENV PYTHONPATH /opt/ros/hydro/lib/python2.7/dist-packages
76RUN /usr/bin/python3 /opt/ros/hydro/bin/catkin_init_workspace
77
78#Download and install DepthSenseSDK
79WORKDIR /Downloads
80ADD http://buildbot.opencog.org/hidden/DepthSenseSDK-1.4.3-1527-amd64.deb /Downloads/DepthSenseSDK-1.4.3-1527-amd64.deb
81RUN dpkg -i DepthSenseSDK-1.4.3-1527-amd64.deb
82
83WORKDIR /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
87RUN git clone https://github.com/hansonrobotics/robo_blender
88RUN git clone https://github.com/yantrabuddhi/ros_pololu_servo
89WORKDIR /catkin_ws
90
91RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make"
92
93WORKDIR /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
99RUN git clone https://github.com/yantrabuddhi/ros_faceshift
100RUN git clone https://github.com/yantrabuddhi/simple_face_tracker
101
102WORKDIR /catkin_ws
103
104RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make"
105
106WORKDIR /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
113RUN git clone https://github.com/ipa320/softkinetic
114
115WORKDIR /catkin_ws
116
117RUN bash -l -c "source /opt/ros/hydro/setup.bash; /usr/bin/python3 /opt/ros/hydro/bin/catkin_make"
118
119WORKDIR /catkin_ws/src
120
121WORKDIR /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
125WORKDIR /catkin_ws
126
127RUN apt-get -y install ros-hydro-cv-camera
128
129ENV STARTSCRIPT "\
130echo evaluating startup script... &&\
131source /catkin_ws/devel/setup.bash &&\
132tmux new-session -d 'echo -e \"\e[1;34mroscore\e[0m\" ; roscore' &&\
133tmux set -g set-remain-on-exit on &&\
134tmux set-option -g set-remain-on-exit on &&\
135tmux bind-key R respawn-window &&\
136tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_pololu_servo\e[0m\" ;\
137 rosrun ros_pololu_servo ros_pololu_servo_node' &&\
138tmux split-window -d -v -p 25 'echo -e \"\e[1;34mblender robo.blend\e[0m\" ;\
139 sleep 4 && blender robo.blend' &&\
140tmux split-window -d -v -p 25 'echo -e \"\e[1;34mbash shell\e[0m\" ;\
141 bash -l -i' &&\
142tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_talk\e[0m\" ;\
143 roslaunch itf_talk itf_talk.launch' &&\
144tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_listen\e[0m\" ;\
145 roslaunch itf_listen itf_listen.launch' &&\
146tmux select-layout even-vertical &&\
147tmux attach \
148"
149
150# CMD /bin/bash -l -c "eval $STARTSCRIPT"
indigo/.gitignore +1 -0
……@@ -0,0 +1 @@
1.Dockerfile.swp
indigo/Eva-1-small.png +0 -0
(no content changes — binary or rename)
indigo/Eva-1.png +0 -0
(no content changes — binary or rename)
indigo/Eva-2-small.png +0 -0
(no content changes — binary or rename)
indigo/Eva-2.png +0 -0
(no content changes — binary or rename)
indigo/Eva-3-small.png +0 -0
(no content changes — binary or rename)
indigo/Eva-3.png +0 -0
(no content changes — binary or rename)
indigo/README.md +364 -0
……@@ -0,0 +1,364 @@
1ROS Indigo + Blender + OpenCog
2==============================
3Docker files for Hanson Robotics robots and heads. The most
4sophisticated of the bunch is Eva, an animated female head, capable
5of seeing you (via a webcam), talking to you (via a chatbot), and
6engaging you (and your guests) in social interaction. She will
7make eye contact, and express her pleasure with smiles and looks
8of surprise and happiness.
9
10![Eva Splash 1](Eva-1-small.png) ![Eva Splash 2](Eva-2-small.png) ![Eva Splash 3](Eva-3-small.png)
11
12## Hierarchy and dependents
13
14The docker image hierarchy is slightly more complex than it could be.
15It has been driven into this state in order to accomodate the conflicting
16needs of ROS+Docker. The root cause is discussed further down below.
17In short, ROS and Docker have conflicting ideas about how networking
18should work; this forces us to install everything into one giant Docker
19container. This is not ideal, but it works. See the design discussion
20below.
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
90The `arthur-animation` and `arthur-dev` packages are deprecated. They
91implement an older animation system that was difficult to work with.
92Most importantly, eye-tracking and emotion gestures were not blended
93and 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
106Most subdirectories contain a `build.sh` script for building the
107particular docker image.
108
109Use `build-all.sh` to build the Eva docker image and it's dependents.
110This may take an hour or more.
111
112## Running
113Most subdirectories contain a pair of scripts: `run.sh` and `stop.sh`.
114These will run and stop the containers defined in that directory.
115
116# ROS+Docker Container Design
117Building a well-designed system using Docker and ROS is impossible at
118this point in time (as of spring 2016). This is because the way that
119Docker does networking is in direct conflict with how ROS does
120networking. The primary issue is that ROS messages contain port
121numbers in them, whereas Docker networking uses proxies to remap ports
122between containers. This means that the port numbers in the ROS messages
123do not match the actual port numbers being used in the Docker container.
124This can be hacked around in various ways, but none of the hacks solve
125all of the problems.
126
127The way that Docker does networking is changing (for Swarm), while ROS
128will also change, with a completely different messaging system for ROS2.
129It will be a while before the dust settles and there's a coherent
130networking policy.
131
132In 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
150Below is a discussion and notes about the issues that block the second
151and third design points.
152
153Main issue: a ROS publisher inside a Docker container cannot be
154subscribed to outside of a Docker container. There are several ways
155to set this up and try to hack around it.
156
157## Version A: Default Docker networking.
158Start the ROS container in directory `base` using the `./run.sh` command.
159Make yourself a tmux session as follows (this is for convenience only):
160```
161byobu new-session -d -n 'aa' '$SHELL'
162tmux new-window -n 'bb' '$SHELL'
163tmux new-window -n 'cc' '$SHELL'
164tmux new-window -n 'dd' '$SHELL'
165echo "tmux_left=\"session\"" > $HOME/.byobu/status
166echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
167tmux attach
168```
169Start `roscore` by hand in one terminal. In another terminal, publish
170something:
171```
172rostopic pub -r 5 /foo std_msgs/String '{data: hallooooo}'
173```
174In a third terminal, subscribe:
175```
176rostopic echo /foo
177```
178Yayy! This works! Can we subscribe to this topic outside of this
179container? 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,
182with
183```
184docker inspect opencog-eva-ros | grep IPAdress
185```
186We can now attempt to contact ROS from the outside world. First, set
187```
188export ROS_MASTER_URI=http://172.17.0.2:11311
189```
190Now, ROS will *almost* work. But not quite. This works:
191```
192rostopic list
193rostopic info /foo
194```
195This fails (it hangs):
196```
197rostopic echo /foo
198```
199The reason that this is broken is because ROS messages themselves contain
200tcpip port numbers, and Docker uses a form of port proxying and
201firewalling (iptables) that remaps ports. Thus, port numbers inside the
202container do not match the port number contained in the message, when
203that message is coming from outside the container. This mis-match is at
204the root of the hang.
205
206Curiously, the reversed process works: if you publish on the outside,
207then you can subscribe on the inside, just fine.
208
209This issue prevents the natural separation between OpenCog and Eva-ROS.
210The Eva-ROS container is publishing `/camera/face_locations` and OpenCog
211subscribes to that to find out about the location of human faces visible
212to Eva. Since the messages never arrive, Eva is blind, and sees
213nothing.
214
215## Version B: New Docker networking.
216Starting with Docker version 1.9 (the current version in Ubuntu 14.04
217trusty LTS), docker introduces a networking overlay. This seems like it
218is 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
224However, these tutorials are misleading: Some stuff works, but other,
225different stuff breaks, and the original problem remains unsolved. This
226can be reproduced as described below. Their success depends on using
227Docker networks, and being very very careful -- diligently careful --
228about setting ROS environment variables. This makes the whole process
229very fragile, and subject to lots of confusion. YMMV.
230
231First, create a Docker network:
232```
233docker network create boingo
234```
235Start three ROS containers. One, called the `master`, will contain
236`roscore`. The other two will publish and subscribe to each-other.
237There are several ways to start these, including the setting of ROS
238environment variables during startup. This won't be done for this
239example, since it clouds the issue: it confuses what is really
240happening. The environment variables can be set by hand, after
241startup. Start the containers as follows:
242```
243docker run --net=boingo --name=master -p 11311:11311 -it opencog/ros-indigo-base
244docker run --net=boingo --name=aaa -p 11311:11311 -it opencog/ros-indigo-base
245docker run --net=boingo --name=bbb -p 11311:11311 -it opencog/ros-indigo-base
246```
247Note the `--net=boingo` parameter. This causes Docker to use a different
248set of network addresses. It also alters how Docker does port proxying.
249Although the proxying is different, the core issue of re-labelling port
250numbers remains: the ROS messages still have port numbers in them that
251fail to match up with the actual port assignments. Let's plow onwards.
252
253Start `roscore` inside container `master`. Next, inside `aaa`, do this:
254```
255export ROS_HOSTNAME=aaa
256export ROS_MASTER_URI=http://master:11311
257rostopic pub -r 5 /bar std_msgs/String '{data: olaaa}'
258```
259while inside `bbb`, do this:
260```
261export ROS_HOSTNAME=bbb
262export ROS_MASTER_URI=http://master:11311
263rostopic echo /bar
264```
265Yayyy! This works! They can hear each other! This is the sum-total of
266the widely-publicized, easy-to-find ROS+Docker tutorials all over the
267net. That all is not right heaven is easy to see. Outside of the
268containers, `rostopic list` and `rostopic info /bar` works just as
269before, and `rostopic echo /bar` still fails, as before. Unlike before,
270however, there is now a new failure: go to container `aaa`, and, in a
271new tmux terminal, try `rostopic echo /bar` -- it doesn't work!!! This
272is a new failure: subscribers can no longer hear publishers living
273inside the same container! Be careful to export the `ROS_HOSTNAME`
274correctly in the new tmux terminal; failing to do this adds to the
275confusion. You may experiment at this point: you won't get lucky,
276though, even though it seems like you might, with just one more try.
277
278This new failure mode forces one to a new design point that might seem
279reasonable, but is ultimately untenable: one ROS node per container.
280This might almost work, although its terribly fragile. Debugging is
281hard, because if you're outside a container, you cannot hear what they
282are passing around to each-other. Altering the network structure
283becomes difficult. Using tools like `rviz` to visualize the ROS network
284becomes difficult, because you now have to put `rviz` in it's own Docker
285container, and then punch a hole through it to get the graphs to
286display on your screen. It devolves from there, and by the time you get
287to OpenCog, you've got the cogserver launching one python thread for ROS
288messaging, while other threads send scheme over other sockets, while yet
289more threads are handling tcpip sockets to IRC, and messages are flying
290every-which way. It appears that the Docker philosophy of "one process
291per container" is untenable, in any practical sense. Its too hard to
292manage, too hard to configure and control. Perhaps Docker Swarm might
293one day help with this, but perhaps not: Swarm seems to push the problem
294around; it doesn't solve the core issue: ROS messages contain port
295numbers, 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)
299that perhaps version 1.10 of docker does not have these problems. I
300have not yet tried.
301
302## Version C: Desperation.
303There are several stunts that one might think could work, but they
304don't. A brief report here.
305
306### Remap all the ports
307That is, start the Docker container with something like this:
308`-p 32768-65536:32768-65536`. *DO NOT EVEN TRY THIS* -- you'll be
309sorry if you do. If you do, it will take Docker five minutes to remap
310about 2K of these ports, at which point you will wonder what's going
311on. 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`
314will tell you how many its done so far. Problem: you can't stop the
315container. You can `kill -9` it, but the proxying keeps going on. We're
316in a bad state now, so you can try `service docker stop` which won't
317work, so you can `kill -9` it. Which works. However `service docker
318start` leaves vast quantities of crap in `iptables`, which you can
319clean with `iptables -t nat -F`. However, `service docker start` merely
320recreates these bogus filters. So you have to `iptables` while Docker is
321running. Which hoses Docker, so you have to stop and restart again.
322Anyway, the unclean docker shutdown also left crap in `aufs` -- some
323dead docker containers that cannot be `docker rm`'ed. If you are brave,
324you can now go into `/var/lib/docker/aufs` and clean up by hand. Or
325you can reboot ... Ugh.
326
327### Speaking of iptables...
328Several stack-exchange questions deal with using `iptables` to remap
329ports between docker containers and the host. If you're naive, you might
330hope that that will solve the problem. It won't. The core issue is that
331ROS messages contain port numbers in them, and Docker remaps ports. The
332only way that masquerading could be don't would be just like
333masquerading for FTP: you have to inspect the packets themselves, find
334the port number in them, and then re-write the port number. Since some
335ROS messages are strings, this can be challenging. Checksums and gzip
336add to the mess.
337
338### Use the host network
339Start all of the containers with `--net=host`. This will cause Docker
340to not use its own private networks, but instead, use the IP address of
341the host for all networking. From the Docker point of view, its really
342not ideal, its a kind-of-a-hack. From the ROS point of view, you might
343expect that everything will now start working, since, after all, there
344are no more networking barriers anywhere. Right? Almost!
345
346With this network setting, you can now publish, with `rostopic pub`
347inside the container, and subscribe, with `rostopic echo` on the
348outside, and this now works. The toy example works! At last! Woot!
349
350Unfortunately, that's all that works. The real-life ROS nodes inside the
351ros-eva container are publishing messages that still cannot be heard
352outside of the container: specifically, `rostopic echo /camera/face_locations`
353fails. You might think that it should work. It doesn't. I don't
354understand why it doesn't, when the toy examples do work. Clearly,
355there's yet more to ROS networking, and the Docker `--net=host` is not
356enough to make things transparent.
357
358## Version D: Hard reality
359The misery documented above points us in only one direction. Its not a
360pretty one... its not `docker compose` and its conceptually icky and
361not a good software design. However, its the only solution that works:
362Stick all of OpenCog (specifically, the CogServer) into the same Docker
363container with ROS. That will be one giant bloated container. But
364that's what the school of hard knocks teaches you.
indigo/arthur-animation/Dockerfile +40 -0
……@@ -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
10FROM opencog/ros-indigo-blender
11MAINTAINER Linas Vepstas "linasvepstas@gmail.com"
12
13WORKDIR /catkin_ws/src
14
15# Packages to install
16# The basic_head_api repo contains the messages
17RUN git clone https://github.com/hansonrobotics/basic_head_api
18# The robo_blender contains the head and animation scripts
19RUN git clone https://github.com/hansonrobotics/robo_blender
20# The pau2motors is where required PAU messages are defined
21RUN git clone https://github.com/hansonrobotics/pau2motors
22
23# Change line below to rebuild. Will use cached docker iamges up to
24# this line
25ENV LAST_SOFTWARE_UPDATE 2014-12-18
26
27# Git pull for all packages
28RUN 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!??
32WORKDIR /catkin_ws
33RUN . /opt/ros/indigo/setup.sh; /opt/ros/indigo/bin/catkin_make
34
35ADD /scripts/arthur.sh /catkin_ws/arthur.sh
36ADD /scripts/demo-hints.txt /catkin_ws/demo-hints.txt
37RUN chmod ugo+x ./arthur.sh
38CMD ./arthur.sh
39
40# CMD /bin/bash
indigo/arthur-animation/README.md +26 -0
……@@ -0,0 +1,26 @@
1
2Facial Expression Animation Demo
3================================
4
5Demo of controlling basic facial animations with the Hanson Robotics
6Arthur blender head. Running this container will start the Arthur head
7in animation mode, and then print a short menu of suggested animations
8to try out. Facial expressions include 'happy', 'sad', 'surprised' and
9'angry'. The animations are started and stopped using ROS messages. See
10the 'demo-hints.txt' file in this directory for the demo instructions.
11
12The demo can be started by saying `./run.sh` and can be halted by saying
13`./stop.sh`.
14
15Alternately, you can run this image by saying:
16```
17xhost +
18sudo 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:
24xhost -
25```
26
indigo/arthur-animation/run.sh +19 -0
……@@ -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#
10echo -n 'Stopping leftover container.. '
11docker stop -t 1 arthur-animation-demo
12echo -n 'Removing.. '
13docker rm arthur-animation-demo
14xhost +
15docker 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
19xhost -
indigo/arthur-animation/scripts/arthur.sh +25 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13byobu new-session -d -n 'roscore' 'roscore; $SHELL'
14sleep 2;
15byobu new-window -n 'blender' 'cd /catkin_ws/src/robo_blender/src && blender animate-test.blend --enable-autoexec --python startup.py; $SHELL'
16sleep 6;
17byobu 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
20echo "tmux_left=\"session\"" > $HOME/.byobu/status
21echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
22tmux attach
23
24echo "Started"
25$SHELL
indigo/arthur-animation/scripts/demo-hints.txt +22 -0
……@@ -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']
5rostopic echo -n 1 /animations_list
6
7# Perform one of the supported animations
8rostopic pub --once /cmd_animations std_msgs/String play:sad-1
9
10# Verify that tracking output is sent to the PAU motors
11rostopic echo /dmitry/cmd_eyes_pau
12
13# Pause the animation
14rostopic pub --once /cmd_animations std_msgs/String pause
15
16# Restart the animation
17rostopic pub --once /cmd_animations std_msgs/String play
18
19# Halt the animation
20rostopic pub --once /cmd_animations std_msgs/String stop
21
22# View this help text again, say 'cat /catkin_ws/demo-hints.txt'
indigo/arthur-animation/stop.sh +12 -0
……@@ -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#
9echo -n 'Stopping leftover container.. '
10docker stop -t 1 arthur-animation-demo
11echo -n 'Removing.. '
12docker rm arthur-animation-demo
indigo/arthur-dev/Dockerfile +75 -0
……@@ -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#
10FROM opencog/ros-indigo-blender
11MAINTAINER Vytas Krisciunas "vytas@hansonrobotics.com"
12MAINTAINER Linas Vepstas "linasvepstas@gmail.com"
13
14# Install required packages
15RUN apt-get -y update
16RUN 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
19RUN apt-get -y install python-serial python-pycurl python-pyglet python-pip
20RUN apt-get -y install mplayer
21# RUN apt-get -y install libcurl3 libavbin-dev libavbin0 libav-tools
22
23# Install pi_vision
24WORKDIR /opt/ros/indigo/share
25RUN git clone https://github.com/ericperko/uvc_cam.git
26RUN git clone -b multiple_2d https://github.com/hansonrobotics/pi_vision.git
27RUN bash -l -c "source /.bashrc;rosmake pi_vision"
28
29# Owyl setup
30WORKDIR /opt/
31RUN git clone https://github.com/eykd/owyl.git
32WORKDIR /opt/owyl/
33RUN python setup.py install
34
35# Install catkin packages
36WORKDIR /catkin_ws/src
37
38# The basic_head_api repo contains the messages
39RUN git clone https://github.com/hansonrobotics/basic_head_api
40# The robo_blender contains the head and animation scripts
41RUN git clone https://github.com/hansonrobotics/robo_blender
42# The pau2motors is where required PAU messages are defined
43RUN git clone https://github.com/hansonrobotics/pau2motors
44
45RUN git clone https://github.com/hansonrobotics/ros_pololu_servo.git
46RUN git clone https://github.com/hansonrobotics/ros_motors_webui.git
47RUN git clone https://github.com/hansonrobotics/robots_config.git
48RUN git clone https://github.com/hansonrobotics/chatbot.git
49RUN git clone https://github.com/hansonrobotics/eva_behavior.git
50RUN git clone https://github.com/hansonrobotics/ros_faceshift.git
51
52# Change line below to rebuild. Will use cache up to this line
53ENV LAST_SOFTWARE_UPDATE 2014-12-08
54
55# Git pull for all packages
56RUN find . -maxdepth 1 -mindepth 1 -type d \
57 -execdir git --git-dir=$PWD/{}/.git --work-tree=$PWD/{} pull \;
58
59# CMake
60WORKDIR /catkin_ws
61RUN bash -l -c "/usr/bin/python3 /opt/ros/indigo/bin/catkin_make"
62
63RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc
64
65#Ports exposed
66EXPOSE 9090
67EXPOSE 80
68EXPOSE 33433
69
70# The launch script
71ADD /scripts/arthur-dev.sh /catkin_ws/arthur-dev.sh
72RUN chmod ugo+x ./arthur-dev.sh
73
74ENTRYPOINT bash -l -c "cd /catkin_ws/; ./arthur-dev.sh; bash"
75
indigo/arthur-dev/README.md +34 -0
……@@ -0,0 +1,34 @@
1
2Robot Head Development
3======================
4
5Full configuration for animating the Hanson Robotics Arthur blender
6head. Running this container will start the UVC video camera drivers,
7the pi_vision face discovery module, the eva_behavior module that
8implements scrripted behaviors, two blender windows for the Arthur head,
9the PAU-2-motor control module, and the Pololu brand motor controllers.
10The Web user interfaces is also started.
11
12The behavior of the robot head can be controlled by aiming a web browser
13at http://localhost. This uses the default http port number of 80; this
14can be changed in the `run.sh` startup file.
15
16By default, the `/dev/video0` device is used as a webcam for face
17tracking. It can be changed in `run.sh` file.
18
19The container can be started by saying `./run.sh` and can be halted by
20saying `./stop.sh`.
21
22Alternately, you can run this image by saying:
23```
24xhost +
25sudo 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:
33xhost -
34```
indigo/arthur-dev/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build the arthuer docker image
6#
7docker build -t opencog/ros-arthur-dev .
indigo/arthur-dev/run.sh +21 -0
……@@ -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#
10echo -n 'Stopping leftover container.. '
11docker stop -t 1 hr-arthur-devel
12echo -n 'Removing.. '
13docker rm hr-arthur-devel
14xhost +
15docker 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
21xhost -
indigo/arthur-dev/scripts/arthur-dev.sh +40 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work
15byobu new-session -d -n 'roscore' 'roscore; $SHELL'
16sleep 2;
17tmux new-window -n 'arthur' 'roslaunch robots_config arthur-dev.launch; $SHELL'
18sleep 6;
19
20# Start web server for providing a nice UI for the animations.
21tmux new-window -n 'rosbridge' 'roslaunch rosbridge_server rosbridge_websocket.launch'
22tmux 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
25tmux new-window -n 'blndr-trk' 'cd /catkin_ws/src/robo_blender/src && blender robo.blend --enable-autoexec --python startup.py; $SHELL'
26tmux 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
29tmux new-window -n 'camera' 'roslaunch ros2opencv uvc_cam.launch'
30tmux new-window -n 'face' 'roslaunch pi_face_tracker face_tracker_uvc_cam.launch'
31
32# Spare-usage shell
33tmux new-window -n 'bash' '$SHELL'
34
35# Fix the annoying byobu display
36echo "tmux_left=\"session\"" > $HOME/.byobu/status
37echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
38tmux attach
39
40echo "Started"
indigo/arthur-dev/stop.sh +12 -0
……@@ -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#
9echo -n 'Stopping leftover container.. '
10docker stop -t 1 hr-arthur-devel
11echo -n 'Removing.. '
12docker rm hr-arthur-devel
indigo/build-all.sh +25 -0
……@@ -0,0 +1,25 @@
1#! /bin/bash
2#
3# build-all.sh
4#
5# Handy dandy snippet to build the current demo images.
6#
7cd ros-base
8./build.sh
9cd ..
10
11cd ros-opencog
12./build.sh
13cd ..
14
15cd ros-incog-blender
16./build.sh
17cd ..
18
19# cd eva-silent
20# ./build.sh
21# cd ..
22
23cd eva-opencog
24./build.sh
25cd ..
indigo/build-old.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# build-old.sh
4#
5# Handy dandy snippet to build the old images.
6#
7cd ros-base
8./build.sh
9cd ..
10
11cd ros-blender
12./build.sh
13cd ..
14
15cd eva-owyl
16./build.sh
17cd ..
indigo/dev/Dockerfile +36 -0
……@@ -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
6FROM opencog/ros-indigo-base
7MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
8MAINTAINER 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
13RUN 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
24RUN apt-get -y update
25RUN apt-get -y install camorama geany
26RUN apt-get -y install cmake-curses-gui git mercurial subversion
27RUN apt-get -y install less meld vim-gnome
28
29# Environment Variables
30## Set Locale -- Catkin crashes on Krisčiunas, Mickevičius without this.
31RUN locale-gen en_US.UTF-8
32ENV LANG en_US.UTF-8
33ENV LANGUAGE en_US:en
34ENV LC_ALL en_US.UTF-8
35
36CMD /bin/bash
indigo/dev/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build this docker image.
6#
7docker build -t opencog/ros-indigo-dev .
indigo/docker-cleanup.sh +22 -0
……@@ -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")
8TAINERS=`docker ps -aq -f "status=exited" -f "status=dead"`
9if test x"$TAINERS" != x; then
10 echo -n 'Removing exited containers...'
11 docker rm $TAINERS
12fi
13
14# Next, remove failed images.
15# docker rmi $(docker images -q -f "dangling=true")
16MAGES=`docker images -q -f "dangling=true"`
17if test x"$MAGES" != x; then
18 echo -n 'Removing dangling images'
19 docker rmi $MAGES
20fi
21
22# docker rmi $(docker images --filter dangling=true)
indigo/einstein/Dockerfile +57 -0
……@@ -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
10FROM opencog/ros-indigo-dev
11MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
12MAINTAINER David Hart "dhart@opencog.org"
13
14RUN apt-get -y update
15RUN apt-get -y install blender
16
17RUN apt-get -y install python3-yaml python3-pip
18RUN pip3 install rospkg catkin_pkg
19
20RUN 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
23WORKDIR /catkin_ws/src
24RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh
25ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages
26RUN /usr/bin/python3 /opt/ros/indigo/bin/catkin_init_workspace
27
28RUN git clone https://github.com/hansonrobotics/robo_blender
29RUN git clone https://github.com/yantrabuddhi/ros_pololu_servo
30RUN git clone https://github.com/yantrabuddhi/ros_nmpt_saliency
31RUN git clone https://github.com/yantrabuddhi/ros_faceshift
32RUN git clone https://github.com/yantrabuddhi/simple_face_tracker
33RUN git clone https://github.com/OctoMap/octomap
34
35WORKDIR /catkin_ws
36RUN bash -l -c "/usr/bin/python3 /opt/ros/indigo/bin/catkin_make"
37
38WORKDIR /catkin_ws/src/robo_blender/src
39
40ENV STARTSCRIPT "\
41echo evaluating startup script... &&\
42source /catkin_ws/devel/setup.bash &&\
43tmux new-session -d 'echo -e \"\e[1;34mroscore\e[0m\" ; roscore' &&\
44tmux set -g set-remain-on-exit on &&\
45tmux set-option -g set-remain-on-exit on &&\
46tmux bind-key R respawn-window &&\
47tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_pololu_servo\e[0m\" ;\
48 rosrun ros_pololu_servo ros_pololu_servo_node' &&\
49tmux split-window -d -v -p 25 'echo -e \"\e[1;34mblender robo.blend\e[0m\" ;\
50 sleep 4 && blender robo.blend' &&\
51tmux split-window -d -v -p 25 'echo -e \"\e[1;34mbash shell\e[0m\" ;\
52 bash -l -i' &&\
53tmux select-layout even-vertical &&\
54tmux attach \
55"
56
57CMD /bin/bash -l -c "eval $STARTSCRIPT"
indigo/einstein/README.md +8 -0
……@@ -0,0 +1,8 @@
1ros-indigo-einstein
2===================
3
4An integrated development container for teleoperating Hanson Robotics' small
5Einstein head. This container was demo'd at ROS Kong 2014 by David Hanson.
6
7The Einstein head contains servos driven by a Pololu board and controlled
8via Blender. Saliency detection is TBD.
indigo/einstein/einstein.sh +10 -0
……@@ -0,0 +1,10 @@
1#!/bin/bash
2echo "Starting"
3tmux new-session -n 'einstein' -d ' roslaunch robots_config einstein.launch; $SHELL'
4sleep 5;
5export ROS_NAMESPACE=/einstein
6tmux new-window -n 'rosbridge' 'roslaunch rosbridge_server rosbridge_websocket.launch; $SHELL'
7tmux new-window -n 'webserver' 'cd /catkin_ws/src/ros_motors_webui && python -m SimpleHTTPServer; $SHELL'
8tmux attach;
9echo "Started"
10
indigo/eva-opencog/Dockerfile +95 -0
……@@ -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#
9FROM opencog/ros-incog-blender
10MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
11
12# Install required packages
13ENV LAST_OS_UPDATE 2015-02-16
14RUN apt-get -y update
15RUN apt-get -y upgrade
16# The perception node needs ros-indigo-dynamixel-msgs and
17# the joint/robot-state publishers
18RUN 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
27WORKDIR /catkin_ws/src
28
29RUN git clone https://github.com/hansonrobotics/pi_vision.git
30RUN git clone https://github.com/hansonrobotics/perception.git
31RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git
32RUN 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.
36RUN git clone https://github.com/hansonrobotics/pau2motors.git
37RUN 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
48RUN 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
51ENV LAST_SOFTWARE_UPDATE 2016-03-01
52
53# Git pull for all OpenCog packages
54RUN 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
59RUN (cd /opencog/opencog/build; cmake ..; make install)
60
61# Install the behaviors as a module.
62RUN (mkdir /opencog/ros-behavior-scripting/build; \
63 cd /opencog/ros-behavior-scripting/build; \
64 cmake ..; make install)
65
66# Pre-compile the guile modules.
67RUN (bash -l -c "echo \"(use-modules (opencog eva-model))\" | guile ")
68RUN (bash -l -c "echo \"(use-modules (opencog eva-behvaior))\" | guile ")
69
70# Git pull for all ROS packages
71RUN 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.
75RUN 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.)
81WORKDIR /catkin_ws
82RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true
83RUN bash -l -c "/opt/ros/indigo/bin/catkin_make"
84
85RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc
86
87COPY /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
95ENTRYPOINT bash -l -c "./eva.sh; bash"
indigo/eva-opencog/README.md +50 -0
……@@ -0,0 +1,50 @@
1eva-opencog
2===========
3
4An image containing the OpenCog + Hanson Robotics Eva robot.
5This is the whole kit-n-kaboodle. In development. Probably broken.
6
7The 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
16The 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
22Run the `./build.sh` file in this directory. You need to have built
23the `ros-incog-blender` image (in the `../ros-incog-blender` directory)
24first.
25
26## Testing
27To verify that blender works, run the `./run.sh` shell script.
28This will start blender and the half-dozen ROS nodes that control it.
29You should see a living, breating Eva.
30
31You can chat to Eva by going to the guile prompt, and typing in
32chat 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
40Turn on the non-verbal behaviors by saying:
41```
42(run)
43```
44
45If 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.
indigo/eva-opencog/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for eva-opencog
4#
5docker build -t opencog/eva-opencog .
indigo/eva-opencog/run.sh +21 -0
……@@ -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
8xhost +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
14docker 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
20xhost -local:root
21clear
indigo/eva-opencog/scripts/eva.sh +50 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work.
15byobu new-session -d -n 'ros' 'roscore; $SHELL'
16sleep 4;
17
18# Run the relex parse server.
19tmux new-window -n 'rlx' 'cd /opencog/relex && ./opencog-server.sh ; $SHELL'
20
21# Single Video (body) camera and face tracker.
22tmux 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.
26tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL'
27
28### Start the blender GUI.
29tmux 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.
32tmux 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!?
36tmux new-window -n 'cog' 'cd /opencog/ros-behavior-scripting/src && guile -l btree-eva.scm ; $SHELL'
37sleep 5
38
39# Run the new face tracker.
40tmux new-window -n 'fac' 'cd /opencog/ros-behavior-scripting/face_track && ./main.py ; $SHELL'
41
42# Spare-usage shell
43tmux new-window -n 'bash' '$SHELL'
44
45# Fix the annoying byobu display.
46echo "tmux_left=\"session\"" > $HOME/.byobu/status
47echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
48tmux attach
49
50echo "Started"
indigo/eva-opencog/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep eva-opencog |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep eva-opencog`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm eva-opencog
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
indigo/eva-owyl/Dockerfile +75 -0
……@@ -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#
12FROM opencog/ros-indigo-blender
13MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
14
15# Install required packages
16ENV LAST_OS_UPDATE 2015-02-16
17RUN apt-get -y update
18RUN apt-get -y upgrade
19RUN apt-get -y install ros-indigo-tf ros-indigo-driver-common
20RUN apt-get -y install ros-indigo-cv-bridge ros-indigo-image-transport
21RUN apt-get -y install ros-indigo-openni-camera ros-indigo-mjpeg-server
22RUN apt-get -y install ros-indigo-usb-cam
23# The below are needed by perception node
24RUN apt-get -y install ros-indigo-dynamixel-msgs
25RUN apt-get -y install ros-indigo-robot-state-publisher
26RUN apt-get -y install ros-indigo-joint-state-publisher
27
28# Owyl setup
29WORKDIR /opt/
30RUN git clone https://github.com/eykd/owyl.git
31WORKDIR /opt/owyl/
32RUN python setup.py install
33
34# Install catkinized packages
35WORKDIR /catkin_ws/src
36
37RUN git clone https://github.com/hansonrobotics/pi_vision.git
38RUN git clone https://github.com/hansonrobotics/perception.git
39RUN git clone https://github.com/hansonrobotics/eva_behavior.git
40RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git
41RUN 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.
45RUN git clone https://github.com/hansonrobotics/pau2motors.git
46RUN 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
54ENV LAST_SOFTWARE_UPDATE 2015-02-19
55
56# Git pull for all packages
57RUN 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.
61RUN 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.)
67WORKDIR /catkin_ws
68RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true
69RUN bash -l -c "/opt/ros/indigo/bin/catkin_make"
70
71RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc
72
73COPY /scripts/eva.sh /catkin_ws/eva.sh
74
75ENTRYPOINT bash -l -c "./eva.sh; bash"
indigo/eva-owyl/README.md +48 -0
……@@ -0,0 +1,48 @@
1eva-owyl
2========
3
4Eva is an animated female head, capable of seeing you via a webcam,
5and engaging you in social interaction, making eye contact, and
6expressing her pleasure with smiles and looks of surprise and happiness.
7
8There are several Eva demos. This is a stand-alone demo of the basic
9Hanson Robotics Eva blender rig, showing the full range of emotional
10facial expressions, ranging from happiness to frustration, excitement
11to boredom, as well as gestures such as shakes, nods, blinks and a
12keep-alive breathing cycle.
13
14This docker image includes vision processing and basic human-face
15awareness behavior, but without a chatbot or any OpenCog processing
16software. The behaviors are controlled by a simple behavior-tree
17script implemented using Owyl. When the docker image is started, the
18demo starts and runs automatically; she should be able to see you
19(and your guests) through your webcam, and interact with all of you
20in a most charming way. This demo is roughly representative of the
21state of the Hanson Robotics Eva development, as of April 2015.
22
23The 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
41Run the `build.sh` file in this directory. You need to have built
42the ros-indigo-blender image (in the `../blender` directory) first.
43
44## Testing
45To verify that blender works, run the `run.sh` shell script.
46This will start blender and the half-dozen ROS nodes that control it.
47You should see a living, breating Eva who smiles at you and tries to
48make and maintain eye contact as you move around.
indigo/eva-owyl/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for eva
4#
5docker build -t opencog/eva-owyl .
indigo/eva-owyl/run.sh +18 -0
……@@ -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
8xhost +local:root
9
10# Assorted grunge to let X11 use the 3D graphics acceleration.
11docker 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
17xhost -local:root
18clear
indigo/eva-owyl/scripts/eva.sh +33 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work
15byobu new-session -d -n 'roscore' 'roscore; $SHELL'
16sleep 4;
17
18# Single Video (body) camera and face tracker
19tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL'
20# Publish the geometry messages
21tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL'
22tmux new-window -n 'bhave' 'rosrun eva_behavior main.py; $SHELL'
23tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL'
24
25# Spare-usage shell
26tmux new-window -n 'bash' 'sleep 4; rostopic pub --once /behavior_switch std_msgs/String btree_on; $SHELL'
27
28# Fix the annoying byobu display
29echo "tmux_left=\"session\"" > $HOME/.byobu/status
30echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
31tmux attach
32
33echo "Started"
indigo/eva-owyl/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep eva-owyl |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container.. '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep eva-owyl`
11if test x"$TAINER" != x; then
12 echo -n 'Removing.. '
13 docker rm eva-owyl
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
indigo/eva-ros/Dockerfile +74 -0
……@@ -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#
10FROM opencog/ros-indigo-blender
11MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
12
13# Install required packages
14ENV LAST_OS_UPDATE 2015-02-16
15RUN apt-get -y update
16RUN apt-get -y upgrade
17RUN apt-get -y install ros-indigo-tf ros-indigo-driver-common
18RUN apt-get -y install ros-indigo-cv-bridge ros-indigo-image-transport
19RUN apt-get -y install ros-indigo-openni-camera ros-indigo-mjpeg-server
20RUN apt-get -y install ros-indigo-usb-cam
21# The below are needed by perception node
22RUN apt-get -y install ros-indigo-dynamixel-msgs
23RUN apt-get -y install ros-indigo-robot-state-publisher
24RUN apt-get -y install ros-indigo-joint-state-publisher
25
26# Install catkinized packages
27WORKDIR /catkin_ws/src
28
29RUN git clone https://github.com/hansonrobotics/pi_vision.git
30RUN git clone https://github.com/hansonrobotics/perception.git
31RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git
32RUN 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.
36RUN git clone https://github.com/hansonrobotics/pau2motors.git
37RUN 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
49ENV LAST_SOFTWARE_UPDATE 2015-02-19
50
51# Git pull for all packages
52RUN 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.
56RUN 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.)
62WORKDIR /catkin_ws
63RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true
64RUN bash -l -c "/opt/ros/indigo/bin/catkin_make"
65
66RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc
67
68COPY /scripts/eva.sh /catkin_ws/eva.sh
69
70# Ports exposed
71# 11311 is roscore
72EXPOSE 11311
73
74ENTRYPOINT bash -l -c "./eva.sh; bash"
indigo/eva-ros/README.md +28 -0
……@@ -0,0 +1,28 @@
1eva-ros
2=======
3
4An image containing the Hanson Robotics Eva blender rig, and the ROS
5vision subsystem. It does not contain any parts of OpenCog, or a
6chatbot, nor any behavior controls; its just blender+vision.
7
8The 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
21Run the `build.sh` file in this directory. You need to have built
22the ros-indigo-blender image (in the `../blender` directory) first.
23
24## Testing
25To verify that blender works, run the `run.sh` shell script.
26This will start blender and the half-dozen ROS nodes that control it.
27You should see a living, breating Eva; however, she is lobotimized:
28there's no brain, she cannot actually see you, and will not react.
indigo/eva-ros/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for eva-ros
4#
5docker build -t opencog/eva-ros .
indigo/eva-ros/run.sh +19 -0
……@@ -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
8xhost +local:root
9
10# Assorted grunge to let X11 use the 3D graphics acceleration.
11# 11311 is the roscore port
12docker 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
18xhost -local:root
19clear
indigo/eva-ros/scripts/eva.sh +32 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work
15byobu new-session -d -n 'roscore' 'roscore; $SHELL'
16sleep 4;
17
18# Single Video (body) camera and face tracker
19tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL'
20# Publish the geometry messages
21tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL'
22tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL'
23
24# Spare-usage shell
25tmux new-window -n 'bash' '$SHELL'
26
27# Fix the annoying byobu display
28echo "tmux_left=\"session\"" > $HOME/.byobu/status
29echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
30tmux attach
31
32echo "Started"
indigo/eva-ros/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep eva-ros |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep eva-ros`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm eva-ros
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
indigo/eva-silent/Dockerfile +76 -0
……@@ -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#
9FROM opencog/ros-incog-blender
10MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
11
12# Install required packages
13ENV LAST_OS_UPDATE 2015-02-16
14RUN apt-get -y update
15RUN apt-get -y upgrade
16# The perception node needs ros-indigo-dynamixel-msgs and
17# the joint/robot-state publishers
18RUN 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
27WORKDIR /catkin_ws/src
28
29RUN git clone https://github.com/hansonrobotics/pi_vision.git
30RUN git clone https://github.com/hansonrobotics/perception.git
31RUN git clone https://github.com/hansonrobotics/blender_api_msgs.git
32RUN 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.
36RUN git clone https://github.com/hansonrobotics/pau2motors.git
37RUN 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
48RUN 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
51ENV LAST_SOFTWARE_UPDATE 2016-02-19
52
53# Git pull for all packages
54RUN 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.
58RUN 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.)
64WORKDIR /catkin_ws
65RUN bash -l -c "/opt/ros/indigo/bin/catkin_make" || true
66RUN bash -l -c "/opt/ros/indigo/bin/catkin_make"
67
68RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc
69
70COPY /scripts/eva.sh /catkin_ws/eva.sh
71
72# Ports exposed
73# 11311 is roscore
74EXPOSE 11311
75
76ENTRYPOINT bash -l -c "./eva.sh; bash"
indigo/eva-silent/README.md +31 -0
……@@ -0,0 +1,31 @@
1eva-silent
2==========
3
4An image containing the OpenCog + Hanson Robotics Eva mute robot.
5This is the robot with vision and face tracking, and behaviors,
6but no chatbot.
7
8The 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
21Run the `./build.sh` file in this directory. You need to have built
22the `ros-incog-blender` image (in the `../ros-incog-blender` directory)
23first.
24
25## Testing
26To verify that blender works, run the `./run.sh` shell script.
27This will start blender and the half-dozen ROS nodes that control it.
28You should see a living, breating Eva; she should be able to "see" you
29and react to your presence by attempting to make eye-contact, smiling
30and being interested. If she can't see anything, she'll look bored, and
31eventually fall asleep.
indigo/eva-silent/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for eva-silent
4#
5docker build -t opencog/eva-silent .
indigo/eva-silent/run.sh +19 -0
……@@ -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
8xhost +local:root
9
10# Assorted grunge to let X11 use the 3D graphics acceleration.
11# 11311 is the roscore port
12docker 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
18xhost -local:root
19clear
indigo/eva-silent/scripts/eva.sh +37 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work
15byobu new-session -d -n 'roscore' 'roscore; $SHELL'
16sleep 4;
17
18# Single Video (body) camera and face tracker
19tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL'
20# Publish the geometry messages
21tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL'
22tmux 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.
25tmux new-window -n 'fac' 'cd /opencog/ros-behavior-scripting/face_track && ./main.py ; $SHELL'
26
27tmux new-window -n 'bhv' 'cd /opencog/ros-behavior-scripting/src && guile -l btree.scm ; $SHELL'
28
29# Spare-usage shell
30tmux new-window -n 'bash' '$SHELL'
31
32# Fix the annoying byobu display
33echo "tmux_left=\"session\"" > $HOME/.byobu/status
34echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
35tmux attach
36
37echo "Started"
indigo/eva-silent/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep eva-silent |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep eva-silent`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm eva-silent
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
indigo/ros-base/Dockerfile +47 -0
……@@ -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#
11FROM ubuntu:14.04
12MAINTAINER 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
16ENV DEBIAN_FRONTEND noninteractive
17
18ENV LAST_OS_UPDATE 2016-02-29
19RUN apt-get -y update
20RUN apt-get -y upgrade
21
22# Need software-properties-common for `add-apt-repository` command
23RUN apt-get -y install wget software-properties-common
24RUN wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
25RUN echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list
26RUN 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.
31RUN apt-get -y install ros-indigo-ros-base ros-indigo-angles
32RUN apt-get -y install git tmux byobu vim
33
34# Make vim be usable instead of insane.
35COPY /scripts/.vimrc /root/
36
37# Environment Variables
38## Set Locale -- Catkin crashes on Krisčiunas, Mickevičius without this.
39RUN locale-gen en_US.UTF-8
40ENV LANG en_US.UTF-8
41ENV LANGUAGE en_US:en
42ENV LC_ALL en_US.UTF-8
43
44RUN rosdep init
45RUN rosdep update
46RUN echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
47CMD /bin/bash
indigo/ros-base/README.md +17 -0
……@@ -0,0 +1,17 @@
1ros-indigo-base
2===============
3
4The base image for building other docker imagess that use ROS. The
5container installs and configures a fair variety of ROS packages
6needed for running ROS nodes. No actual ROS nodes are started.
7
8## Building
9
10Run the `build.sh` file in this directory. You need to have first
11obtained (downloaded) the ubuntu:14.04 image from Docker.
12
13## Testing
14To verify that things works, run the `run.sh` shell script.
15This should result in a shell prompt inside the docker container.
16You can start roscore simply by saying `roscore`. Of course, roscore
17by itself, does not do anything interesting...
indigo/ros-base/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build the base image images.
6#
7docker build -t opencog/ros-indigo-base .
indigo/ros-base/run.sh +11 -0
……@@ -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!
10docker run --name="ros-base" \
11 -p 11311:11311 -it opencog/ros-indigo-base
indigo/ros-base/scripts/.vimrc +22 -0
……@@ -0,0 +1,22 @@
1set wrapmargin=8
2set ts=3
3set showmode
4set noautoindent
5set encoding=utf-8
6
7" Sets the color scheme to something easier on my eyes.
8colo evening
9
10" Only do this part when compiled with support for autocommands.
11if 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
20endif " has("autocmd")
21
22" /etc/vimrc ends here
indigo/ros-base/stop.sh +14 -0
……@@ -0,0 +1,14 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep ros-base |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container.. '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep ros-base`
11if test x"$TAINER" != x; then
12 echo -n 'Removing.. '
13 docker rm ros-base
14fi
indigo/ros-blender/Dockerfile +62 -0
……@@ -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#
20FROM opencog/ros-indigo-base
21MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
22MAINTAINER David Hart "dhart@opencog.org"
23MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
24
25ENV 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
31RUN add-apt-repository ppa:irie/blender
32RUN apt-get -y update
33RUN 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
39RUN 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.
44RUN pip3 install rospkg catkin_pkg
45
46WORKDIR /catkin_ws/src
47RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh
48ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages
49RUN /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.
53WORKDIR /catkin_ws
54RUN 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
58RUN 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
61ENV DISPLAY :0.0
62CMD /bin/bash
indigo/ros-blender/README.md +18 -0
……@@ -0,0 +1,18 @@
1ros-indigo-blender
2==================
3
4A docker image that installs both ROS and blender, for demoing
5ROS-controlled blender animations. The image holds only the base
6packages needed for running blender and ROS together; no actual ROS
7nodes are started, no blender animations are run.
8
9## Building
10
11Run the `build.sh` file in this directory. You need to have built
12the base ROS image (in the `../ros-base` directory) first.
13
14## Testing
15To verify that blender works, run the `run.sh` shell script.
16This should result in a shell prompt inside the docker container.
17You can start blender simply by saying `blender`; it should display
18on your desktop.
indigo/ros-blender/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build this docker image.
6#
7docker build -t opencog/ros-indigo-blender .
indigo/ros-blender/run.sh +16 -0
……@@ -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
8xhost +local:root
9
10docker 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
16xhost -local:root
indigo/ros-blender/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep ros-blender |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container.. '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep ros-blender`
11if test x"$TAINER" != x; then
12 echo -n 'Removing.. '
13 docker rm ros-blender
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
indigo/ros-incog-blender/Dockerfile +64 -0
……@@ -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#
24FROM opencog/ros-indigo-opencog
25MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
26
27ENV 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
33RUN add-apt-repository ppa:irie/blender
34RUN apt-get -y update
35RUN 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
41RUN 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.
46RUN pip3 install rospkg catkin_pkg
47
48WORKDIR /catkin_ws/src
49RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh
50ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages
51RUN /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.
55WORKDIR /catkin_ws
56RUN 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
60RUN 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
63ENV DISPLAY :0.0
64CMD /bin/bash
indigo/ros-incog-blender/README.md +18 -0
……@@ -0,0 +1,18 @@
1ros-incog-blender
2=================
3
4A docker image that installs ROS, OpenCog and blender. The image holds
5only the base packages needed for running OpenCog, blender and ROS
6together; no actual ROS nodes are started, the CogServer is not started,
7and no blender animations are run.
8
9## Building
10
11Run the `build.sh` file in this directory. You need to have built
12the opencog image (in the `../ros-opencog` directory) first.
13
14## Testing
15To verify that blender works, run the `run.sh` shell script.
16This should result in a shell prompt inside the docker container.
17You can start blender simply by saying `blender`; it should display
18on your desktop.
indigo/ros-incog-blender/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build this docker image.
6#
7docker build -t opencog/ros-incog-blender .
indigo/ros-incog-blender/run.sh +16 -0
……@@ -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
8xhost +local:root
9
10docker 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
16xhost -local:root
indigo/ros-incog-blender/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep opencog-incog-blender |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container.. '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep opencog-incog-blender`
11if test x"$TAINER" != x; then
12 echo -n 'Removing.. '
13 docker rm opencog-incog-blender
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
indigo/ros-opencog/Dockerfile +163 -0
……@@ -0,0 +1,163 @@
1#
2# Container for ROS+OpenCog
3#
4# To build:
5# sudo docker build -t opencog/ros-indigo-opencog .
6#
7FROM opencog/ros-indigo-base
8MAINTAINER Linas Vepštas "linasvepstas@gmail.com"
9
10# Install required packages
11ENV LAST_OS_UPDATE 2016-02-18
12RUN apt-get -y update
13RUN 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`
16RUN 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.
23RUN 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.
30RUN 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.
36WORKDIR /opencog
37RUN git clone https://github.com/opencog/cogutil.git
38RUN git clone https://github.com/opencog/atomspace.git
39RUN git clone https://github.com/opencog/opencog.git
40RUN git clone https://github.com/opencog/relex.git
41
42# -------------------------------------------------------------
43# Download and install JWNL; its needed for relex.
44WORKDIR /src
45RUN wget http://downloads.sourceforge.net/project/jwordnet/jwnl/JWNL%201.4/jwnl14-rc2.zip
46RUN (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.
55WORKDIR /src
56
57# Touch this tag to grab the latest version of LinkGrammar.
58ENV 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.
66RUN wget -r --no-parent -nH --cut-dirs=2 http://www.abisource.com/downloads/link-grammar/current/
67
68# Unpack the sources, too.
69RUN tar -zxf current/link-grammar-5*.tar.gz
70
71# Need the locales for utf8
72RUN (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
88RUN 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.
93RUN (cd link-grammar-5*; mkdir build; cd build; \
94 ../configure; make -j12; make install; ldconfig)
95
96RUN adduser --disabled-password --gecos "Link Parser User" link-parser
97
98USER link-parser
99RUN (cd /home/link-parser; echo "export LANG=en_US.UTF-8" >> .bash_aliases)
100CMD bash
101
102RUN export LANG=en_US.UTF-8
103
104# -------------------------------------------------------------
105USER root
106WORKDIR /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.
110ENV LAST_SOFTWARE_UPDATE 2016-03-10
111
112# Git pull for all packages
113RUN 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.
117RUN (mkdir /opencog/cogutil/build; cd /opencog/cogutil/build; \
118 cmake ..; make -j6; make install)
119RUN (mkdir /opencog/atomspace/build; cd /opencog/atomspace/build; \
120 cmake ..; make -j12; make install)
121RUN (mkdir /opencog/opencog/build; cd /opencog/opencog/build; \
122 cmake ..; make -j12; make install)
123RUN (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#
136COPY /scripts/.guile /root/
137COPY /scripts/unit-test.sh /root/
138COPY /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.
142RUN (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
160WORKDIR /root
161# ENTRYPOINT bash -l -c "./unit-test.sh; bash"
162ENTRYPOINT bash -l -c "./tmux.sh; bash"
163# CMD /bin/bash
indigo/ros-opencog/README.md +36 -0
……@@ -0,0 +1,36 @@
1ros-opencog
2============
3
4A docker image that installs both ROS and OpenCog. The image holds
5only the base packages needed for running OpenCog and ROS together;
6The CogServer is not started, no ROS nodes are started.
7
8## Building
9
10Run the `build.sh` file in this directory. You need to have built
11the base ROS image (in the `../ros-base` directory) first.
12
13## Testing
14To verify that OpenCog works, run the `run.sh` shell script.
15This will create a tmux (byobu) session inside the docker container.
16There 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```
29Then from another tmux prompt:
30```
31telnet localhost 17001
32(use-modules (opencog))
33(cog-node 'ConceptNode "foobar")
34```
35The above should display `(ConceptNode "foobar" (stv 0.5 0.80000001))`.
36of course!
indigo/ros-opencog/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for ros-opencog
4#
5docker build -t opencog/ros-indigo-opencog .
indigo/ros-opencog/run.sh +9 -0
……@@ -0,0 +1,9 @@
1#! /bin/bash
2#
3# Run the docker container. Stop any previously running copies.
4#
5./stop.sh
6
7docker run --name="cog-ros" -it opencog/ros-indigo-opencog
8
9clear
indigo/ros-opencog/scripts/.guile +14 -0
……@@ -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")
indigo/ros-opencog/scripts/tmux.sh +20 -0
……@@ -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
8byobu new-session -d -n 'bash' '$SHELL'
9
10tmux new-window -n 'b2' '$SHELL'
11tmux new-window -n 'b3' '$SHELL'
12tmux new-window -n 'b4' '$SHELL'
13
14# Spare-usage shell
15tmux new-window -n 'bash' '$SHELL'
16
17# Fix the annoying byobu display
18echo "tmux_left=\"session\"" > $HOME/.byobu/status
19echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
20tmux attach
indigo/ros-opencog/scripts/unit-test.sh +25 -0
……@@ -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#
8echo "Will Run OpenCog unit tests..."
9
10# Use byobu so that the scroll bars actually work
11byobu new-session -d -n 'bash' '$SHELL'
12
13tmux new-window -n 'utils' 'cd /opencog/cogutil/build && make test; $SHELL'
14tmux new-window -n 'atoms' 'cd /opencog/atomspace/build && make test; $SHELL'
15tmux new-window -n 'servr' 'cd /opencog/opencog/build && make test; $SHELL'
16
17# Spare-usage shell
18tmux new-window -n 'bash' '$SHELL'
19
20# Fix the annoying byobu display
21echo "tmux_left=\"session\"" > $HOME/.byobu/status
22echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
23tmux attach
24
25echo "Started"
indigo/ros-opencog/stop.sh +14 -0
……@@ -0,0 +1,14 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep cog-ros |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep cog-ros`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm cog-ros
14fi
indigo/zenorsm/Dockerfile +114 -0
……@@ -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
8FROM opencog/ros-indigo-dev
9MAINTAINER Mandeep Singh Bhatia "mandeep.singh.bhatia@gmail.com"
10MAINTAINER David Hart "dhart@opencog.org"
11
12RUN apt-get -y update
13RUN apt-get -y install blender
14
15RUN apt-get -y install python3-yaml python3-pip
16RUN pip3 install rospkg catkin_pkg
17
18RUN 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
22WORKDIR /catkin_ws/src
23RUN apt-get -y install mplayer python-pycurl libcurl3
24RUN apt-get install libavbin-dev libavbin0
25
26RUN git clone https://github.com/geni-lab/ITFTalk
27
28# Install ITFListen and prerequisites
29WORKDIR /catkin_ws/src
30RUN apt-get -y install sox python-simplejson
31RUN git clone https://github.com/geni-lab/ITFListen
32
33# Install ITFParrot to test ITFListen -> ITFTalk
34WORKDIR /catkin_ws/src
35RUN 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
43RUN 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
72WORKDIR /catkin_ws/src
73RUN cp /opt/ros/indigo/setup.sh /etc/profile.d/ros_indigo.sh
74ENV PYTHONPATH /opt/ros/indigo/lib/python2.7/dist-packages
75RUN /usr/bin/python3 /opt/ros/indigo/bin/catkin_init_workspace
76
77RUN git clone https://github.com/hansonrobotics/robo_blender
78RUN 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
82RUN git clone https://github.com/jdddog/ros_nmpt_saliency
83RUN git clone https://github.com/yantrabuddhi/ros_faceshift
84RUN 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
88WORKDIR /catkin_ws
89RUN bash -l -c "/usr/bin/python3 /opt/ros/indigo/bin/catkin_make"
90
91WORKDIR /catkin_ws/src/robo_blender/src
92
93ENV STARTSCRIPT "\
94echo evaluating startup script... &&\
95source /catkin_ws/devel/setup.bash &&\
96tmux new-session -d 'echo -e \"\e[1;34mroscore\e[0m\" ; roscore' &&\
97tmux set -g set-remain-on-exit on &&\
98tmux set-option -g set-remain-on-exit on &&\
99tmux bind-key R respawn-window &&\
100tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_pololu_servo\e[0m\" ;\
101 rosrun ros_pololu_servo ros_pololu_servo_node' &&\
102tmux split-window -d -v -p 25 'echo -e \"\e[1;34mblender robo.blend\e[0m\" ;\
103 sleep 4 && blender robo.blend' &&\
104tmux split-window -d -v -p 25 'echo -e \"\e[1;34mbash shell\e[0m\" ;\
105 bash -l -i' &&\
106tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_talk\e[0m\" ;\
107 rosrun itf_talk itf_talk.py' &&\
108tmux split-window -d -v -p 25 'echo -e \"\e[1;34mros_itf_listen\e[0m\" ;\
109 rosrun itf_listen itf_listen.py' &&\
110tmux select-layout even-vertical &&\
111tmux attach \
112"
113
114CMD /bin/bash -l -c "eval $STARTSCRIPT"
indigo/zenorsm/README.md +10 -0
……@@ -0,0 +1,10 @@
1ros-indigo-zenorsm
2==================
3
4Based on (copied from) ros-indigo-blender.
5
6An integrated development container for teleoperating Hanson Robotics' small
7Einstein head. This container was demo'd at ROS Kong 2014 by David Hanson.
8
9The Einstein head contains servos driven by a Pololu board and controlled
10via Blender. Saliency detection is TBD.
noetic/README.txt +37 -0
……@@ -0,0 +1,37 @@
1Status of ROS noetic port and bit rot removal
2==============================================
3This project so far is in the Roadmap 1 stage. See below.
4
5Dependencies
6============
7
8eva-ros --> ros-blender --------------------------
9 \
10 \
11eva-silent ---- \
12 \ \
13 v v
14eva-opencog --> ros-incog-blender --> ros-opencog --> ros-base
15
16
17Roadmap
18=======
191. 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?
252. eva-ros works
26 ISSUES:
27 not started
284. eva-silent builds & works
29 ISSUES:
30 not started
315. eva-opencog builds & works
32 ISSUES:
33 not started
34
35For Further Reading
36===================
37See the README.md in ../indigo
noetic/eva-ros/Dockerfile +74 -0
……@@ -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#
10FROM opencog/ros-noetic-blender
11MAINTAINER Mark Wigzell "markwigzell@gmail.com"
12
13# Install required packages
14ENV LAST_OS_UPDATE 2022-02-25
15RUN apt-get -y update
16RUN apt-get -y upgrade
17RUN apt-get -y install ros-noetic-tf ros-noetic-driver-common
18RUN apt-get -y install ros-noetic-cv-bridge ros-noetic-image-transport
19RUN apt-get -y install ros-noetic-usb-cam
20# The below are needed by perception node
21RUN apt-get -y install ros-noetic-robot-state-publisher
22RUN apt-get -y install ros-noetic-joint-state-publisher
23RUN apt-get -y install ros-noetic-joint-state-publisher-gui
24
25# Install catkinized packages
26WORKDIR /catkin_ws/src
27
28RUN git clone https://github.com/opencog/pi_vision.git
29RUN git clone https://github.com/opencog/perception.git
30RUN git clone https://github.com/opencog/blender_api_msgs.git
31RUN 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.
35RUN git clone https://github.com/opencog/pau2motors.git
36RUN 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
48ENV LAST_SOFTWARE_UPDATE 2022-02-25
49
50# Git pull for all packages
51RUN 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.
55RUN pip3 install ./blender_api_msgs/ dlib
56# crappy python. Do we have to switch all our calls whenever python has major release?
57RUN 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)
61WORKDIR /catkin_ws
62RUN bash -l -c "/opt/ros/noetic/bin/catkin_make" || true
63RUN bash -l -c "/opt/ros/noetic/bin/catkin_make"
64
65RUN echo source /catkin_ws/devel/setup.bash >> ~/.bashrc
66
67COPY /scripts/eva.sh /catkin_ws/eva.sh
68COPY /scripts/sophia.sh /catkin_ws/sophia.sh
69
70# Ports exposed
71# 11311 is roscore
72EXPOSE 11311
73
74ENTRYPOINT bash -l -c "./sophia.sh; bash"
noetic/eva-ros/README.md +28 -0
……@@ -0,0 +1,28 @@
1eva-ros
2=======
3
4An image containing the Hanson Robotics Eva blender rig, and the ROS
5vision subsystem. It does not contain any parts of OpenCog, or a
6chatbot, nor any behavior controls; its just blender+vision.
7
8The 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
21Run the `build.sh` file in this directory. You need to have built
22the ros-noetic-blender image (in the `../blender` directory) first.
23
24## Testing
25To verify that blender works, run the `run.sh` shell script.
26This will start blender and the half-dozen ROS nodes that control it.
27You should see a living, breating Eva; however, she is lobotimized:
28there's no brain, she cannot actually see you, and will not react.
noetic/eva-ros/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for eva-ros
4#
5docker build -t opencog/eva-ros .
noetic/eva-ros/run.sh +19 -0
……@@ -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
8xhost +local:root
9
10# Assorted grunge to let X11 use the 3D graphics acceleration.
11# 11311 is the roscore port
12docker 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
18xhost -local:root
19#clear
noetic/eva-ros/scripts/eva.sh +32 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work
15byobu new-session -d -n 'roscore' 'roscore; $SHELL'
16sleep 4;
17
18# Single Video (body) camera and face tracker
19tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL'
20# Publish the geometry messages
21tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL'
22tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Eva.blend -P autostart.py; $SHELL'
23
24# Spare-usage shell
25tmux new-window -n 'bash' '$SHELL'
26
27# Fix the annoying byobu display
28echo "tmux_left=\"session\"" > $HOME/.byobu/status
29echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
30tmux attach
31
32echo "Started"
noetic/eva-ros/scripts/sophia.sh +32 -0
……@@ -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
11source devel/setup.sh
12echo "Starting... this will take 15-20 seconds..."
13
14# Use byobu so that the scroll bars actually work
15byobu new-session -d -n 'roscore' 'roscore; $SHELL'
16sleep 4;
17
18# Single Video (body) camera and face tracker
19tmux new-window -n 'trk' 'roslaunch robots_config tracker-single-cam.launch; $SHELL'
20# Publish the geometry messages
21tmux new-window -n 'geo' 'roslaunch robots_config geometry.launch gui:=false; $SHELL'
22tmux new-window -n 'eva' 'cd /catkin_ws/src/blender_api && blender -y Sophia.blend -P autostart.py; $SHELL'
23
24# Spare-usage shell
25tmux new-window -n 'bash' '$SHELL'
26
27# Fix the annoying byobu display
28echo "tmux_left=\"session\"" > $HOME/.byobu/status
29echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
30tmux attach
31
32echo "Started"
noetic/eva-ros/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep eva-ros |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep eva-ros`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm eva-ros
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
noetic/ros-base/Dockerfile +52 -0
……@@ -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#
11FROM ubuntu:20.04
12MAINTAINER 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
16ENV DEBIAN_FRONTEND noninteractive
17
18ENV LAST_OS_UPDATE 2022-02-25_2
19RUN apt-get -y upgrade
20RUN apt-get -y update
21RUN apt-get -y install iproute2 iputils-ping apt-utils
22
23# Need software-properties-common for `add-apt-repository` command
24RUN apt-get -y install wget software-properties-common sudo
25RUN apt-get -y install --no-install-recommends xserver-xorg-core xauth x11-apps x11-utils
26RUN wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
27RUN echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list
28RUN 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.
33RUN apt-get -y install ros-noetic-ros-base ros-noetic-angles
34RUN apt-get -y install git tmux byobu vim
35
36# Make vim be usable instead of insane.
37COPY /scripts/.vimrc /root/
38
39# Environment Variables
40## Set Locale -- Catkin crashes on Krisčiunas, Mickevičius without this.
41RUN apt-get -y install locales
42RUN locale-gen en_US.UTF-8
43ENV LANG en_US.UTF-8
44ENV LANGUAGE en_US:en
45ENV LC_ALL en_US.UTF-8
46
47RUN apt-get -y install python3-pip
48RUN pip install -U rosdep
49RUN rosdep init
50RUN rosdep update
51RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
52CMD /bin/bash
noetic/ros-base/README.md +17 -0
……@@ -0,0 +1,17 @@
1ros-noetic-base
2===============
3
4The base image for building other docker imagess that use ROS. The
5container installs and configures a fair variety of ROS packages
6needed for running ROS nodes. No actual ROS nodes are started.
7
8## Building
9
10Run the `build.sh` file in this directory. You need to have first
11obtained (downloaded) the ubuntu:14.04 image from Docker.
12
13## Testing
14To verify that things works, run the `run.sh` shell script.
15This should result in a shell prompt inside the docker container.
16You can start roscore simply by saying `roscore`. Of course, roscore
17by itself, does not do anything interesting...
noetic/ros-base/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build the base image images.
6#
7docker build -t opencog/ros-noetic-base .
noetic/ros-base/run.sh +11 -0
……@@ -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!
10docker run --name="ros-base" \
11 -p 11311:11311 -it opencog/ros-noetic-base
noetic/ros-base/scripts/.vimrc +22 -0
……@@ -0,0 +1,22 @@
1set wrapmargin=8
2set ts=3
3set showmode
4set noautoindent
5set encoding=utf-8
6
7" Sets the color scheme to something easier on my eyes.
8colo evening
9
10" Only do this part when compiled with support for autocommands.
11if 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
20endif " has("autocmd")
21
22" /etc/vimrc ends here
noetic/ros-base/stop.sh +14 -0
……@@ -0,0 +1,14 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep ros-base |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container.. '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep ros-base`
11if test x"$TAINER" != x; then
12 echo -n 'Removing.. '
13 docker rm ros-base
14fi
noetic/ros-blender/Dockerfile +55 -0
……@@ -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#
20FROM opencog/ros-noetic-base
21MAINTAINER Mark Wigzell "markwigzell@gmail.com"
22
23ENV 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
30RUN apt-get -y install mesa-utils python3-yaml
31ENV LAST_OS_UPDATE 2022-02-25_2
32################################################################################
33# ROS
34RUN apt-get -y install blender
35# We install ROS package and catkin package management
36RUN pip3 install rospkg catkin_pkg
37
38WORKDIR /catkin_ws/src
39RUN cp /opt/ros/noetic/setup.sh /etc/profile.d/ros_noetic.sh
40RUN 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.
44WORKDIR /catkin_ws
45RUN 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
49RUN 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
54ENV DISPLAY :0.0
55CMD /bin/bash
noetic/ros-blender/README.md +18 -0
……@@ -0,0 +1,18 @@
1ros-noetic-blender
2==================
3
4A docker image that installs both ROS and blender, for demoing
5ROS-controlled blender animations. The image holds only the base
6packages needed for running blender and ROS together; no actual ROS
7nodes are started, no blender animations are run.
8
9## Building
10
11Run the `build.sh` file in this directory. You need to have built
12the base ROS image (in the `../ros-base` directory) first.
13
14## Testing
15To verify that blender works, run the `run.sh` shell script.
16This should result in a shell prompt inside the docker container.
17You can start blender simply by saying `blender`; it should display
18on your desktop.
noetic/ros-blender/build.sh +7 -0
……@@ -0,0 +1,7 @@
1#! /bin/bash
2#
3# build.sh
4#
5# Build this docker image.
6#
7docker build -t opencog/ros-noetic-blender .
noetic/ros-blender/run.sh +16 -0
……@@ -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
8xhost +local:root
9
10docker 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
16xhost -local:root
noetic/ros-blender/stop.sh +17 -0
……@@ -0,0 +1,17 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep ros-blender |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container.. '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep ros-blender`
11if test x"$TAINER" != x; then
12 echo -n 'Removing.. '
13 docker rm ros-blender
14fi
15
16# Disable local X11 connections, just in case.
17xhost -local:root
noetic/ros-opencog/Dockerfile +199 -0
……@@ -0,0 +1,199 @@
1#
2# Container for ROS+OpenCog
3#
4# To build:
5# sudo docker build -t opencog/ros-noetic-opencog .
6#
7FROM opencog/ros-noetic-base
8MAINTAINER Mark Wigzell "markwigzell@gmail.com"
9
10# Install required packages
11ENV LAST_OS_UPDATE 2022-03-05
12RUN apt-get -y update
13RUN 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`
16RUN 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.
26RUN 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.
30RUN apt-get install -y wget flex libpcre2-dev locales
31
32# -------------------------------------------------------------
33# Need assorted locales for Link Grammar
34RUN (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
51RUN 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.
57WORKDIR /opencog
58RUN git clone https://github.com/opencog/cogutil.git
59RUN git clone https://github.com/opencog/atomspace.git
60RUN git clone https://github.com/opencog/atomspace-rocks.git
61RUN git clone https://github.com/opencog/cogserver.git
62RUN git clone https://github.com/opencog/atomspace-cog.git
63RUN git clone https://github.com/opencog/lg-atomese.git
64RUN git clone https://github.com/opencog/unify.git
65RUN git clone https://github.com/opencog/ure.git
66RUN git clone https://github.com/opencog/spacetime.git
67RUN git clone https://github.com/opencog/pln.git
68RUN git clone https://github.com/opencog/relex.git
69RUN git clone https://github.com/opencog/opencog.git
70
71# -------------------------------------------------------------
72# Download and build Link Grammar.
73WORKDIR /src
74
75# Touch this tag to grab the latest version of LinkGrammar.
76ENV 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.
84RUN wget -r --no-parent -nH --cut-dirs=2 http://www.abisource.com/downloads/link-grammar/current/
85
86# Unpack the sources, too.
87RUN 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.
91RUN (cd link-grammar-5*; mkdir build; cd build; \
92 ../configure; make -j12; make install; ldconfig)
93
94RUN adduser --disabled-password --gecos "Link Parser User" link-parser
95
96USER link-parser
97RUN (cd /home/link-parser; echo "export LANG=en_US.UTF-8" >> .bash_aliases)
98CMD bash
99
100RUN export LANG=en_US.UTF-8
101
102# -------------------------------------------------------------
103USER root
104WORKDIR /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.
108ENV LAST_SOFTWARE_UPDATE 2023-01-11
109
110# Git pull for all packages
111RUN 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.
115RUN (mkdir /opencog/cogutil/build; cd /opencog/cogutil/build; \
116 cmake ..; make -j6; make install)
117RUN (mkdir /opencog/atomspace/build; cd /opencog/atomspace/build; \
118 cmake ..; make -j12; make install)
119RUN (mkdir /opencog/cogserver/build; cd /opencog/cogserver/build; \
120 cmake ..; make -j12; make install)
121RUN (mkdir /opencog/atomspace-rocks/build; cd /opencog/atomspace-rocks/build; \
122 cmake ..; make -j12; make install)
123RUN (mkdir /opencog/atomspace-cog/build; cd /opencog/atomspace-cog/build; \
124 cmake ..; make -j12; make install)
125RUN (mkdir /opencog/lg-atomese/build; cd /opencog/lg-atomese/build; \
126 cmake ..; make -j12; make install)
127RUN (mkdir /opencog/unify/build; cd /opencog/unify/build; \
128 cmake ..; make -j12; make install)
129RUN (mkdir /opencog/ure/build; cd /opencog/ure/build; \
130 cmake ..; make -j12; make install)
131RUN (mkdir /opencog/spacetime/build; cd /opencog/spacetime/build; \
132 cmake ..; make -j12; make install)
133RUN (mkdir /opencog/pln/build; cd /opencog/pln/build; \
134 cmake ..; make -j12; make install)
135RUN (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.
141RUN 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.
145WORKDIR /src
146RUN wget http://downloads.sourceforge.net/project/jwordnet/jwnl/JWNL%201.4/jwnl14-rc2.zip
147RUN (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
153COPY /scripts/install-ubuntu-relex.sh /opencog/relex/install-scripts/
154RUN (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#
168COPY /scripts/.guile /root/
169COPY /scripts/unit-test.sh /root/
170COPY /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.
174RUN (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
196WORKDIR /root
197#ENTRYPOINT bash -l -c "./unit-test.sh; bash"
198ENTRYPOINT bash -l -c "./tmux.sh; bash"
199#CMD /bin/bash
noetic/ros-opencog/README.md +36 -0
……@@ -0,0 +1,36 @@
1ros-opencog
2============
3
4A docker image that installs both ROS and OpenCog. The image holds
5only the base packages needed for running OpenCog and ROS together;
6The CogServer is not started, no ROS nodes are started.
7
8## Building
9
10Run the `build.sh` file in this directory. You need to have built
11the base ROS image (in the `../ros-base` directory) first.
12
13## Testing
14To verify that OpenCog works, run the `run.sh` shell script.
15This will create a tmux (byobu) session inside the docker container.
16There 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```
29Then from another tmux prompt:
30```
31telnet localhost 17001
32(use-modules (opencog))
33(cog-node 'ConceptNode "foobar")
34```
35The above should display `(ConceptNode "foobar" (stv 0.5 0.80000001))`.
36of course!
noetic/ros-opencog/build.sh +5 -0
……@@ -0,0 +1,5 @@
1#! /bin/bash
2#
3# Build the docker image for ros-opencog
4#
5docker build -t opencog/ros-noetic-opencog .
noetic/ros-opencog/run.sh +9 -0
……@@ -0,0 +1,9 @@
1#! /bin/bash
2#
3# Run the docker container. Stop any previously running copies.
4#
5./stop.sh
6
7docker run --name="cog-ros" -it opencog/ros-noetic-opencog
8
9clear
noetic/ros-opencog/scripts/.guile +14 -0
……@@ -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")
noetic/ros-opencog/scripts/install-ubuntu-relex.sh +55 -0
……@@ -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
17sudo apt-get -y update
18sudo apt-get -y install build-essential python-dev swig zlib1g-dev unzip wget
19sudo apt-get -y install wordnet-dev wordnet-sense-index
20sudo apt-get -y install openjdk-9-jdk
21sudo apt-get -y install maven
22
23# Link Grammar
24wget -r --no-parent --no-check-certificate -nH --cut-dirs=3 http://www.abisource.com/downloads/link-grammar/current/
25tar -xvf link-grammar-5.*.tar.gz
26rm link-grammar-5.*.tar.gz*
27rm -rf index.html* robots.txt
28pushd link-grammar-5.*
29JAVA_HOME=/usr/lib/jvm/java-9-openjdk-amd64 ./configure
30make -j6
31sudo make install
32sudo ln -v -s /usr/local/lib/liblink-grammar.so.5 /usr/lib/liblink-grammar.so.5
33popd
34sudo ldconfig
35
36MVN_USER=`whoami`
37LINKGRAMMAR_JAR=`find ./link-grammar* -name linkgrammar*.jar`
38LINKGRAMMAR_VERSION=`echo $LINKGRAMMAR_JAR | grep -oP '(?<=-)\d+\.\d+\.\d+(?=\.)'`
39
40if grep -q '^vagrant:' /etc/passwd; then
41 cd /home/vagrant/relex
42 MVN_USER=vagrant
43fi
44
45sudo -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
54sudo -u $MVN_USER mvn package -DskipTests
55sudo -u $MVN_USER mvn install -DskipTests
noetic/ros-opencog/scripts/tmux.sh +20 -0
……@@ -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
8byobu new-session -d -n 'bash' '$SHELL'
9
10tmux new-window -n 'b2' '$SHELL'
11tmux new-window -n 'b3' '$SHELL'
12tmux new-window -n 'b4' '$SHELL'
13
14# Spare-usage shell
15tmux new-window -n 'bash' '$SHELL'
16
17# Fix the annoying byobu display
18echo "tmux_left=\"session\"" > $HOME/.byobu/status
19echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
20tmux attach
noetic/ros-opencog/scripts/unit-test.sh +25 -0
……@@ -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#
8echo "Will Run OpenCog unit tests..."
9
10# Use byobu so that the scroll bars actually work
11byobu new-session -d -n 'bash' '$SHELL'
12
13tmux new-window -n 'utils' 'cd /opencog/cogutil/build && make test; $SHELL'
14tmux new-window -n 'atoms' 'cd /opencog/atomspace/build && make test; $SHELL'
15tmux new-window -n 'servr' 'cd /opencog/opencog/build && make test; $SHELL'
16
17# Spare-usage shell
18tmux new-window -n 'bash' '$SHELL'
19
20# Fix the annoying byobu display
21echo "tmux_left=\"session\"" > $HOME/.byobu/status
22echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
23tmux attach
24
25echo "Started"
noetic/ros-opencog/stop.sh +14 -0
……@@ -0,0 +1,14 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep cog-ros |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep cog-ros`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm cog-ros
14fi
opencog/README.md +84 -0
……@@ -0,0 +1,84 @@
1OpenCog Docker Containers
2-------------------------
3This directory contains docker configurations for some of OpenCog's
4projects. 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
12Older, obsolete images can be found in the [archive](../archive)
13directory. If someone sent you here, and you can't find what you were
14told about, then it is probably in the archive.
15
16## Docker setup
171. 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
222. 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
283. (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
324. 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
39List the current set of docker images with the command `docker images`.
40The 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
54The above three images "don't actually do anything"; they just provide
55baseline software installs.
56
57Actual demos, which "do actual stuff", are listed below. These need to
58be built individually; they cannot be downloaded pre-made. Go to the
59relevant 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
761. Both `tmux` and `byobu` are installed, so you can use either for
77 multiple windows/panes.
78
79## TODO
801. Add more images to github workflow for automated publishing
81
82## Bonus
83There are some "bonus" containers, which might be useful:
84* `claude-code` -- Container with Anthropic's Claude Code installed.
opencog/atomspace-py/Dockerfile +52 -0
……@@ -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#
10ARG OS_VERSION=latest
11ARG BASE_IMAGE=opencog/atomspace:${OS_VERSION}
12FROM ${BASE_IMAGE}
13
14# Install Debian-managed packages to get base python abilities.
15RUN apt-get -y update && apt-get -y upgrade && apt-get -y autoremove
16RUN apt-get -y install python3-pip python3-venv
17
18# Install Debian-managed packages to get base node.js abilities.
19RUN apt-get -y install npm
20
21# Everything else happens as the user.
22USER opencog
23WORKDIR /home/opencog
24
25# Set up NPM repos so that they install as the user.
26RUN mkdir -p ~/.npm-global
27RUN npm config set prefix ~/.npm-global
28RUN echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
29ENV PATH=~/.npm-global/bin:$PATH
30
31# Create python gaol located at a popular location
32# Activate manually wih `source ~/.venv/bin/activate`
33RUN python3 -m venv .venv
34
35# Use uv as a replacement for pipx, poetry, pyenv, virtualenv, twine.
36RUN .venv/bin/pip install uv
37
38# Other misc stuff
39RUN .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.
45RUN .venv/bin/pip install mcp || true
46
47# Opencog installed itself here; we want it available in the venv.
48ENV PYTHONPATH=/usr/local/lib/python3.12/dist-packages:$PYTHONPATH
49
50CMD /bin/bash
51
52ONBUILD USER root
opencog/atomspace/Dockerfile +76 -0
……@@ -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
15ARG OS_VERSION=latest
16ARG BASE_IMAGE=opencog/opencog-deps:${OS_VERSION}
17FROM ${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!
21ENV LAST_APT_UPDATE=2025-08-08
22RUN 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.
33RUN 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
43ENV LAST_COGUTIL_UPDATE=2025-12-10
44RUN /tmp/octool -c && ccache -C
45
46# Install core AtomSpace.
47ENV LAST_ATOMSPACE_UPDATE=2025-11-20
48RUN /tmp/octool -a && ccache -C
49
50USER opencog
51WORKDIR /home/opencog
52
53# Setup the workspace for developers
54COPY /scripts/ /home/opencog
55RUN sudo chown -R opencog:opencog .
56RUN 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.
63RUN 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.
70EXPOSE 17001
71EXPOSE 18080
72EXPOSE 18888
73
74CMD /bin/bash
75
76ONBUILD USER root
opencog/atomspace/README.md +42 -0
……@@ -0,0 +1,42 @@
1Base AtomSpace container
2------------------------
3
4The container here includes a copy of the core AtomSpace framework,
5including the AtomSpace, the CogServer, the RocksStorageNode and the
6CogStorageNode. It does *not* include nlp, unify, ure or pln.
7
8## Building
9
10The container is built by the script in the directory below:
11`../docker-build.sh -s`.
12
13## Testing
14Optional. 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```
34Then toggle to another byobu/tmux panel (F3/F4 to move left/right
35in byobu, or `ctrl-b p`/`ctrl-b n` to move left/right in tmux)
36```
37rlwrap telnet localhost 17001
38scm
39(cog-node 'ConceptNode "foobar")
40```
41The above should display `(ConceptNode "foobar" (stv 0.5 0.8))`.
42Of course!
opencog/atomspace/run.sh +9 -0
……@@ -0,0 +1,9 @@
1#! /bin/bash
2#
3# Run the docker container.
4#
5# ./stop.sh
6
7docker run --name="base-atomspace" -it opencog/atomspace
8
9# clear
opencog/atomspace/scripts/.byobu/.screenrc +0 -0
(no content changes — binary or rename)
opencog/atomspace/scripts/.byobu/.tmux.conf +0 -0
(no content changes — binary or rename)
opencog/atomspace/scripts/.byobu/.welcome-displayed +0 -0
(no content changes — binary or rename)
opencog/atomspace/scripts/.byobu/backend +1 -0
……@@ -0,0 +1 @@
1BYOBU_BACKEND=tmux
opencog/atomspace/scripts/.byobu/color +3 -0
……@@ -0,0 +1,3 @@
1BACKGROUND=k
2FOREGROUND=w
3MONOCHROME=0
opencog/atomspace/scripts/.byobu/color.tmux +4 -0
……@@ -0,0 +1,4 @@
1BYOBU_DARK="\#333333"
2BYOBU_LIGHT="\#EEEEEE"
3BYOBU_ACCENT="\#75507B"
4BYOBU_HIGHLIGHT="\#DD4814"
opencog/atomspace/scripts/.byobu/datetime.tmux +2 -0
……@@ -0,0 +1,2 @@
1# BYOBU_DATE="%Y-%m-%d "
2# BYOBU_TIME="%H:%M:%S"
opencog/atomspace/scripts/.byobu/keybindings +1 -0
……@@ -0,0 +1 @@
1source $BYOBU_PREFIX/share/byobu/keybindings/common
opencog/atomspace/scripts/.byobu/keybindings.tmux +4 -0
……@@ -0,0 +1,4 @@
1unbind-key -n C-a
2set -g prefix ^A
3set -g prefix2 ^A
4bind a send-prefix
opencog/atomspace/scripts/.byobu/profile +1 -0
……@@ -0,0 +1 @@
1source $BYOBU_PREFIX/share/byobu/profiles/common
opencog/atomspace/scripts/.byobu/profile.tmux +1 -0
……@@ -0,0 +1 @@
1source $BYOBU_PREFIX/share/byobu/profiles/tmux
opencog/atomspace/scripts/.byobu/prompt +1 -0
……@@ -0,0 +1 @@
1[ -r /usr/share/byobu/profiles/bashrc ] && . /usr/share/byobu/profiles/bashrc #byobu-prompt#
opencog/atomspace/scripts/.byobu/status +41 -0
……@@ -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
26screen_upper_left="color"
27screen_upper_right="color whoami hostname ip_address menu"
28screen_lower_left="color logo distro release #arch session"
29screen_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
31tmux_right="load_average disk_io date time"
32tmux_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"
opencog/atomspace/scripts/.byobu/statusrc +78 -0
……@@ -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
opencog/atomspace/scripts/.byobu/windows +0 -0
(no content changes — binary or rename)
opencog/atomspace/scripts/.byobu/windows.tmux +0 -0
(no content changes — binary or rename)
opencog/atomspace/scripts/.vimrc +21 -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
4set wrapmargin=8
5" set textwidth=80
6set ts=3
7set showmode
8set noautoindent
9set encoding=utf-8
10
11" Only do this part when compiled with support for autocommands.
12if 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
21endif " has("autocmd")
opencog/atomspace/scripts/cogserver.scm +75 -0
……@@ -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; -----------------------------------------------------------
opencog/base/Dockerfile +83 -0
……@@ -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)
9ARG BASE_OS=ubuntu:24.04
10FROM ${BASE_OS}
11
12ENV 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.
17ENV LAST_OS_UPDATE=2025-12-16
18RUN apt-get update && apt-get -y upgrade
19
20# Install apt utilities
21RUN 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
24RUN 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.
29RUN 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.
34ENV 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
38ARG GITHUB_NAME="opencog"
39ENV GITHUB_NAME=${GITHUB_NAME}
40ARG OCPKG_URL=https://raw.githubusercontent.com/${GITHUB_NAME}/ocpkg/master/ocpkg
41RUN echo OCPKG_URL=$OCPKG_URL
42ADD $OCPKG_URL /tmp/octool
43RUN 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
48RUN /tmp/octool -rdv
49
50# Environment Variables
51ENV PATH=/usr/lib/ccache:$PATH
52
53## Set Locale -- Link Grammar expects this.
54RUN locale-gen en_US.UTF-8
55ENV LANG=en_US.UTF-8
56ENV LANGUAGE=en_US:en
57ENV 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.
62ENV LAST_LG_UPDATE=2025-10-28
63RUN /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
67RUN adduser --disabled-password --gecos "OpenCog Developer" opencog
68RUN adduser opencog sudo
69RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
70
71# video provides access to any GPU's on this device.
72RUN usermod -a -G video opencog
73USER opencog
74WORKDIR /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
79COPY /scripts/ /home/opencog
80RUN sudo chown -R opencog:opencog .guile .gdbinit
81
82# For images built on this
83ONBUILD USER root
opencog/base/scripts/.gdbinit +99 -0
……@@ -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# ----------------------------------------------------------------------------
6handle SIGPWR noprint nostop
7handle SIGXCPU noprint nostop
8set print thread-events off
9
10# ----------------------------------------------------------------------------
11# Print OpenCog Objects
12# ----------------------------------------------------------------------------
13set overload-resolution on
14
15define 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
22end
23
24document poc
25 Prints opencog object information.
26 Syntax: poc <opencog object>
27 Example:
28 poc h - Prints the hypergraph corresponding to h
29end
30
31# ----------------------------------------------------------------------------
32# Print opencog::AtomSpace
33# ----------------------------------------------------------------------------
34define patomspace
35 if $argc == 0
36 help patomspace
37 else
38 printf "%s", $arg0.to_string()._M_dataplus._M_p
39 end
40end
41
42document patomspace
43 Prints opencog::AtomSpace information.
44 Syntax: patomspace <atomspace>
45 Example:
46 patomspace as - Prints the whole atomspace as
47end
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# ----------------------------------------------------------------------------
54add-auto-load-safe-path /usr/lib/debug/usr/bin/python2.7-gdb.py
55
56# print python frame
57define 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
66end
67document pyf
68show python stack frame
69end
70
71# print python backtrace
72define 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
96end
97document pbt
98show python backtrace
99end
opencog/base/scripts/.guile +9 -0
……@@ -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)
opencog/claude-code/Dockerfile +23 -0
……@@ -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#
9FROM opencog/atomspace-py:latest
10
11# Everything else happens as the user.
12USER opencog
13WORKDIR /home/opencog
14
15# Install Anthropic Claude Code
16RUN npm install -g @anthropic-ai/claude-code
17
18# The OAuth token needs to be refreshed from time to time.
19RUN curl -O https://raw.githubusercontent.com/RavenStorm-bit/claude-token-refresh/main/claude_token_refresh.py && chmod +x claude_token_refresh.py
20
21CMD /bin/bash
22
23ONBUILD USER root
opencog/docker-build.sh +211 -0
……@@ -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
14set -e
15
16# Environment Variables
17## Use cache by default unless the -u options is passed
18CACHE_OPTION=""
19
20## This file/symlinks name
21SELF_NAME=$(basename $0)
22DIR_NAME=$(dirname $0)
23
24# -----------------------------------------------------------------------------
25# Main Execution
26if [ $# -eq 0 ]; then NO_ARGS=true; fi
27
28while 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
43done
44
45shift "$(($OPTIND - 1))"
46
47BASE_OS=$1
48if [[ -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
56fi
57BASE_OS=${BASE_OS//-/:} # Convert dashes to colons
58OS_VERSION=${BASE_OS//:/-} # Convert colons to dashes
59
60if [[ -z $1 ]]; then # If net specified, its "latest"
61 OS_VERSION=latest # For dockerhub.io downloads
62fi
63
64DOCKER_NAME=$2
65if [[ -z $DOCKER_NAME ]]; then
66 DOCKER_NAME="opencog"
67fi
68GITHUB_NAME=$3
69if [[ -z $GITHUB_NAME ]]; then
70 GITHUB_NAME="opencog"
71fi
72
73# Functions
74usage() {
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
108if [ $SHOW_USAGE ]; then
109 usage
110 exit 0
111fi
112
113# -----------------------------------------------------------------------------
114# Sanity check
115
116if [ $UNKNOWN_FLAGS ] ; then usage; exit 1 ; fi
117if [ $NO_ARGS ] ; then usage ; fi
118
119if ! command -v docker &> /dev/null
120then
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
126fi
127
128# -----------------------------------------------------------------------------
129## Shared docker build options
130
131OCPKG_OPTION=""
132if [ ! -z "$OCPKG_URL" ]; then
133 OCPKG_OPTION="--build-arg OCPKG_URL=$OCPKG_URL"
134fi
135BASE_OS_OPTION="--build-arg BASE_OS=$BASE_OS"
136OS_VERSION_OPTION="--build-arg OS_VERSION=$OS_VERSION"
137GITHUB_OPTION="--build-arg GITHUB_NAME=$GITHUB_NAME"
138
139BUILD_OPTIONS="$CACHE_OPTION $BASE_OS_OPTION $OS_VERSION_OPTION $OCPKG_OPTION $GITHUB_OPTION"
140
141# -----------------------------------------------------------------------------
142## Build opencog/opencog-deps image.
143build_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.
150check_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.
158build_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.
166check_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/
174pull_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
186if [ $PULL_DEV_IMAGES ]; then
187 pull_dev_images
188 exit 0
189fi
190
191if [ $BUILD_OPENCOG_BASE_IMAGE ]; then
192 build_opencog_deps
193fi
194
195if [ $BUILD_ATOMSPACE_IMAGE ]; then
196 build_atomspace
197fi
198
199if [ $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} ----"
203fi
204
205if [ $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} ----"
209fi
210
211# -----------------------------------------------------------------------------
opencog/lang-model/Dockerfile +44 -0
……@@ -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
23FROM opencog/learn
24
25USER opencog
26WORKDIR /home/opencog
27
28RUN mkdir /home/opencog/data
29WORKDIR /home/opencog/data
30
31# RUN wget --progress=bar:force:noscroll https://linas.org/datasets/r13-all-in-one.tar.bz2
32RUN curl https://linas.org/datasets/r13-all-in-one.tar.bz2 -o r13-all-in-one.tar.bz2
33RUN tar -jxf r13-all-in-one.tar.bz2
34RUN rm r13-all-in-one.tar.bz2
35
36COPY /scripts/ /home/opencog
37
38# Setup the workspace for developers
39WORKDIR /home/opencog
40RUN sudo chown -R opencog:opencog experiments
41
42CMD /bin/bash
43
44ONBUILD USER root
opencog/lang-model/scripts/experiments/run-word-pairs/0-pipeline.sh +30 -0
……@@ -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
12export 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/
20export ROCKS_DATA_DIR=/home/opencog/data/
21
22# Directory in which configuration parameters (including this file)
23# are located. Obtained automatically; don't change.
24export CONFIG_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
25
26# The master config file, which is this file. Don't change.
27export 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
opencog/lang-model/scripts/experiments/run-word-pairs/README.md +219 -0
……@@ -0,0 +1,219 @@
1
2Word-pairs Visualization Server
3===============================
4The code in this directory configures and runs an AtomSpace
5providing access to word-pair correlation data, word-disjunct
6data, and word similarity scores.
7
8Instructions
9------------
10Get your hands on one of these datasets (or create your own; see
11the opencog/learn project for instructions how.) Contact Linas
12to 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
36Then the usual: git clone and compile and install cogutils, the
37atomspace, the cogserver, atomspace-rocks and the learn project.
38
39Next, configure the config files to suit your tastes: edit the
40files `0-pipeline.sh` and `pairs-en-conf.sh` in this directory.
41Source them, they set environment variables. To source, say this:
42```
43. 0-pipeline.sh
44. pairs-en-conf.sh
45```
46
47Next, start the cogserver. Doing this will automatically load
48the datasets:
49```
50guile -l scm/cogserver-nav.scm
51```
52When the above gets to the guile prompt, it will be ready to serve
53data to the visualizer.
54
55General Exploration
56===================
57A scheme prompt is directly accessible via the cogserver:
58```
59rlwrap telnet localhost 19014
60scm
61(format #t "Hello world\n")
62```
63
64There are three types of data in this dataset: word-word pairs,
65word-disjunct pairs and word-similarities. The first example
66is for word-word pairs, showing how to find related words.
67
68Many words are NOT in the dataset, so random experimentation
69may result in no replies.
70
71To 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
76This 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```
91Ignore the `ctv` (this is an observation count)
92
93These "pairs" are "edges", the name of the edge is "ANY",
94and there's a bunch of numerical data hanging off each edge.
95
96The "relatedness" of a word-pair can be obtained by looking
97at 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```
102The above returns a single floating point number, in the range of
103about -20 to about +20, indicating the MI of the pair. The higher,
104the better.
105
106Pairs, with the word on the left:
107```
108(pair-stars 'right-stars (Word "end"))
109```
110
111The "other end" of a given word (the other vertex at the
112end of an edge) can be gotten with:
113```
114(pair-stars 'right-duals (Word "end"))
115(pair-stars 'left-duals (Word "end"))
116
117Simplified Navigation API
118-------------------------
119To simplify data access, there's a thin wrapper which can be used to
120navigate the word-pair graph. Given a word, it will move "forward",
121returning the top N related words, ranked in MI order. The "backward"
122move moves left. The edge-score is a single floating point number for
123that 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
150Word-disjunct pairs
151-------------------
152A lot like the above, except:
153```
154(cset-stars 'right-stars (WordNode "end"))
155```
156
157Similarity examples
158-------------------
159The dataset also contains similarity scores for the top most-frequent
1601000 words (the "triangle number" of (1001 x 1000 / 2) pairs; about
161half a million).
162
163Raw 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```
170The above is nasty in it's native form, so the wrapper in `navigate.scm`
171comes 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```
191The dataset contains two different similarity scores, the "fmi"
192fractional-MI and the "vmi" variational-MI. The vmi is just the fmi
193offset the the mean of the log of the frequency.
194
195Lots of other similarity scores are possible; they're just not in
196this dataset. That is, the dataset just caches some pre-computed
197values, as otherwise it is fairly CPU-intensive to compute.
198(Typically about 10 sims per second, but you need thousands of
199these to see which ones are the best/closest. Almost all words
200are NOT similar!)
201
202Documentation
203=============
204All 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
212TODO:
213-----
214This:
215```
216;;; (cog-atomspace-ro!) ;; No ... this fails somehow.
217```
218
219========
opencog/lang-model/scripts/experiments/run-word-pairs/cogserver/cogserver-gram.conf +17 -0
……@@ -0,0 +1,17 @@
1#
2# Configuration for a production OpenCog server - English MST
3#
4SERVER_PORT = 19014
5LOG_FILE = /tmp/run-14.log
6
7# Other possible log levels are "error", "warn", "info", "debug" and "fine"
8# LOG_LEVEL = debug
9LOG_LEVEL = info
10LOG_TO_STDOUT = false
11
12# ANSI prompts are colorful.
13PROMPT = "run-14> "
14ANSI_PROMPT = "run-14> "
15SCM_PROMPT = "guile-run-14> "
16ANSI_SCM_PROMPT = "guile-run-14> "
17ANSI_ENABLED = true
opencog/lang-model/scripts/experiments/run-word-pairs/cogserver/cogserver-pairs.conf +17 -0
……@@ -0,0 +1,17 @@
1#
2# Configuration for a production OpenCog server - English MST
3#
4SERVER_PORT = 19014
5LOG_FILE = /tmp/public-pairs.log
6
7# Other possible log levels are "error", "warn", "info", "debug" and "fine"
8# LOG_LEVEL = debug
9LOG_LEVEL = info
10LOG_TO_STDOUT = false
11
12# ANSI prompts are colorful.
13PROMPT = "en-pairs> "
14ANSI_PROMPT = "en-pairs> "
15SCM_PROMPT = "guile-en-pairs> "
16ANSI_SCM_PROMPT = "guile-en-pairs> "
17ANSI_ENABLED = true
opencog/lang-model/scripts/experiments/run-word-pairs/pairs-en-conf.sh +19 -0
……@@ -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.
6export HOSTNAME=localhost
7export PORT=19014
8
9export PROMPT="(pairs-en)"
10
11export COGSERVER_CONF=${CONFIG_DIR}/cogserver/cogserver-pairs.conf
12
13export MST_DB=${ROCKS_DATA_DIR}/r14-imp-q0.7-c0.9-n0.rdb
14export PAIRS_DB=${ROCKS_DATA_DIR}/run-1-en_pairs-tranche-123.rdb
15export ALL_DB=${ROCKS_DATA_DIR}/run-1-t12-tsup-1-1-1.rdb
16export ALL_DB=${ROCKS_DATA_DIR}/r13-one-sim200.rdb
17export ALL_DB=${ROCKS_DATA_DIR}/r13-all-in-one.rdb
18
19export STORAGE_NODE="(RocksStorageNode \"rocks://${ALL_DB}\")"
opencog/lang-model/scripts/experiments/run-word-pairs/scm/cogserver-nav.scm +48 -0
……@@ -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")
opencog/lang-model/scripts/experiments/run-word-pairs/scm/cogserver.scm +66 -0
……@@ -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; -----------------------------------------------------------
opencog/lang-model/scripts/experiments/run-word-pairs/scm/navigate.scm +154 -0
……@@ -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")))
opencog/lang-mst/Dockerfile +20 -0
……@@ -0,0 +1,20 @@
1#
2# Container with Maximum-Spanning-Tree demo.
3#
4FROM opencog/learn:latest
5
6USER opencog
7WORKDIR /home/opencog
8
9# Set up the basic working directories
10RUN ./setup-for-experiments.sh
11
12# Copy in the fully-automated MST scripts.
13COPY --chown=opencog:opencog /scripts/ .
14
15# Copy in the demo Link Grammar dictionary.
16COPY --chown=opencog:opencog /demo-dict-mpg/ demo-dict-mpg
17
18CMD /bin/bash
19
20ONBUILD USER root
opencog/lang-mst/README.md +237 -0
……@@ -0,0 +1,237 @@
1lang-mst
2--------
3Compute Maximum Spanning Tree (MST) disjuncts from text.
4
5This container provides a basic demo, together with a fully automated
6script, for counting MST disjuncts in text. It illustrates the second
7stage of the language-learning pipeline. It assumes that the first
8stage, from the `lang-pairs` container, has been done, and the resulting
9dataset is available.
10
11New users should follow the manual process, given below. Instructions
12for a fully-automated run are given at the end.
13
14Common setup
15------------
16Setup needed for both the manual demo, and the full-automated runs.
17
181. Create this Docker image:
19```
20 docker build -t opencog/lang-mst .
21```
222. Create a container:
23 `docker create --name mst-counter -it opencog/lang-mst`
24
253. (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
314. 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
395. 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
476. Start the container: `docker start -i mst-counter`
48 This will drop you into a shell prompt inside the container.
49
507. 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
57Manual processing
58-----------------
59Manual processing consists mostly of setting up an environment, and
60then launching the MST counting scripts, and then monitoring progress.
61Short instructions:
62
630. If you haven't already done so, then: `docker start -i mst-counter`.
64
651. 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.
71cd ~/experiments/
72cp -pr run-1 run-3
73cd run-3
74rm -f 2-pair-conf.sh 4-gram-conf.sh
75
76# Use the default configuration.
77source 0-pipeline.sh
78source 3-mpg-conf.sh
79
80# Remove scripts for earlier and later stages (avoid confusion)
81cd run
82rm -rf 2-word-pairs 4-gram-class
83
84# Prepare to run the MST counting pipeline in byobu.
85cd 3-mst-parsing
86```
87
882. Start up a byobu/tmux session, just as before, for the word-pairs:
89```
90./run-mst-shells.sh
91```
92
933. 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
984. 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
1015. 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
1066. 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
1097. 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
1138. 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
118Link Parser Demo
119----------------
120The resulting disjunct database can be used by the Link Grammar parser,
121as an "ordinary" dictionary, i.e. one containing per-word expressions.
122The only unusual aspect is that word categories are not used; all
123connectors are to specific words.
124
1251. 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```
129cd ~/data
130cp -pr mpg-parse.rdb mpg-parse-copy.rdb
131```
132
1332. 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```
137cd ~
138link-parser demo-dict-mpg -verbosity=3
139```
140
1413. 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
145The parser will be slow to startup, as portions of the database are
146loaded, including expressions for the `LEFT-WALL`, of which there will
147typically be millions. This size of this set is reduced only by
148clustering, done in a later stage. Once a lookup is done, the results
149are cached, so later access should be faster. The first-time lookup
150of words during parsing is likewise slow; subsequent access is cached.
151
152The dictionary is defined by the config files in `~/demo-dict-mpg`.
153You can copy and rename this directory as desired; you just have to
154start Link Grammar in the same directory where this is placed.
155Editing the `storage.dict` file to create a custom config. A typical
156change is to alter where the data is coming from. This is the line
157that starts with `#define storage-node`.
158
159Using a previously built container
160----------------------------------
161If you've followed the instructions above, and then stopped docker or
162rebooted, and want to restart that container, then here's how:
163
1641. Restart the docker container. Use the `-i` flag to get an
165 interactive shell:
166```
167docker start -i <container-name>
168```
169
1702. To run the Link Grammar demo, follow the instructions above.
171
1723. 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```
177cd ~/experiments/run-3/run/3-mst-parsing
178./run-mst-shells.sh
179```
180
181Semi-automated
182--------------
183Some 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
201Fully automated
202---------------
203The above has been condensed into a single script, `./autorun.sh`.
204It will start the docker container, move datasets into place, perform
205the processing, and halt the container when done.
206
207It 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
221That's it: the two copies above, then `./autorun.sh`
222
223Upon successful completion, it updates both the `text` and the `data`
224directories. The resulting `data/mpg-parse.rdb` will contain the MST
225disjuncts and marginals.
226
227It assumes that everything has been correctly configured. If it crashes,
228hangs, or if you're just antsy and need to see what's going on inside
229the container, just run
230```
231docker exec -it mst-counter-auto /bin/bash
232tmux attach
233```
234This will attach to the byobu/tmux session; the panel layout is
235identical to the manual-mode described above.
236
237------
opencog/lang-mst/autorun.sh +94 -0
……@@ -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
22MST_CONTAINER=mst-counter-auto
23TEXT_DIR=text
24DATA_DIR=data
25
26UPDATE=$1
27
28if [[ -z "$(ls $TEXT_DIR)" ]]; then
29 echo "Error: The $TEXT_DIR directory appears to be empty!"
30 exit 1
31fi
32
33if [[ -z "$(ls $DATA_DIR)" ]]; then
34 echo "Error: The $DATA_DIR directory appears to be empty!"
35 exit 1
36fi
37
38# Avoid trashing current work.
39TAINER=`docker ps |grep $MST_CONTAINER |cut -f1 -d" "`
40if 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
48fi
49
50TAINER=`docker ps -a |grep $MST_CONTAINER |cut -f1 -d" "`
51if 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
57elif test x"$UPDATE" == x-u; then
58 echo "Re-using existing container $MST_CONTAINER"
59else
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
66fi
67
68date
69docker container cp $TEXT_DIR/. $MST_CONTAINER:/home/opencog/text
70
71echo "Starting container $MST_CONTAINER"
72docker start $MST_CONTAINER
73docker exec -u 0 $MST_CONTAINER chown -R opencog:opencog /home/opencog/text
74docker exec -u 0 $MST_CONTAINER chown -R opencog:opencog /home/opencog/data
75docker exec -d $MST_CONTAINER /home/opencog/count-mst.sh
76sleep 10
77
78echo "Waiting for MST counting to finish in container $MST_CONTAINER"
79echo "Caution: this may take hours, days or weeks!"
80echo "If you're nervous and can't stand the wait, try this:"
81echo " docker exec -it $MST_CONTAINER /bin/bash"
82echo " tmux attach"
83echo "and then prowl around in tmux with F3 and F4"
84echo "This script will not exit until all processing is done."
85
86docker exec $MST_CONTAINER /home/opencog/count-mst-done.sh
87
88echo "Done MST counting in container $MST_CONTAINER"
89
90echo "Copying MST dataset to $DATA_DIR"
91docker container cp $MST_CONTAINER:/home/opencog/data/. $DATA_DIR
92docker container cp $MST_CONTAINER:/home/opencog/text/. $TEXT_DIR
93echo "Done!"
94date
opencog/lang-mst/build.sh +6 -0
……@@ -0,0 +1,6 @@
1#! /bin/bash
2#
3# Build the docker image for opencog/lang-mst
4#
5docker build -t opencog/lang-mst .
6# docker build --no-cache -t opencog/lang-mst .
opencog/lang-mst/demo-dict-mpg/4.0.affix +9 -0
……@@ -0,0 +1,9 @@
1
2")" "}" "]" ">" » 〉 ) 〕 》 】 ] 』 」 "’’" "’" '' '
3"%" "," "." 。 ":" ";" "?" "!" ‽ ؟ ? ! … ... "”" "–" "‐" 、 ~
4¢ ₵ ™ ℠ : RPUNC+;
5
6"(" "{" "[" "<" « 〈 ( 〔 《 【 [ 『 「 `` „ “ ‘ '' ' … ...
7¿ ¡ "$"
8£ ₤ € ¤ ₳ ฿ ₡ ₢ ₠ ₫ ৳ ƒ ₣ ₲ ₴ ₭ ₺ ℳ ₥ ₦ ₧ ₱ ₰ ₹ ₨ ₪ ﷼ ₸ ₮ ₩ ¥ ៛ 호점
9† †† ‡ § ¶ © ® ℗ № "#": LPUNC+;
opencog/lang-mst/demo-dict-mpg/README.md +19 -0
……@@ -0,0 +1,19 @@
1Demo Atomese MST dictionary
2---------------------------
3This is an example configuration for an AtomSpace-backed dictionary,
4configured for parsing using disjuncts that were mined from MST parses.
5Each disjunct is assigned a cost, based on it's MI.
6
7For general info about Link Grammar dictionaries running out of the
8AtomSpace, 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
17Both of the above files are text files. To adjust the location of the
18dictionary, edit the `storage.dict` file and change the line that starts
19with `#define storage-node`.
opencog/lang-mst/demo-dict-mpg/storage.dict +146 -0
……@@ -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.
146foo: UNITS+;
opencog/lang-mst/run.sh +22 -0
……@@ -0,0 +1,22 @@
1#! /bin/bash
2#
3# Run the docker container. Stop any previously running copies.
4#
5# ./stop.sh
6
7MST_CONTAINER=mst-counter
8
9TAINER=`docker ps |grep $MST_CONTAINER |cut -f1 -d" "`
10if 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
14else
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
22fi
opencog/lang-mst/scripts/count-mst-done.sh +23 -0
……@@ -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
10sleep 60
11
12# Wait for evidence that marginals have been computed.
13while [[ ! -f /tmp/mst-marginals-done ]] ; do
14 sleep 60
15done
16
17# Shut down the tmux session.
18tmux 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.
23pkill -9 bash
opencog/lang-mst/scripts/count-mst.sh +37 -0
……@@ -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
10sudo chown -R opencog:opencog text
11sudo 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.
17cd ~/experiments/
18cp -pr run-1 run-3
19cd run-3
20rm -f 2-pair-conf.sh 4-gram-conf.sh
21
22# Use the default configuration.
23source 0-pipeline.sh
24source 3-mpg-conf.sh
25
26# Remove scripts for earlier and later stages (avoid confusion)
27cd run
28rm -rf 2-word-pairs 4-gram-class
29
30# Remove semaphore, just in case.
31rm -f /tmp/mst-marginals-done
32
33# Run the MST counting pipeline in byobu.
34cd 3-mst-parsing
35./run-all-mst.sh
36
37echo "Done MST counting. Good bye!"
opencog/lang-pairs/Dockerfile +23 -0
……@@ -0,0 +1,23 @@
1#
2# Container for word-pair counting; both demo and fully-automated.
3#
4FROM opencog/learn:latest
5
6USER opencog
7WORKDIR /home/opencog
8
9# Install a very simple pair visualizer.
10RUN mkdir src && cd src && git clone https://github.com/opencog/cogprotolab.git
11RUN sudo chown opencog:opencog /var/www/html/
12RUN sudo cp -pr src/cogprotolab/vis-word-pairs/* /var/www/html/
13
14# Set up the basic working directories
15RUN ./setup-for-experiments.sh
16
17# Copy in the fully-automated pair-counter.
18COPY --chown=opencog:opencog /scripts/ .
19COPY --chown=opencog:opencog /demo-dict-pair/ demo-dict-pair
20
21CMD /bin/bash
22
23ONBUILD USER root
opencog/lang-pairs/README.md +262 -0
……@@ -0,0 +1,262 @@
1lang-pairs
2----------
3This container provides a basic demo, together with a fully automated
4script, 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
11Nearby word-pairs are sampled from input text, and a count is maintained
12for how often they are seen. These counts are recorded in the AtomSpace,
13and written to a persistent database: the RocksB `StorageNode`. This
14database can be reopened at a later time, without having to redo
15counting.
16
17Given observed frequencies of word-pairs, the mutual information
18between them can be calculated. See Wikipedia,
19[pointwise mutual information](https://en.wikipedia.org/wiki/Pointwise_mutual_information).
20After counting, batch scripts compute this (see instructions below).
21After these are computed, an Apache webserver is started inside this
22container. Using a web browser to access it will bring up a simple
23word-pair visualizer.
24
25The demo can take half-a-day or several days (or longer) to run,
26depending on the quantity of input text. It will need 4 to 12GB of RAM,
27again, depending on the text.
28
29This demos only the very first step of a much longer and more complicated
30learning system. That system aims to extract syntactic and semantic
31structure from arbitrary data (not just text). The second step can be
32found in the [`lang-mst`](../lang-mst) directory. Docker demos for
33later stages will be set up "any day now" (The expression "any day now"
34is a sarcastic remark, popular in Texas, meaning "not soon".
35The learning system is a work in progress, and is unstable.)
36
37A beginning user should run the demo "manually" the first time, in order
38to get familiar with the basic steps. Instructions for a fully automated
39script are at the very end of this file.
40
41Basic Setup
42-----------
430. Install docker, if you have not already done so:
44 `sudo apt install docker.io`
451. Run `../docker-build.sh -a` and `../docker-build.sh -l` to build
46 the pre-requisite containers.
472. Create this Docker image:
48```
49 docker build -t opencog/lang-pairs .
50```
513. 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
584. 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```
62docker 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
69Configuration
70-------------
71Get familiar with the general outlines of the configuration files
72and scripting system.
73
741. Start the container: `docker start -i pair-counter`
75 This will drop you into a shell prompt inside the container.
762. Change ownership of the input text files. Run
77 `sudo chown -R opencog:opencog text` ***IMPORTANT! Don't forget to do this!***
783. `cd ~/experiments/run-1`
794. 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.
835. `source 0-pipeline.sh` # Load environment variables from config file.
846. `run/run-tmux.sh` # Set up multiple byobu terminals.
857. Review the [language-learning project](https://github.com/opencog/learn)
86 README's and follow instructions there ...
87
88OK, so those instructions are overwhelming. The next section provides
89a simplified digest, just enough to get the basics for word-pairs
90running.
91
92Manual Counting
93---------------
94First-time users should follow these instructions.
95
96A. Go to the `cogsrv` tab, and run `run/2-word-pairs/run-cogserver.sh`
97
98B. 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
102C. Go to the `submit` tab, and run `run/2-word-pairs/pair-submit.sh`
103
104D. 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```
110E. 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
118XXX below is auto done already??
119
120F. 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
131G. 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
136Web Demo
137--------
138The web demo allows the word-pair dataset to be browsed "directly",
139using a web graph visualization package.
140
1411. Go to the `cntl` tab and run `sudo service apache2 start`
142
1432. 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
1533. 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
1614. On your local machine, connect to the webserver, using the port 8080
162 specified on `docker create` line above:
163```
164http://localhost:8080/
165```
166 or
167```
168http://172.17.0.1:8080/
169```
170 where `172.17.0.1` is the Docker container IP address; will vary,
171 in general.
172
173Link Parser Demo
174----------------
175The word-pair database can be used by the Link Grammar parser to create
176Minimum Spanning Tree (MST) parses. These are parses where the links
177between words correspond to word-pairs that have appeared in the database.
178The parsing is done so as to minimize the total cost; equivalently, to
179maximize the total MI of all word-pairs used in the parse. (By design,
180the LG parser always minimizes costs; thus, the LG dictionary config file
181maps MI values to minus costs.)
182
1831. 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```
187cd ~/data
188cp -pr word-pairs.rdb word-pairs-copy.rdb
189```
190
1912. 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```
195link-parser demo-dict-pair
196```
197
1983. 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
203Development Tips
204----------------
205After pair-counting is completed, the easiest way to restart the
206CogServer is to invoke `run-common/cogserver-mst.scm`. This loads
207all word-pairs into the AtomSpace, and then provides a guile prompt
208to poke around in (It does NOT do any MST processing beyond loading
209the pairs.)
210
211
212Semi-automated Counting
213-----------------------
214Most of the above has been condensed into a single script.
215
2161. Start the container: `docker start -i pair-counter`
217 This will drop you into a shell prompt inside the container.
2182. (Optional) Review the config files; change if desired. The defaults
219 are fine.
2203. 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.
2244. 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```
2305. 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.
2336. 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```
237docker 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
2417. (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```
246docker container cp pair-counter:/home/opencog/text/pair-counted /your/favorite/place/for/text/
247```
248
249Fully-automated Counting
250------------------------
251This can be fully automated. It assumes everything above is configured
252and is working.
253
2541. Place a copy of the input text corpus in the `input-pages` directory.
2552. Run `autorun.sh`
2563. Wait until done.
257
258To process additional text in an existing container, place the new text
259into the `input-pages` directory, and run `autorun.sh -u`. Be sure to
260remove the earlier text, as otherwise it will be reprocessed a second time.
261
262----
opencog/lang-pairs/autorun.sh +86 -0
……@@ -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`
18INPUT_DIR=input-pages
19TEXT_DIR=text
20DATA_DIR=data
21
22PAIR_CONTAINER=pair-counter-auto
23UPDATE=$1
24
25if [[ -z "$(ls $INPUT_DIR)" ]]; then
26 echo "Error: You forgot to put an input corpus into the $INPUT_DIR directory!"
27 exit 1
28fi
29
30# Avoid trashing current work.
31TAINER=`docker ps |grep $PAIR_CONTAINER |cut -f1 -d" "`
32if 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
40fi
41
42TAINER=`docker ps -a |grep $PAIR_CONTAINER |cut -f1 -d" "`
43if test x"$TAINER" == x; then
44 # Start Fresh
45 echo "Creating container $PAIR_CONTAINER"
46 docker create --name $PAIR_CONTAINER -it opencog/lang-pairs
47elif test x"$UPDATE" == x-u; then
48 echo "Re-using existing container $PAIR_CONTAINER"
49else
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
56fi
57
58date
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/`
63docker container cp $INPUT_DIR $PAIR_CONTAINER:/home/opencog/text/
64
65echo "Starting container $PAIR_CONTAINER"
66docker start $PAIR_CONTAINER
67docker exec -u 0 $PAIR_CONTAINER chown -R opencog:opencog /home/opencog/text
68docker exec -d $PAIR_CONTAINER /home/opencog/count-pairs.sh
69sleep 10
70
71echo "Waiting for pair counting to finish in container $PAIR_CONTAINER"
72echo "Caution: this may take hours, days or weeks!"
73echo "If you're nervous and can't stand the wait, try this:"
74echo " docker exec -it $PAIR_CONTAINER /bin/bash"
75echo " tmux attach"
76echo "and then prowl around in tmux with F3 and F4"
77
78docker exec $PAIR_CONTAINER /home/opencog/count-pairs-done.sh
79
80echo "Done pair counting in container $PAIR_CONTAINER"
81
82echo "Copying word-pairs dataset to $DATA_DIR"
83docker container cp $PAIR_CONTAINER:/home/opencog/text/. $TEXT_DIR
84docker container cp $PAIR_CONTAINER:/home/opencog/data/. $DATA_DIR
85echo "Done!"
86date
opencog/lang-pairs/build.sh +6 -0
……@@ -0,0 +1,6 @@
1#! /bin/bash
2#
3# Build the docker image for opencog/lang-pairs
4#
5docker build -t opencog/lang-pairs .
6# docker build --no-cache -t opencog/lang-pairs .
opencog/lang-pairs/demo-dict-pair/4.0.affix +9 -0
……@@ -0,0 +1,9 @@
1
2")" "}" "]" ">" » 〉 ) 〕 》 】 ] 』 」 "’’" "’" '' '
3"%" "," "." 。 ":" ";" "?" "!" ‽ ؟ ? ! … ... "”" "–" "‐" 、 ~
4¢ ₵ ™ ℠ : RPUNC+;
5
6"(" "{" "[" "<" « 〈 ( 〔 《 【 [ 『 「 `` „ “ ‘ '' ' … ...
7¿ ¡ "$"
8£ ₤ € ¤ ₳ ฿ ₡ ₢ ₠ ₫ ৳ ƒ ₣ ₲ ₴ ₭ ₺ ℳ ₥ ₦ ₧ ₱ ₰ ₹ ₨ ₪ ﷼ ₸ ₮ ₩ ¥ ៛ 호점
9† †† ‡ § ¶ © ® ℗ № "#": LPUNC+;
opencog/lang-pairs/demo-dict-pair/README.md +16 -0
……@@ -0,0 +1,16 @@
1Demo Atomese word-pair dictionary
2---------------------------------
3This is an example configuration for an AtomSpace-backed dictionary,
4configured for parsing using word-pair MI data. The resulting parses
5are Maximum Planar Graph parses: parses that draw links between words
6in such a way as to maximize the MI between word-pairs.
7
8For general info about Link Grammar dictionaries running out of the
9AtomSpace, 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".
opencog/lang-pairs/demo-dict-pair/storage.dict +103 -0
……@@ -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.
103foo: UNITS+;
opencog/lang-pairs/run.sh +11 -0
……@@ -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
8docker create --name pair-counter -p 8080:80 -p 17002:17002 -it opencog/lang-pairs
9docker start -i pair-counter
10
11clear
opencog/lang-pairs/scripts/count-pairs-done.sh +23 -0
……@@ -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
10sleep 60
11
12# Wait for evidence that marginals have been computed.
13while [[ ! -f /tmp/pair-marginals-done ]] ; do
14 sleep 60
15done
16
17# Shut down the tmux session.
18tmux 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.
23pkill -9 bash
opencog/lang-pairs/scripts/count-pairs.sh +33 -0
……@@ -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.
13cd ~/experiments/
14cp -pr run-1 run-2
15cd run-2
16rm -f 3-mpg-conf.sh 4-gram-conf.sh
17
18# Use the default configuration.
19source 0-pipeline.sh
20source 2-pair-conf.sh
21
22# Remove scripts for later stages (avoid confusion)
23cd run
24rm -rf 3-mst-parsing 4-gram-class
25
26# Remove semaphore, just in case.
27rm -f /tmp/pair-marginals-done
28
29# Run the pair-counting pipeline in byobu.
30cd 2-word-pairs
31./run-all.sh
32
33echo "Done word-pair counting. Good bye!"
opencog/learn/Dockerfile +30 -0
……@@ -0,0 +1,30 @@
1#
2# Container with core learning repos. No data.
3#
4ARG OS_VERSION=latest
5ARG BASE_IMAGE=opencog/atomspace:${OS_VERSION}
6FROM ${BASE_IMAGE}
7
8# Install everything learn-related.
9RUN /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
17USER opencog
18WORKDIR /home/opencog
19
20# Compile the scheme files as the user.
21RUN guile -c "(use-modules (opencog matrix) (opencog lg) (opencog learn))"
22
23# Place a basic recommended configuration where the user can find it.
24COPY /scripts/ /home/opencog
25RUN sudo chown -R opencog:opencog setup-for-experiments.sh && \
26 chmod ugo+x setup-for-experiments.sh
27
28CMD /bin/bash
29
30ONBUILD USER root
opencog/learn/README.md +27 -0
……@@ -0,0 +1,27 @@
1opencog/learn
2-------------
3This docker image contains all of the tools needed for the "learn"
4subsystem, including the nlp subsystem.
5
6## Building
7
8There 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
15To get fresh containers after github sources have changed, you will
16need to add the `--no-cache` flag to the `docker build` command.
17
18## Running
19
20You can start the bare container by saying `./run.sh` in this directory.
21However, it might be more interesting to try the word-pair-counting
22experiment in the `../lang-pairs` directory.
23
24If you do run this container, then the first thing you'll want to do
25after starting it is to run the `setup-for-experiments.sh` shell script.
26This will initialize a reasonable working environment for doing learning
27experiments.
opencog/learn/build.sh +6 -0
……@@ -0,0 +1,6 @@
1#! /bin/bash
2#
3# Build the docker image for opencog/learn
4#
5docker build -t opencog/learn .
6# docker build --no-cache -t opencog/learn .
opencog/learn/run.sh +9 -0
……@@ -0,0 +1,9 @@
1#! /bin/bash
2#
3# Run the docker container. Stop any previously running copies.
4#
5./stop.sh
6
7docker run --name="base-learn" -it opencog/learn
8
9clear
opencog/learn/scripts/setup-for-experiments.sh +14 -0
……@@ -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
9mkdir text && mkdir text/input-pages
10mkdir data
11mkdir experiments && mkdir experiments/run-1
12cp --preserve=mode,timestamps -r /usr/local/share/opencog/learn/run-config/*.sh experiments/run-1
13cp --preserve=mode,timestamps -r /usr/local/share/opencog/learn/run-common experiments/run-common
14cp --preserve=mode,timestamps -r /usr/local/share/opencog/learn/run experiments/run-1
opencog/learn/stop.sh +14 -0
……@@ -0,0 +1,14 @@
1#! /bin/bash
2#
3# Stop any running containers previously started with 'run.sh'
4#
5TAINER=`docker ps |grep base-learn |cut -f1 -d" "`
6if test x"$TAINER" != x; then
7 echo -n 'Stopping leftover container... '
8 docker stop -t 1 $TAINER
9fi
10TAINER=`docker ps -a |grep base-learn`
11if test x"$TAINER" != x; then
12 echo -n 'Removing... '
13 docker rm base-learn
14fi