oysstu / pyimc Goto Github PK
View Code? Open in Web Editor NEWPython bindings for Inter-Module Communication Protocol (IMC)
License: Other
Python bindings for Inter-Module Communication Protocol (IMC)
License: Other
There's currently an issue with the multicast socket on Windows, causing issues with discoverability (announces). One workaround for Windows users is to enable the Windows subsystem for Linux, and use the python interpreter there.
Hi Oysstu,
first of all thanks for developing this awesome project!
I'm trying to develop an avoidance system for UAV and I'll like to use pyimc for sending instructions to the vehicle. I installed pyimc using the current IMC, Dune and Neptus versions available in their repositories with python 3.7. I'm using a DUNE simulation of the 'lauv-xplore-1' vehicle to test keyboard_input_example.py
but I'm not able to use it correctly. It works to stop the vehicle but the start method doesn't work:
INFO:pyimc.actors.base:Starting file log (/tmp/pyimc/ccu-pyimc-jm/20211203/083813)
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:pyimc.actors.base:Connected nodes: []
DEBUG:pyimc.actors.base:Connected nodes: [(30, 'lauv-xplore-1')]
DEBUG:pyimc.actors.base:Connected nodes: [(30, 'lauv-xplore-1')]
start
INFO:examples.KeyboardActor:Vehicle not connected
In addition, I tried to get more info about the estimated state using @Subscribe(pyimc.EstimatedState)
but I doesn't get any response, which could be an answer to why the start
method in keyboard_input_example.py
says that the vehicle is not connected.
Any help will be appreciated!
Best regards
Juan
Hi,
I really like the functionality of this module!
When I develop with DUNE, I usually have a build folder (with a generated package containing all libraries/include files, using make package
). In stead of re-building dune when generating the python bindings, should it not be possible to simply use this folder? IMC can be put in this folder as well, using make imc_download
.
I wanted to take a crack at this myselves, but I am not to familiar with the Extensions framework.
Best regards,
Kristian
No documentation currently exists for the library, only a few examples. Create generated documentation online using e.g. readthedocs.io.
Users are assumed to familiarize themselves with the IMC specification and how to use that in relation to systems running DUNE. This documentation would strictly be related to the implemented actors, node map, decorators, lsf parsing, and exposed DUNE functionality
The current actor structure allows for a base class to expose functions that can be overridden in child classes; e.g. on_node_disconnect can be called by IMCBase and implemented in user code. When implementing nested actors (e.g. to handle different aspects of DUNE/IMC interactivity) through inheritance, this is limiting as multiple actors cannot override the same function. This leads to either duplicated calls or function implementation.
Another way to get around this issue is to add a decorator which subscribes to events, for example through an enumeration
from enum import Enum, auto
class IMCEvent(Enum):
NODE_CONNECT = auto()
NODE_TIMEOUT = auto()
PLAN_START = auto()
PLAN_STOP = auto()
class TestActor(IMCBase):
@OnEvent(IMCEvent.NODE_CONNECT)
def node_connected(self, node):
...
If the number of events are limited, this can also be handled through individual decorators
class TestActor(IMCBase):
@OnConnect()
def node_connected(self, node):
...
When implementing subscriptions to IMC messages, one often has to filter the incoming messages based on some criteria. E.g. if the message are coming from a specific system, or is being sent to a target system, or that the actor is in a certain state
One proposed quality of life improvement wrt. this is the addition of a filtering input to the subscription decorator itself. Usage would look as follows
class TestActor(IMCBase):
@Subscribe(pyimc.EstimatedState)
def without_filter(self, msg):
if msg.src == 0x5501:
# Do stuff
...
def filter(self, msg):
return msg.src == 0x5501
@Subscribe(pyimc.EstimatedState, filter=TestActor.filter)
def with_filter(self, msg):
# Do stuff immediately
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.