APM + Gstreamer/ APM + 3Gdongle experience

Hello guys.

I was able to successfully use gstreamer+PIcam and also a E303 Huawei 3g dongle,

But the first time I tried to run APN AND gstreamer (at the same time) the troubles started…

The following happened:

  1. APM up&running connected to GCS
  2. Gstreamer started via ssh
  3. Gstream did not start as expected
  4. After a while, kernel started to print out Oops problems
  5. Then I lost contact with RPi.
  6. So I rebooted unplugging/plugging back the power plug…but…
  7. RPi does not boot anymore.

My suspect is a kind of corrpution on SD card but I still have to figure out what is the problem…

My question is… what are you able to run on RPi along with ArduCopter? Had you guys been able to use APM AND gstreamer or APM AND 3gdongle?

I have the impression that there is no more CPU power to run something else than APM on RPi…

Hi Fabio,
We have successfully run APM and gstreamer together over WiFi with settings close to: 720, 20fps, 1M bitrate (bitrate is actually the most important one).

Anyway, even if you run something very heavy and CPU resources are not enough it should not lead to crashing of the Linux. Maybe the problem is in Huawei’s driver or maybe you need a better power source.

Could you please repeat the same over WiFi?

Also, my recommendation is to run gstreamer over udp, it really reduces the latency.

On the test I ran where I got a crash I was using just APM + Gstreamer 1080 25fps on WiFi.

As soon as I will recover RPi I’ll do some more testing.

I mentioned 3g dongle just because I’d like to check with you what can be run along with APM.

Is there still a (really bad) chance that my RPi simply got broken during that trial and it is not a SD card problem…

Well, 1080p with 25fps is probably too much for a Raspberry Pi 1 (but should be okay on Rpi2 - and we are close to its support). But the Linux shouldn’t have crashed anyway, we tried it too and the video stuttered while the APM kept working.

Ok… it was the bad sdcard…

Now I am testing with 720p 20fps udp 1M + ArduCopter on WiFi. Quality is nice but latency is huuuge… I mean… some seconds!

raspivid -n -w 1280 -h 720 -b 1000000 -fps 20 -vf -hf -t 0 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host= port=9000

gst-launch-1.0 -v udpsrc port=9000 caps=‘application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264’ ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

What WiFi dongle are you using? Some don’t work very well on Raspberry Pi.
Also, it is possible that your router doesn’t prioritize video streaming packets, or the network is overloaded, for example if you’re downloading lots of torrents on a PC in the same network.
You can also try to lower fps\bitrate values and see if it helps. But I’m absolutely sure that we’ve run 720p-20fps-1M okay.

The network is not the problem as, If I run just gstreamer, the latency is very good @720p 1Mbit.

The latency hugely increase only when I start also Arducopter. When Arducopter is terminated, the latency gets optimal again.

Maybe I am not using the right gstreamer command line above? Can you post the command you used?

Can you confirm that your tests were made running both Arducopter and gstreamer?

I have further investigated but not really figured out why I have such a high latency. I am running both APM and Gstreamer to use WiFi but the global bitrate is not much more than 1Mbit/s.

Monitoring the processes with top, I’ve noticed that, along with ArduCopter.elf process (30%cpu) there is another time consuming process that is pigpio (20%cpu time). Is it normal that pigpio uses 20% of CPU time?

Tonight I will drop wifi and try with only ethernet as link to GSC. Let’s see.

Fabio, could you please try lowering the bitrate? Try 800K, 700K, etc.
Pigpio is heavy, yes, one of our team members is currently rewriting the RCInput code so that it can work without pigpio and use less CPU, he’s expected to finish in a couple of weeks.