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

add auto generated Lua docs #3865

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setting environement
- name: Setting environment
run: |
mkdir /tmp/web
git submodule update --init --recursive
./Sphinxsetup.sh
- name: Check image formats
run: |
find ./images/ -exec file {} + | grep RIFF -vzq
- name: Test build
run: |
./update.py --parallel 4 --verbose --destdir=/tmp/web
- name: Archive build output
uses: actions/upload-artifact@v2
with:
name: build
path: /tmp/web
retention-days: 5
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,6 @@
/frontend/blog_posts.json
/frontend/news_posts.json

# Scripting Docs
*.lua

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "modules/sphinx-lua"]
path = modules/sphinx-lua
url = https://github.com/IamPete1/sphinx-lua.git
8 changes: 8 additions & 0 deletions Sphinxsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ python3 -m pip install --user --upgrade git+https://github.com/ArduPilot/sphinxc
# and a parser to use getting posts from Discourse (forum) and insert in FrontEnd
python3 -m pip install --user --upgrade beautifulsoup4

# intall lua docs
python3 -m pip install --user --upgrade luadoc
python3 -m pip install --user --upgrade sphinxcontrib-luadomain
python3 -m pip install --user --upgrade Jinja2
cd modules/sphinx-lua
python3 setup.py install --user
cd ../..

echo "Setup completed successfully!"
5 changes: 5 additions & 0 deletions antennatracker/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
'sphinxcontrib.luadomain', # For lua scripting docs
'sphinx_lua'# For lua scripting docs
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# For lua scripting docs
lua_source_path = ["../docs.lua"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
Expand Down
400 changes: 400 additions & 0 deletions common/source/docs/common-lua-API.rst

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions common/source/docs/common-lua-binding-syntax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,13 @@ In order to see how this would be used:
end

note that velVar could have a value of 0 and still the ``if`` statement test would be true in the LUA script.

How to Add New Bindings
-----------------------

To give Lua scripts access to more features of ArduPilot the API can be extended by creating new bindings. The process is as follows:

- Find the method or function you would like to expose to Lua. For example if you wanted to expose an additional feature of AHRS you would first find the method within `libraries/AP_AHRS/AP_AHRS.h <https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_AHRS/AP_AHRS.h>`__. This can be an already existing method (function) or a method (function) newly added to the code.
- Edit the `libraries/AP_Scripting/generator/description/bindings.desc <https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Scripting/generator/description/bindings.desc>`__ and add a new line in the appropriate section for the method, or add a new section if a new class shall be added by following the examples of the other sections.
- For releases before Copter/Rover/Plane 4.1: Open a command line prompt and cd to the `/libraries/AP_Scripting/generator <https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Scripting/generator>`__ directory and type "make run".
- For 4.1 onwards, clean the distribution (./waf distclean) and restart compilation from there as usual.
427 changes: 11 additions & 416 deletions common/source/docs/common-lua-scripts.rst

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions copter/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
'sphinxcontrib.luadomain', # For lua scripting docs
'sphinx_lua'# For lua scripting docs
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# For lua scripting docs
lua_source_path = ["../docs.lua"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
Expand Down
5 changes: 5 additions & 0 deletions dev/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
'sphinxcontrib.luadomain', # For lua scripting docs
'sphinx_lua'# For lua scripting docs
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# For lua scripting docs
lua_source_path = ["../docs.lua"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
Expand Down
1 change: 1 addition & 0 deletions modules/sphinx-lua
Submodule sphinx-lua added at dd3832
5 changes: 5 additions & 0 deletions plane/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
'sphinxcontrib.luadomain', # For lua scripting docs
'sphinx_lua'# For lua scripting docs
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# For lua scripting docs
lua_source_path = ["../docs.lua"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
Expand Down
5 changes: 5 additions & 0 deletions rover/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
'sphinxcontrib.luadomain', # For lua scripting docs
'sphinx_lua'# For lua scripting docs
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# For lua scripting docs
lua_source_path = ["../docs.lua"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
Expand Down
5 changes: 5 additions & 0 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import subprocess
import sys
import time
import requests

from codecs import open
from datetime import datetime
Expand Down Expand Up @@ -794,6 +795,10 @@ def copy_static_html_sites(site):
# Fetch most recent LogMessage metadata from autotest:
fetchlogmessages(args.site)

# download lua docs direct from github
lua_docs_name = os.path.join(os.getcwd() ,'docs.lua')
lua_docs_url = "https://raw.githubusercontent.com/ArduPilot/ardupilot/master/libraries/AP_Scripting/docs/docs.lua"
open(lua_docs_name, 'wb').write(requests.get(lua_docs_url).content)

copy_static_html_sites(args.site)
generate_copy_dict()
Expand Down