inital commit
This commit is contained in:
commit
1ac3c08f36
3 changed files with 194 additions and 0 deletions
41
collisionavoid.comp
Normal file
41
collisionavoid.comp
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
//CNCExtension Hal Component
|
||||
|
||||
component collisionavoid "Avoid Collisions";
|
||||
|
||||
pin in float xaxis;
|
||||
pin in float yaxis;
|
||||
pin in float zaxis;
|
||||
|
||||
pin in bit chuck;
|
||||
pin in bit table;
|
||||
|
||||
pin out bit stop;
|
||||
|
||||
option singleton yes; // makes no sense to have more than one of these components running
|
||||
option userspace yes;
|
||||
|
||||
license "GPL";
|
||||
;;
|
||||
|
||||
#include <stdio.h> /* Standard input/output definitions */
|
||||
|
||||
|
||||
void user_mainloop(void)
|
||||
{
|
||||
FOR_ALL_INSTS() //needed for resaons
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
usleep(500);
|
||||
if(chuck == 1 && xaxis > 107 && yaxis < 32 && zaxis < -25 ) stop = 1;
|
||||
else if(table == 1 && xaxis > 107 && yaxis < 32 && zaxis < -25 ) stop = 1;
|
||||
else stop = 0;
|
||||
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue