ArduPilot / ArduPilot/pymavlink

running pymavlink inside mpi4py or multiprocess

Open
#640 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
730
Forks
741
Avg merge
4d 10h
Merged PRs (30d)
7

Description

I have made some experiments to multi-task some mavlink messaging using 2 libraries

one of the uses mpi4py and ive tried this on raspberry pi and ubuntu

it seems ive installed mpi4py right as it can successfully send info from one rank to the other,
but if for example when i put a heartbeat send in EITHER Rank i can not see it in mavlink inspector.

If i run this without mpi and just python3 i see the message (same code - obviously call the function has to be in rank == 0)
![hb2](https://user-images.githubusercontent.com/74973243/155729420-b3aa2570-75ee-430e-b689-b7b7f34b9219.JPG)

printing data suggests all data is shared and available and the command returns True not error.

I tried to also run the command through a daemon process or a pool using python multithreading library but i get the same result like the output is blocked but i can see it being executed and printing a result of True, so it doesnt seem to be the multithread commands. again I can test that the multiprocessing write to each class individually and globally through multiprocess variables works fine.

to eliminate mavlink-router i tried a connection using a tcp port direct rather than the udp endpoint
This made no difference to my tests, if it was inside the rank it was not seen in mavlink inspector

The watchdog always drops out...... if i use mpi
![hb1](https://user-images.githubusercontent.com/74973243/155729271-432603bb-2749-4796-8e58-11a1e848014c.JPG)

the command I am using to run the program in 2 ranks is using mpirun on raspberry Pi and is for example

mpirun.openmpi -np 2 python3

any ideas on this problem very welcome

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the behavior with the stated mpirun.openmpi -np 2 python3 command, then compare it with the standalone Python run. Inspect the heartbeat visibility and watchdog output for both MPI and multiprocessing cases; done means heartbeat messages are visible in MAVLink Inspector and the watchdog remains active.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python, raspberry-pi
Domain
distributed-systems, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.