0

I'm trying to conect my PX4Flow sensor to a raspberry pi. It seems that nearly everybody is using qgroundcontrol to access and control it. But as I'd like to integrate it into some bigger program, I'd like to control it with some self-written simple python code, if possible. My aim is to:

  • access the camera (to measure the speed - later)
  • get gyrometer values

I don't need the ultra sonic sensor.

I found out that I can use MAVlink for the communication between the px4flow sensor and the raspberry pi. I cloned the git repository and followed the steps on https://github.com/mavlink/mavlink until the generation of header file (python -m mavgenerate). With that, I can generate a new python file. I don't know if this is correct, and I don't know what to do with that python file. No more file (header files) are copied or generated. How do I go on? How do I use the library? How do I even test the connection?

Cœur
  • 32,421
  • 21
  • 173
  • 232
  • Welcome to Stack Overflow! I've improved the formatting of your question, using list items and code formatter - please see [the editing help](https://stackoverflow.com/editing-help) for more information on formatting. I've also removed the superfluous signature. Good luck! – Cœur Aug 24 '17 at 16:12

1 Answers1

0

If I understand you correctly, you want to make a module to communicate with PX4Flow.

I have some experience in building a ground control station with ardupilot. I think the procedure is roughly the same:

  1. Generate the proper mavlink library, what you have done by using mavgenerate. Read some guidance of mavlink communication procedure.
  2. Read the source code in PX4Flow communication module https://github.com/PX4/Flow/blob/master/src/modules/flow/communication.c, which shows what kind of messages have been sent to client side (e.g. your communication module)
  3. Start write the module code to communicate with PX4Flow. You may need to start with HEARTBEAT msg first to establish connections between your module and PX4Flow. Note that you can always receive HEARTBEAT messages from PX4Flow. You can start with decoding these ones.
  4. Implement your other functionalities.

You can read sources code of QGourndControl during step 3 and step 4. Make sure to find the right module in its repo.

My communication module is built using JavaScript https://github.com/kvenux/nodegcs, if it helps.

Keven Sun
  • 31
  • 2