-
-
Notifications
You must be signed in to change notification settings - Fork 587
Description
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.