Comments (12)
I want to parse MAVLink packets in Dart to use in a Flutter-based GCS. My options included using Dart's Foreign Function Interface to call the generated MAVLink C functions, but that method was too problematic. My second option was using MAVSDK and generating Dart code for it using this library.
I got these errors when I attempted the README example while trying to generate Dart code. I tested it using Python and Swift as the target langs and I still get the same errors.
from mavsdk-proto.
Regarding interfacing with Dart, I have a few thoughts/questions:
- One way would be to run
mavsdk_server
as a flutter plugin, and connect from dart using gRPC, right? - Another way would be to not use
mavsdk_server
, but call MAVSDK-C++ directly from Dart with FFI. Is that correct? - And yet another way would be to generate a Dart interface that uses the Flutter messaging system to talk to a plugin that would then call MAVSDK-C++ directly (again, bypassing mavsdk_server).
Am I completely off, or does that make sense? Which one do you think is best? Bypassing mavsdk_server
means that you don't have to depend on gRPC, and that would make it simpler.
Also feel free to share if you have a test MAVSDK-Flutter repo, I'd be interested in having a look 😊
from mavsdk-proto.
file_ext
is a parameter to pass to protoc-gen-mavsdk
, see e.g. here (which will output files like Camera.py
:
python3 -m grpc_tools.protoc -I${PROTO_DIR}/protos \
--plugin=protoc-gen-custom=$(which protoc-gen-mavsdk) \
--custom_out=${GENERATED_DIR} \
--custom_opt="file_ext=py,template_path=${TEMPLATE_PATH}" \
${plugin}/${plugin}.proto
and here (which will output e.g. Camera.swift
:
protoc ${plugin}.proto --plugin=protoc-gen-custom=$(which protoc-gen-mavsdk) -I${PROTO_DIR} -I${PROTO_DIR}/${plugin} --custom_out=${OUTPUT_DIR} --custom_opt=file_ext=swift
In your case you probably want something like --custom_opt=file_ext=dart
, I guess 👍.
from mavsdk-proto.
Sure, it's your call.
I guess my point is that if you go with the mavlink library, you will have to implement everything yourself (command microservice, params microservice, missions, cameras, etc), which in my opinion is more work than changing MAVSDK to support Ardupilot where it's needed.
from mavsdk-proto.
Running
protoc --plugin=protoc-gen-custom=$(which protoc-gen-mavsdk) \
-I../protos \
--custom_out=. \
--custom_opt=swift \
../protos/action/action.proto
gives the following error:
Traceback (most recent call last):
File "~/.local/bin/protoc-gen-mavsdk", line 11, in <module>
load_entry_point('protoc-gen-mavsdk', 'console_scripts', 'protoc-gen-mavsdk')()
File "~/test/MAVSDK-Proto/pb_plugins/protoc_gen_mavsdk/__main__.py", line 17, in main
AutoGen.generate_reactive(request).SerializeToString())
File "~/test/MAVSDK-Proto/pb_plugins/protoc_gen_mavsdk/autogen.py", line 22, in generate_reactive
params = AutoGen.parse_parameter(request.parameter)
File "~/test/MAVSDK-Proto/pb_plugins/protoc_gen_mavsdk/autogen.py", line 96, in parse_parameter
raise Exception("'file_ext' option was not specified! See " +
Exception: 'file_ext' option was not specified! See --[name]_out=file_ext=<value>,<other_options>:/path/to/output or --[name]_opt=file_ext=<value>,<other_options> in the protoccommand line.
--custom_out: protoc-gen-custom: Plugin failed with status code 1.
Using the following code removed the mentioned error:
protoc --plugin=protoc-gen-custom=$(which protoc-gen-mavsdk) \
-I../protos \
--custom_out=file_ext=.swift \
--custom_opt=swift \
../protos/action/action.proto
from mavsdk-proto.
I wonder if this README is out of date.
Taking a step back, what are you trying to do?
from mavsdk-proto.
Disclaimer: I'm very new to Dart and protobufs/gRPC so take what I say with a grain of salt.
As far as I know calling MAVSDK-C++ directly from Dart using FFI should be possible using it's entry-point function and then running it in a Dart Isolate. I don't currently have enough experience to comment on the other 2 methods, but this was the route I was planning to take. I agree that bypassing mavsdk_server would make things easier, but I'm yet to do that. I'm still in the design stage so I don't have any working tests yet, but I'll share them when I do :)
As much as I would like to use MAVSDK, after some research I realized I won't be able to; Because I'm using ArduPilot some microservices may not be stable yet according to mavlink/MAVSDK#728 (comment) , so I'm back to the drawing board regarding Dart-MAVLink integration. Thanks for the help and suggestions!
from mavsdk-proto.
As much as I would like to use MAVSDK, after some research I realized I won't be able to; Because I'm using ArduPilot some microservices may not be stable yet
Some people have been using MAVSDK with Ardupilot with some success, but you're right in that it's not officially supported. This said, nothing prevents you from forking MAVSDK-C++ and making it work with Ardupilot, either by not caring about PX4, or by trying to keep both (e.g. detect if it is PX4 or Ardupilot, then do if (Ardupilot) ... else ...
when necessary. And once you prove that adding support for Ardupilot is not a big deal in MAVSDK (which I believe), we could even open the discussion about merging that upstream.
But overall, the thing is that if you keep the MAVSDK interface (i.e. don't modify the proto files), your generated Dart code will still work with MAVSDK upstream, and therefore I would try to help you in that effort because it could be used upstream 👍.
Your alternative without MAVSDK is to re-implement your own MAVLink library or support DroneKit, and I am not completely convinced that this will be easier...
from mavsdk-proto.
I appreciate your offer, but due to competition deadlines my team and I won't be able to commit time to developing a fork :/
For now we're gonna have to stick with using Dart FFI with mavlink/c_library_v2 , but we will revisit contributing to and using MAVSDK in the future.
from mavsdk-proto.
Any progress on dart version of mavsdk?
from mavsdk-proto.
Not that I'm aware of.
from mavsdk-proto.
Any progress on dart version of mavsdk?
@LiangHuangBC The dart_mavlink library by nus has been published in the past year. I used it in some tests and it seems promising.
https://github.com/nus/dart_mavlink
from mavsdk-proto.
Related Issues (20)
- Create proto file for followme plugin HOT 1
- Create proto file for logging plugin HOT 20
- Is it a drone, a system, a vehicle, a robot? HOT 4
- tag a first version? HOT 2
- More explanation in the pb_plugins README HOT 3
- Add camera proto
- > I am still having troubles about the C++ files generation. Also how do I proceed from there ? HOT 1
- Differentiating between Fixedwing, Multicopter and VTOL (and others?) HOT 13
- The fpt.proto hasn't a primitive to upload files HOT 2
- Camera: need a way to manage media HOT 11
- Add callbacks that provide a result (for server commands) HOT 4
- semantic version identifiers should use unsigned integers HOT 3
- Design camera server implement discussion HOT 2
- Consistently capitalize names in jinja2
- Provide type conversions between languages HOT 3
- Create proto file for gimbal plugin
- Create proto file for offboard plugin HOT 1
- Autogenerate documentation HOT 2
- In which module to place the subscription. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mavsdk-proto.