Skip to content

Commit

Permalink
auto-generate MAVLink messages files
Browse files Browse the repository at this point in the history
  • Loading branch information
ES-Alexander committed Jun 12, 2024
1 parent 10d7a33 commit 498c504
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8' # Set the Python version you need
python-version: '3.11' # Set the Python version you need

- name: Install dependencies
run: |
python -m pip install --upgrade pip GitPython packaging lxml emit xmltodict
python -m pip install --upgrade pip GitPython packaging lxml emit xmltodict pymavlink
# Add any other dependencies here
- name: Run Python script
run: |
python scripts/run_param_parse.py
python scripts/run_parsers.py
python scripts/json_from_xml.py
- name: Commit and push if changed
Expand Down
15 changes: 14 additions & 1 deletion scripts/run_param_parse.py → scripts/run_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def run(self):
tag_names = [tag.path[len('refs/tags/'):] for tag in self.repository.tags]
last_ground_change = Groundskeeper.get_last_ground_change(git.Repo(Path(__file__).parent.parent))

# Prepare for MAVLink parsing - always use the latest script (since it might cover new messages)
shutil.copy(f'{self.repository_path}/Tools/scripts/mavlink_parse.py', self.temp_folder)

# Get only valid tag names
tags = [
{
Expand Down Expand Up @@ -128,6 +131,8 @@ def run(self):
if last_ground_change > tag_date:
print(f"Version already generated for {tag_date}")
continue

# Run parameters parser
try:
subprocess.run([f'{self.repository_path}/Tools/autotest/param_metadata/param_parse.py', '--vehicle', vehicle_type], cwd=self.repository_path)
except Exception as exception:
Expand All @@ -146,7 +151,15 @@ def run(self):
shutil.copy2(data, dest)
os.remove(data)

# Run MAVLink messages parser
vehicle = f'{"Ardu" if vehicle_type != "Rover" else ""}{vehicle_type}'
try:
subprocess.run([f'{self.temp_folder}/mavlink_parse.py', '-cguq', '--header', 'ardupilot_wiki', '--format', 'rst',
'--filename', f'{dest}/MAVLinkMessages.rst', '--branch', folder_name, '--vehicle', vehicle],
cwd=f'{self.repository_path}/Tools/scripts/')
except Exception as exception:
print(exception)


G = Groundskeeper()
G.run()
G.run()

0 comments on commit 498c504

Please sign in to comment.