Skip to content

server plugins should not be limited to a single system #1700

@dlech

Description

@dlech

As I have been working on the camera server plugin, I've noticed a problem with the way the current plugin architecture creates a plugin instance per system (i.e. CameraServerImpl::CameraServerImpl(System& system) : PluginImplBase(system)). The problem is that the plugin state is per system when really it needs to be global. This means that consumers of MAVSDK have to do lots of extra work to ensure that each plugin instance for a single camera remains in a consistent state with the others. Example: 1528f0c.

I suppose other server plugins haven't noticed this problem before since they probably only communicate with one system. However, cameras need to communicate with both an autopilot and a ground station at the same time.

I think a solution to this would be to create a new "server" plugin type that is initialized with CameraServerImpl::CameraServerImpl(Mavsdk& mavsdk) : ServerPluginImplBase(mavsdk) instead. Then a single plugin instance could receive and send messages to any number of systems. (And broadcast to multiple systems as required by CAMERA_IMAGE_CAPTURED.)

Otherwise, we should reconsider mavlink/MAVSDK-Proto#274 (comment), particularly the Set* methods. Basically, the camera server plugin should have no state and everything is handled by callbacks to user code. I'm not sure this is really possible though since the callbacks themselves are considered part of the state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions