Compare commits
2 commits
3b3d9abc87
...
d2f4e02361
| Author | SHA1 | Date | |
|---|---|---|---|
| d2f4e02361 | |||
| 00623caca2 |
7 changed files with 253 additions and 13 deletions
182
.gitignore
vendored
182
.gitignore
vendored
|
|
@ -1,15 +1,18 @@
|
||||||
# Compiled Object files from SCons
|
# Compiled Object files from SCons
|
||||||
*.os
|
*.os
|
||||||
|
|
||||||
# Generated by tooling
|
# Generated for current Godot
|
||||||
extension_api.json
|
extension_api.json
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
|
||||||
# clangd cache
|
# clangd cache
|
||||||
.cache/
|
.cache/
|
||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/c++,godot,scons
|
# Generated MAVLink headers
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,godot,scons
|
/include/mavlink
|
||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/c++,godot,scons,python
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,godot,scons,python
|
||||||
|
|
||||||
### C++ ###
|
### C++ ###
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
|
|
@ -62,6 +65,177 @@ export_presets.cfg
|
||||||
data_*/
|
data_*/
|
||||||
mono_crash.*.json
|
mono_crash.*.json
|
||||||
|
|
||||||
|
### Python ###
|
||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
||||||
|
|
||||||
|
### Python Patch ###
|
||||||
|
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
||||||
|
poetry.toml
|
||||||
|
|
||||||
|
# ruff
|
||||||
|
.ruff_cache/
|
||||||
|
|
||||||
|
# LSP config files
|
||||||
|
pyrightconfig.json
|
||||||
|
|
||||||
### SCons ###
|
### SCons ###
|
||||||
# for projects that use SCons for building: http://http://www.scons.org/
|
# for projects that use SCons for building: http://http://www.scons.org/
|
||||||
.sconsign.dblite
|
.sconsign.dblite
|
||||||
|
|
@ -70,4 +244,4 @@ mono_crash.*.json
|
||||||
config.log
|
config.log
|
||||||
.sconf_temp
|
.sconf_temp
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/c++,godot,scons
|
# End of https://www.toptal.com/developers/gitignore/api/c++,godot,scons,python
|
||||||
|
|
|
||||||
5
.gitmodules
vendored
5
.gitmodules
vendored
|
|
@ -1,3 +1,6 @@
|
||||||
[submodule "godot-cpp"]
|
[submodule "godot-cpp"]
|
||||||
path = godot-cpp
|
path = modules/godot-cpp
|
||||||
url = https://github.com/godotengine/godot-cpp.git
|
url = https://github.com/godotengine/godot-cpp.git
|
||||||
|
[submodule "modules/mavlink"]
|
||||||
|
path = modules/mavlink
|
||||||
|
url = https://github.com/marsh-sim/mavlink.git
|
||||||
|
|
|
||||||
31
README.md
31
README.md
|
|
@ -4,19 +4,36 @@ Named in this order so not everything starts with the same word
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
Using Godot v4.4.beta1.official [d33da79d3].
|
This repository uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules), to get all the code you need to run either:
|
||||||
Install SCons with `pipx install scons`.
|
|
||||||
|
|
||||||
To generate files for build tooling, run the following:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
godot --dump-extension-api
|
git clone --recurse-submodules <address of this repository>
|
||||||
scons compile_commands
|
# Or at any later point
|
||||||
|
git submodule update --init --recursive
|
||||||
|
```
|
||||||
|
|
||||||
|
Using Godot v4.4.beta1.official [d33da79d3](https://github.com/godotengine/godot/commit/d33da79d3f8fe84be2521d25b9ba8e440cf25a88).
|
||||||
|
Install SCons with `pipx install scons`.
|
||||||
|
For updating MAVLink generator, you additionally `pip install future`.
|
||||||
|
It is recommended to install any packages in a [virtual environment](https://docs.python.org/3/library/venv.html), for example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python3 -m venv venv
|
||||||
|
source venv/bin/activate
|
||||||
|
pip install future
|
||||||
|
```
|
||||||
|
|
||||||
|
Some files are generated, run the following commands on first setup and when dependencies change:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
godot --dump-extension-api # after updating Godot
|
||||||
|
scons compile_commands # after modifying SConstruct
|
||||||
|
python update_mavlink.py # after updating MAVLink dialect
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
|
|
||||||
To build the extension run SCons in the repository root, the default arguments have been added to the file.
|
To build the GDExtension binary run SCons in the repository root, the default arguments have been added to the file.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
scons
|
scons
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
env = SConscript("godot-cpp/SConstruct")
|
env = SConscript("modules/godot-cpp/SConstruct")
|
||||||
|
|
||||||
# For reference:
|
# For reference:
|
||||||
# - CCFLAGS are compilation flags shared between C and C++
|
# - CCFLAGS are compilation flags shared between C and C++
|
||||||
|
|
|
||||||
1
modules/mavlink
Submodule
1
modules/mavlink
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 153d474873a461f1554c2c34aaa864f818509eef
|
||||||
45
update_mavlink.py
Normal file
45
update_mavlink.py
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
Generates required libraries based on the message definitions in mavlink submodule.
|
||||||
|
Doesn't accept any arguments by design.
|
||||||
|
|
||||||
|
Requires future package, example of installation:
|
||||||
|
```
|
||||||
|
pip install future
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
|
||||||
|
from os import path, makedirs
|
||||||
|
from shutil import copytree
|
||||||
|
import sys
|
||||||
|
|
||||||
|
# add repository root path to import local module regardless of location
|
||||||
|
root_path = path.abspath(path.dirname(__file__))
|
||||||
|
sys.path.insert(1, root_path)
|
||||||
|
# fmt: off - don't move import to top of file
|
||||||
|
from modules.mavlink.pymavlink.generator import mavgen
|
||||||
|
from modules.mavlink.pymavlink.generator.mavparse import PROTOCOL_2_0
|
||||||
|
# fmt: on
|
||||||
|
|
||||||
|
definitions_path = path.join(root_path, 'modules', 'mavlink',
|
||||||
|
'message_definitions', 'v1.0')
|
||||||
|
dialect_file = 'all.xml'
|
||||||
|
out_path = path.join(root_path, 'include', 'mavlink')
|
||||||
|
|
||||||
|
# generate C library
|
||||||
|
opts = mavgen.Opts(out_path, wire_protocol=PROTOCOL_2_0,
|
||||||
|
language='C', validate=True, strict_units=True)
|
||||||
|
mavgen.mavgen(opts, [path.join(definitions_path, dialect_file)])
|
||||||
|
|
||||||
|
out_definitions_path = path.join(out_path, 'message_definitions')
|
||||||
|
print("Copying message definitions to", out_definitions_path)
|
||||||
|
makedirs(out_definitions_path, exist_ok=True)
|
||||||
|
copytree(definitions_path, out_definitions_path, dirs_exist_ok=True)
|
||||||
|
|
||||||
|
# generate Python library
|
||||||
|
out_path = path.join(root_path, 'dist', 'all_marsh')
|
||||||
|
makedirs(path.dirname(out_path), exist_ok=True)
|
||||||
|
opts.output = out_path
|
||||||
|
opts.language = 'Python3'
|
||||||
|
mavgen.mavgen(opts, [path.join(definitions_path, dialect_file)])
|
||||||
Loading…
Add table
Add a link
Reference in a new issue