lego simulation

1 view
Skip to first unread message

ben lipkowitz

unread,
Jul 28, 2009, 11:45:53 PM7/28/09
to openmanu...@googlegroups.com
Lately in the lab Bryan and I have been talking about interface
specifications. One system with very simple and regular interfaces between
components is the Lego brick system. I thought it would be a good example
package so I set about looking for Lego CAD files.

Coby of tubafrog.com takes the cake. Hard to believe this was all done in
POV-RAY (except the last bit). This is the sort of thing I want to do with
SKDB eventually, but for any manufacturing process, not just snapping
bricks together:

assembly sequences:
http://youtube.com/watch?v=AFwegptAWgA
http://youtube.com/watch?v=wauEdP2jGS4
http://youtube.com/watch?v=JNyiC6udVFk
http://youtube.com/watch?v=dX4oItFzH7Q

kinematics and gears:
http://youtube.com/watch?v=Z1zFaS7q-0Q
http://youtube.com/watch?v=ZJfSbjW2SVs

last but not least, physics simulation:
http://www.youtube.com/watch?v=jUav4Nq497k

if for whatever reason you can't see youtube videos, the still images are
pretty amazing
http://www.tubafrog.com/lego/images/6987.jpg
http://www.tubafrog.com/lego/images/4956%20-%20Creator%20House.jpg
http://www.tubafrog.com/lego/images/951.jpg

ben lipkowitz

unread,
Aug 14, 2009, 12:03:20 AM8/14/09
to openmanu...@googlegroups.com
On Wed, 29 Jul 2009, ben lipkowitz wrote:
> Lately in the lab Bryan and I have been talking about interface
> specifications. One system with very simple and regular interfaces between
> components is the Lego brick system. I thought it would be a good example
> package so I set about looking for Lego CAD files.

And now it works, sorta.
First we specify the interfaces in HeeksCAD: (the origin marks)
http://adl.serveftp.org/lab/fenn/stone-presentation/lego_heeks.png

then extract coordinates from the .heeks file and add them to the yaml file:
http://adl.serveftp.org/lab/fenn/stone-presentation/lego_yaml_interfaces.png

now pick a pair of studs and anti studs and translate one brick
appropriately:
http://adl.serveftp.org/lab/fenn/stone-presentation/lego_demo1.png
http://adl.serveftp.org/lab/fenn/stone-presentation/lego_demo2.png

there are multiple solutions to the problem of course (512 to be precise)
here is another one:
http://adl.serveftp.org/lab/fenn/stone-presentation/lego_demo3.png

theoretically this should work for any pair of legos, we just need people
to input data about each one.


it'll be a while yet before we can put together more than two legos :(

Vitaly Mankevich

unread,
Aug 14, 2009, 1:07:09 AM8/14/09
to openmanu...@googlegroups.com
> And now it works, sorta.
> First we specify the interfaces in HeeksCAD: (the origin marks)
> http://adl.serveftp.org/lab/fenn/stone-presentation/lego_heeks.png
>
> then extract coordinates from the .heeks file and add them to the yaml file:
> http://adl.serveftp.org/lab/fenn/stone-presentation/lego_yaml_interfaces.png
>
> now pick a pair of studs and anti studs and translate one brick
> appropriately:
> http://adl.serveftp.org/lab/fenn/stone-presentation/lego_demo1.png
> http://adl.serveftp.org/lab/fenn/stone-presentation/lego_demo2.png

Not bad at all, and where do you specify that "anti stud" goes
together with "stud cup" and not with another anti stud?

Bryan Bishop

unread,
Aug 14, 2009, 6:06:13 AM8/14/09
to openmanu...@googlegroups.com, kan...@gmail.com
On Fri, Aug 14, 2009 at 12:07 AM, Vitaly Mankevich wrote:
> Not bad at all, and where do you specify that "anti stud" goes
> together with "stud cup" and not with another anti stud?

http://adl.serveftp.org/git/gitweb.cgi?p=skdb.git;a=blob_plain;f=packages/lego/grammar.yaml;hb=HEAD

- Bryan
http://heybryan.org/
1 512 203 0507

ben lipkowitz

unread,
Aug 14, 2009, 11:00:29 AM8/14/09
to openmanu...@googlegroups.com
On Thu, 13 Aug 2009, Vitaly Mankevich wrote:
> Not bad at all, and where do you specify that "anti stud" goes
> together with "stud cup" and not with another anti stud?

in this file:
http://adl.serveftp.org/git/gitweb.cgi?p=skdb.git;a=blob_plain;f=packages/lego/grammar.yaml

(actually "anti stud" only goes with "stud" as far as i know.. one of the
screenshots in that directory was wrong, which I have now corrected)

it's not complete - technic has some weird stuff like chain links and
pneumatic tubing which I don't have any experience with, and there are a
lot more tire types than I expected so I might have to figure out a better
way to do that.

ben lipkowitz

unread,
Aug 28, 2009, 12:39:07 PM8/28/09
to openmanu...@googlegroups.com
On Fri, 14 Aug 2009, ben lipkowitz wrote:

> it'll be a while yet before we can put together more than two legos :(

You can now create random Lego creations with 4 different bricks!

It "only" took a week or so, once I discovered there was a bug in how OCC
handled transformations. Anyway, here's some screenshots:
http://adl.serveftp.org/lab/fenn/pngs/lego_snapping.png
http://adl.serveftp.org/lab/fenn/pngs/lego_snapping2.png
http://adl.serveftp.org/lab/fenn/pngs/lego_snapping3.png

There's no collision detection as of yet; I've highlighted some goofs in
this pic:
http://adl.serveftp.org/lab/fenn/pngs/lego_snapping4.png

It should be fairly simple to add checks to make sure the requested
interface (lego stud) is not already occupied. This won't fix all possible
problems, but should work for a simple set of standard bricks like this.

the code is here:
http://adl.serveftp.org/git/gitweb.cgi?p=skdb.git;a=blob;f=paths.py;h=65c5650973b28412762b4222bedc5ba21c000493;hb=c3ca4e7613974748ecb85c134114c262344868ec

Reply all
Reply to author
Forward
0 new messages