-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HAL Python module Examples Fail to Work #2884
Comments
I think I've narrowed it down to: Line 844 in 31d3b06
It seems its a struct up until this point, after this function it becomes a standard python type. |
>>> import hal
>>> h = hal.c
hal.component( hal.component_exists( hal.component_is_ready( hal.connect( hal.ctypes
>>> h = hal.component("asdf")
>>> pin = h.newpin("out", hal.HAL_U32, hal.HAL_OUT)
>>> pin.get_dir()
32
>>> pin.get_dir() == hal.HAL_OUT
True
>>> pin.get_dir() == hal.HAL_IN
False
>>> type(h.out)
<class 'int'>
>>> type(pin)
<class 'hal.Pin'>
>>> So it seems its not adding the struct but the type of hal component to the main class. |
So there is two documentations for this: Does it make sense to have both? |
They appear to be the same thing to me
Nothing every makes any sense to have it in two places. I worked for years on the docs to eliminate that... |
One does inherit from the other. But there should at least be a link |
Could look at moving functions from hal.py into the boost module. Then it's a single implementation as well? |
I think that they are different things. One describes the actual hal module (what you get when you "import hal") the other describes how to write non-realtime components in Python, which tends to use the halmodule library. |
I have a branch which ports halmodule to pybind11, which eliminates all of this issues, and removes 95% of the code. |
Are ou suggesting that someone should merge this, or is it presented just for info? |
I would love to continue working on pybind11, but anything prior to bookworm doesnt have packages for it. |
We have the ability to do our own backports, if that would help. |
Which packages is this? I can see that pybind11 goes back to Buster , but the version might be to old? If I'm reading correctly, we will now how two different ways of creating Python bindings, Boost and pybind11? Still, a really nice rewrite. |
http://linuxcnc.org/docs/stable/html/config/python-hal-interface.html
None of the examples work that start with h.
The text was updated successfully, but these errors were encountered: