In case anyone is interested.
Well, after do battle with dead PC's and learning how to make user
components. I've come to some conclusions. I tried to use the rand
component sample from the comp documentation as a guide:
http://www.linuxcnc.org/docview/html/hal_comp.html#r1_14_6
Only after much head banging, I finally decided to just compile rand as
is to see if it would work, and surprise ... it does. Working from there
I realized the what parts are generic user comp and what was rand
specific.
"...
component rand;
option userspace;
pin out float out;
license "GPL";
;;
#include <unistd.h> // Needed for usleep below
void user_mainloop(void) { // <-- I think when LinuxCNC starts, it looks for
a function called user_mainloop,
// but doesn't call it again after starting
// Once called, the while loop keeps this running.
What happens if one wants more than one user_mainloop?
while(1) { // <-- This endless loop is needed to cycle the
component to update inputs, outputs and set variables,
// This doesn't mysteriously get placed in a loop
by the comp utility
usleep(1000); // <-- Without this time delay the variables and
I/O might be unstable
FOR_ALL_INSTS() out = drand48(); // <-- The generic form of this might
be...
FOR_ALL_INSTS() { // <-- I have no idea what FOR_ALL_INSTS () is or
does, or where it lives, but it seems to work
< ** My wonderful component software here ** >
}
}
}
..."
User comps may be really obvious to some, but it took a long time for me
to figure out.
--
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users