Include New Library For own Hal-Componet

  • TheRoslyak
  • TheRoslyak's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
24 Feb 2021 07:21 - 24 Feb 2021 07:24 #199929 by TheRoslyak
Include New Library For own Hal-Componet was created by TheRoslyak
Hi everyone
Can someone tell you step by step how to import a library to create a new hal component. Or if it's not difficult to write a guide for dummies. What to put in what folders and etc.
The example requires using the SQLite library. or simpler Stdio
Attachments:
Last edit: 24 Feb 2021 07:24 by TheRoslyak.

Please Log in or Create an account to join the conversation.

More
24 Feb 2021 11:48 #199962 by rodw
Replied by rodw on topic Include New Library For own Hal-Componet
halcompile --install mycomp.comp
You may need to use sudo if not run in place

But calling SQL from within a real time environment that has to execute every one millisecond is a really bad idea. It can't work.

It needs to be called from user space (probably in python) where its not real time
The following user(s) said Thank You: TheRoslyak

Please Log in or Create an account to join the conversation.

  • TheRoslyak
  • TheRoslyak's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
24 Feb 2021 19:37 #200014 by TheRoslyak
Replied by TheRoslyak on topic Include New Library For own Hal-Componet
I didn't mean it.
I meant how can I import my library (for example SQLite)
Now If now I just write #include <sqlite.h> - then I get an error.
I just don't know how to put it in the right folders. sqlite.h & sqlite.c in derectory Linuxcnc-dev.
I will explain what I want to implement:
The data that is written to the database appears after the camera is detected object.
Objects appear as the conveyor moves. I want to calculate where this object will be located after some time.
To do this, I attach an encoder and find the real position of the object

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
24 Feb 2021 21:17 #200029 by tommylight
Replied by tommylight on topic Include New Library For own Hal-Componet
Not LinuxCNC related, but it does apply to what you need done:

He has many more of those videos.

Please Log in or Create an account to join the conversation.

More
25 Feb 2021 06:01 #200061 by Mike_Eitel
Replied by Mike_Eitel on topic Include New Library For own Hal-Componet
Yes a very clever guy..
And consider how precise he is able to position the stock via "cables"

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
28 Feb 2021 22:13 #200469 by andypugh
Replied by andypugh on topic Include New Library For own Hal-Componet

I didn't mean it.
I meant how can I import my library (for example SQLite)
Now If now I just write #include <sqlite.h> - then I get an error.


To include a library in a .comp you need to use the "include" command above the ;;

"include" is a halcompile directive which puts the "#include" in the right place in the generated C file.

linuxcnc.org/docs/2.8/html/hal/comp.html#_syntax

Please Log in or Create an account to join the conversation.

Time to create page: 0.106 seconds
Powered by Kunena Forum