Skip to content

Ground Script API Intro out of date #516

Open
@cjjacks

Description

@cjjacks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions