Skip to content
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

Ground Script API Intro out of date #516

Open
cjjacks opened this issue Mar 7, 2024 · 0 comments
Open

Ground Script API Intro out of date #516

cjjacks opened this issue Mar 7, 2024 · 0 comments

Comments

@cjjacks
Copy link
Contributor

cjjacks commented Mar 7, 2024

First issue here so let me know if I'm missing anything...

AIT Core Version: 2.5.1

The documentation for the Ground Script API Introduction might be out of date and/or have a few bugs:

https://ait-core.readthedocs.io/en/master/api_intro.html

One such issue is an attribute name starting with a number:

[foo@b5cb4209b90d ~]$ workon ait
(ait) [foo@b5cb4209b90d ~]$ python
Python 3.7.9 (default, Mar  5 2024, 17:13:40) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ait.core.api import Instrument, wait
>>> inst = Instrument()
>>> inst.tlm.1553_HS_Packet
  File "<stdin>", line 1
    inst.tlm.1553_HS_Packet
                 ^
SyntaxError: invalid token

A packet definition that doesn't start with a number works fine but throws an exception when following along with the documentation:

>>> telem = inst.tlm.Ethernet_HS_Packet
>>> telem.CmdsRcvd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ttc/.virtualenvs/ait/lib/python3.7/site-packages/ait/core/api.py", line 509, in __getattr__
    return self._packets[0].__getattr__(name)
  File "/home/ttc/.virtualenvs/ait/lib/python3.7/site-packages/ait/core/api.py", line 365, in __getitem__
    return self._deque.__getitem__(index)
IndexError: deque index out of range

Additionally, the "Putting it all Together" section seems to suggest that the "wait" function is non-blocking and waits forever. But, when following along with the documentation, the wait call blocks and eventually times out:

>>> wait(lambda: len(inst.tlm.Ethernet_HS_Packet) > 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ttc/.virtualenvs/ait/lib/python3.7/site-packages/ait/core/api.py", line 731, in wait
    raise APITimeoutError(_timeout, msg)
ait.core.api.APITimeoutError: APITimeoutError: Timeout (10 seconds) exceeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant