#emc-devel | Logs for 2008-07-19

Back
[01:11:34] <jmkasunich> jepler_: around? got a python question
[01:14:59] <jmkasunich> I'd like to extend vismach - I want to have a self.volume value for each primitive - I know how to add it to Box, Cylinder, etc
[01:15:27] <jmkasunich> but the next step is to add it to class Collection, such that the volume of the collection = the sum of its parts
[01:17:08] <jmkasunich> actually, I don't know how to add it to the primitives
[01:17:29] <jmkasunich> I was gonna stick the computation in __init, but they don't have an init - all the calcs are done in the draw method
[01:28:03] <jepler_> jmkasunich: hm, you could make volume a method -- def volume(self): return ...
[01:28:14] <jepler_> then in collection, it can do a sum of the volume of the contents
[01:28:33] <jmkasunich> I just wrote the volume method for Box
[01:28:51] <jmkasunich> I haven't figured out yet how to iterate over all the things in a collection
[01:29:03] <jepler_> class Collection(object):
[01:29:03] <jepler_> def volume(self):
[01:29:03] <jepler_> return sum(part.volume for part in parts)
[01:29:08] <jepler_> I think it'll look something like that: ^^
[01:29:13] <jmkasunich> cool, thanks
[01:29:17] <jmkasunich> now one more thing
[01:29:27] <jmkasunich> I see that Color is a class
[01:29:34] <jmkasunich> class Color(Collection):
[01:29:53] <jmkasunich> I think of color as being an attribute of a collection, not an object in itself
[01:30:26] <jepler_> a Color is a kind of Collection that applies the color to the things it contains
[01:31:26] <jmkasunich> Color will need to have a volume method, right?
[01:31:36] <jepler_> no, it will get the one from Collection
[01:31:43] <jmkasunich> oh, cool
[01:34:00] <jmkasunich> return sum(part.volume() for part in self.parts)
[01:34:05] <jmkasunich> almost what you gave me
[01:34:16] <jmkasunich> () after the recursive call, and self.parts, not parts
[01:34:39] <jmkasunich> * jmkasunich is making poor man's proE
[01:35:31] <jmkasunich> should say, programmer's pro-E
[01:35:44] <jmkasunich> there's no GUI, you have to write python to describe your part(s)
[01:44:46] <jepler_> ah right
[01:44:50] <jepler_> jepler_ is now known as jepler
[01:45:00] <jepler> it doesn't make much sense to add functions (methods) together :-P
[01:45:06] <jmkasunich> you warned me that it would be "something like that"
[01:45:25] <jepler> OK, now write the "center of gravity" and "moment of inertia" functions :-P
[01:45:41] <jmkasunich> I'm still doing volume of a cylinder
[01:45:55] <jmkasunich> (since our cylinder primitive actually can do a frustum of a cone)
[01:46:22] <jepler> I love the word "frustum"
[01:46:45] <jmkasunich> google corrected my misspelling "frustrum"
[01:47:11] <jepler> I like that word too
[01:48:25] <jmkasunich> is it a word?
[01:49:22] <jepler> no, probably not
[01:52:52] <jmkasunich> this OO stuff is kinda cool
[01:54:04] <jmkasunich> grr
[01:54:18] <jmkasunich> there are lots of objects that aren't really objects
[01:58:20] <jepler> hm you sound a little bipolar
[01:58:30] <jmkasunich> heh
[01:58:37] <jepler> what's biting you now?
[01:58:56] <jmkasunich> "Capture" is a collection
[01:59:05] <jmkasunich> (used for tracking the toolpath)
[01:59:23] <jmkasunich> it had no volume method, so it barfed - I just gave it one that returns zero
[01:59:26] <jepler> maybe you need to 'def volume(self): return 0' in it
[01:59:58] <jepler> but I see you figured that out first
[02:00:17] <jmkasunich> now I'm trying to find out why one of my cylinders has zero volume
[02:01:21] <jmkasunich> hmm, is there a way to print the name of a class instance
[02:01:24] <jmkasunich> example:
[02:01:30] <jmkasunich> foo = Box(blah)
[02:01:36] <jmkasunich> bar = Box(blah)
[02:01:44] <jmkasunich> baz = Collection([foo,bar)
[02:01:53] <jepler> you can 'print' almost any object
[02:01:57] <jepler> it'll say something cryptic like <__main__.X instance at 0x7f4914aef4d0>
[02:02:09] <jmkasunich> when I invoke baz.volume, it recurses down thru foo and bar
[02:02:27] <jmkasunich> I'm printing in Box.volume
[02:02:29] <jepler> oh, the name like 'bar'? no
[02:02:35] <jmkasunich> but I can't tell which line corresponds....
[02:02:37] <jmkasunich> bummer
[02:03:36] <jmkasunich> if I was really trying to make this thing more CADish, I guess I'd add a name to each instance
[02:04:35] <jepler> huh -- why would you define the address lines of your SRAM interface to be 'SLOW' slew rate, and the data lines to be 'FAST'?
[02:04:44] <jepler> (fpga with external SRAM)
[02:05:01] <jmkasunich> no idea
[02:05:13] <jmkasunich> are there lots of external ram chips?
[02:05:26] <jmkasunich> (loading issue with fast transitions?)
[02:05:43] <jepler> I think it's 2 1Mx16 SRAMs organized as 1Mx32
[02:06:24] <jepler> er, 256Kx (1MB total)
[02:06:49] <jmkasunich> 64K x 16 = 1Mb
[02:07:02] <jmkasunich> oh, big B
[02:09:09] <jmkasunich> I'm having a bit of trouble wrapping my head around the "coords" method
[02:09:15] <jmkasunich> in particular, HalToolCylinder
[02:10:11] <jmkasunich> I have a non-zero tool radius and length, and it is being drawn correctly, but when I invoke volume, it assumes zero radius
[02:10:23] <jmkasunich> oh, never mind
[02:10:58] <jmkasunich> I'm invoking volume during startup, before the hal pin that provides the radius is connected
[02:14:39] <jepler> that makes sense
[02:15:55] <jmkasunich> yep - invoked it on return from main and got a non-zero answer
[02:38:54] <jmkasunich> hmm, there are limits to this technique
[02:39:08] <jmkasunich> if you construct a union of objects, the overlapping volume gets counted twice
[02:43:29] <rayh_> What do you guys make of this compile time warning.
[02:43:41] <rayh_> hal/classicladder/socket_modbus_master.c:257: warning: the address of ‘ClientSocketOpened’ will always evaluate as ‘true’
[02:44:07] <jmkasunich> trunk>
[02:44:11] <jmkasunich> trunk?
[02:44:13] <rayh> Yes
[02:44:21] <jmkasunich> looking now
[02:44:26] <jepler> ClientSocketOpened is a function, but it's used where a boolean value is normally expected -- if ( ClientSocketOpened )
[02:44:34] <jepler> maybe the intent was to call the function and look at the return value
[02:44:51] <jmkasunich> yep
[02:45:06] <jmkasunich> if ( ClientSocketOpened() )
[02:45:44] <jmkasunich> eww
[02:46:00] <jmkasunich> indentation is all fscked up right there
[02:47:57] <jmkasunich> I wouldn't feel too bad about just adding the () and committing it, but if you want to be really safe email Chris Morley
[02:48:14] <jmkasunich> the indentation should be fixed too, but not in the same commit
[02:49:20] <rayh_> I can email Chris if you want with a copy of this.
[02:49:31] <jmkasunich> I'll leave it to you
[02:49:40] <rayh_> Got another one.
[02:49:45] <jmkasunich> I'm about 99.99% sure the () will fix it
[02:50:10] <rayh_> k -- lost the second one. it was emcrsh
[02:50:35] <jmkasunich> might have to touch the file - if it compiled once, make won't compile it again
[02:50:39] <rayh_> emc/usr_intf/emclcd.cc:399: warning: comparison with string literal results in unspecified behaviour
[02:52:40] <jmkasunich> I bet he wanted to compare to NULL, but that one is less clear to me - it should be brought to Eric's attention
[02:52:58] <rayh_> k I'll do that as well.
[02:53:10] <rayh_> Thanks
[02:53:33] <jmkasunich> both of those lines are testing for conditions which are rare, but could cause a crash if not detected
[02:53:42] <jmkasunich> thanks for catching them
[02:54:16] <rayh_> np. was testing a bit of stuff of my own when they went by.
[03:14:56] <CIA-34> EMC: 03jmkasunich 07TRUNK * 10emc2/lib/python/vismach.py: added computation of the volume of each primitive - for crude solid modeling work
[03:18:31] <CIA-34> EMC: 03rayh 07TRUNK * 10emc2/src/emc/nml_intf/canon.hh: Added ifndefs for cleaner product of java script.
[03:19:10] <CIA-34> EMC: 03rayh 07TRUNK * 10emc2/src/emc/rs274ngc/rs274ngc.hh: Added ifndefs for cleaner product of java script.
[09:52:27] <CIA-34> EMC: 03cmorley 07TRUNK * 10emc2/src/hal/classicladder/socket_modbus_master.c: Fix compiler complaint- removed code to check a variable that was always true and unnessasary
[09:53:30] <CIA-34> EMC: 03cmorley 07TRUNK * 10emc2/src/hal/classicladder/protocol_modbus_master.c: Change messages for consistency
[13:28:10] <fenn_> fenn_ is now known as fenn
[14:24:06] <rayh> Why do I get empty files named something like grohtml-###.png in docs/man?
[14:24:17] <rayh> And why don't they go away with a make clean?
[14:37:29] <jepler> grohtml is the thing that converts the manpages into html. Those files should presumably be added to the 'docclean' rule in doc/src/Submakefile.
[14:40:05] <rayh> Ah. That's why I get a new one each time I make.
[14:40:23] <rayh> Thanks Jeff.
[16:20:08] <CIA-34> EMC: 03rayh 07TRUNK * 10emc2/docs/src/Submakefile: add empty png files to make clean.
[17:04:19] <CIA-34> EMC: 03lerman 07TRUNK * 10emc2/src/emc/rs274ngc/ (4 files): Add support for wizard directory. Fix a bug in O_word elseif.
[20:47:52] <CIA-34> EMC: 03seb 07TRUNK * 10emc2/src/hal/drivers/mesa-hostmot2/ (hm2_7i43.c hostmot2-lowlevel.h): minor cleanups
[20:48:25] <CIA-34> EMC: 03seb 07TRUNK * 10emc2/src/hal/drivers/mesa-hostmot2/TODO: once more i think i know what i'm going to do about firmware loading
[20:48:26] <CIA-34> EMC: 03seb 07TRUNK * 10emc2/src/hal/drivers/mesa-hostmot2/doc/firmware-loading-debacle: once more i think i know what i'm going to do about firmware loading
[20:51:36] <jmkasunich> lol at seb
[20:53:20] <jmkasunich> http://cvs.linuxcnc.org/cvs/emc2/src/hal/drivers/mesa-hostmot2/doc/firmware-loading-debacle?rev=1.1