svpcom / wfb-ng

WFB-NG - the next generation of long-range packet radio link based on raw WiFi radio
https://docs.px4.io/main/en/tutorials/video_streaming_wifi_broadcast.html
GNU General Public License v3.0
1k stars 238 forks source link

2 way communication #20

Closed 09Ria09 closed 3 years ago

09Ria09 commented 6 years ago

Hi! Is 2 way communication possible? I want to send MSP messages from the air to the ground and vice versa. Is that possible? Also, what's the difference between Radio Port and UDP port?

svpcom commented 6 years ago

Yes, it is possible by default. But don't apply kernel patches for drivers/net/wireless/ralink/rt2x00/rt2800lib.c and drivers/net/wireless/ralink/rt2x00/rt2x00.h because they don't compatible with two-way communications. They only needed to increase bandwidth for one-way transmitting.

Radio port is a virtual port (implemented via custom MAC address) to separate several concurrent wifibroadcast streams using one radio channel. By default it is 1 for video stream and 2 for mavlink telemetry stream.

In case of bidirectional transfer you should use different radio ports for different directions. For example:

  1. video A->B
  2. telemetry A->B
  3. telemetry B->A
09Ria09 commented 6 years ago

Ok, thank you!

09Ria09 commented 6 years ago

@svpcom I use python and I don't know what to use to send data to the UDP port and to listen to the UDP port. I saw that you used twisted in wifibroadcast/telemetry/server.py , and I found this. Do you know if I can do the same thing using asyncio? From what I've found, asyncio has to connect before receiving/sending data using UDP. Would that work too?

svpcom commented 6 years ago

Why do you need to use python for udp? For video use gstreamer, for mavlink - mavlink-router. I don't have experience with asyncio, but you can use blocking I/O from socket module

09Ria09 commented 6 years ago

@svpcom My code is in python3 and I need to make the groundPC to communicate to the raspberry pi which is on the drone, while also streaming video from the drone to the groundPC. I need to write code to send data to one port and to listen to another port, but I don't know how to do that. I assumed I need to send UDP message, but I'm quite new to sockets in general. I don't need to use anything specific, I just need to make it work. Could you please give me a page to guide me or a short example? I have also found this example which uses the Socket library, look at the third example, the one with the packet sniffer. Is that what I need to use?

dposea commented 5 years ago

You need to use the first two examples. The first listens, the second sends. Send to the UDP port number.

RespawnDespair commented 5 years ago

@svpcom Could you take a look at this: https://github.com/RespawnDespair/wifibroadcast-image-builder/blob/master/stages/02-Kernel/PATCHES/linux-4.14-rt2800usb-misc.patch

And confirm that these patches are the ones that should NOT be applied when using two way communication? I'd like to test your solution in two way comms...

svpcom commented 5 years ago

This patch disables usb watchdog for rt2x00 driver:

/**
 * rt2x00usb_watchdog - Watchdog for USB communication
 * @rt2x00dev: Pointer to &struct rt2x00_dev
 *
 * Check the health of the USB communication and determine
 * if timeouts have occurred. If this is the case, this function
 * will reset all communication to restore functionality again.
 */
void rt2x00usb_watchdog(struct rt2x00_dev *rt2x00dev);

IMHO it is a bad idea to disable usb link watchdog if you don't have any sufficient reasons for that. I don't use this patch with my kernel.

RespawnDespair commented 5 years ago

So basically remove the patch regardless of trying to use 2 way comms? This is the patch you meant by:

Yes, it is possible by default. But don't apply kernel patches for drivers/net/wireless/ralink/rt2x00/rt2800lib.c and drivers/net/wireless/ralink/rt2x00/rt2x00.h because they don't compatible with two-way communications. They only needed to increase bandwidth for one-way transmitting.

Just double checking before i run into issues you already adressed.

Edit: these are all the patches being applied: https://github.com/RespawnDespair/wifibroadcast-image-builder/tree/master/stages/02-Kernel/PATCHES

svpcom commented 5 years ago

Yes. This patch is not needed for any WFB operation mode.

In comment which you referred I meant another patch: https://github.com/svpcom/wifibroadcast/blob/master/patches/nanopi-neo2-4.14.52-rt2x00-optimize-for-one-way-transmit.patch

RespawnDespair commented 5 years ago

Excellent, thank you for responding, i'll try to get this running!

dposea commented 5 years ago

I'm trying to get just one way transmission from an rpi transmitter to my laptop. Packets aresent, verified with tcpdump, but the receiver always prints something like Packet XXXXXX 0:0:0:0:0:0 , always 00's. I think I uncommented the fprintf for that data in rx.cpp. I tried to capture the data with wireshark on my laptop but never saw anything. I can't see any reason for receive to fail. Most of my stuff is in storage because my girlfriend and I moved into a condo on the beach, so I have one rt28xx wifi card and one 1900AC. They work very well with EZ-Wifibroadcast but your version seems to be a better solution for for low latency if I can get it to work. Any ideas?

svpcom commented 5 years ago

What is a tcpdump full output? Check TX/RX radio channel (maybe blacklisted in CRDA for your country). Are there any errors reported in tx or rx output? What is full list of command-line arguments for tx and rx? What driver do you use for "1900AC" card?

dposea commented 5 years ago

Tcodump dumps the packet info in asci and is very large.

I'm using channel 149, 5745 mghz no CRDA issues. Using the aircrack ng rtl8812au 5.3.4 driver. No error messages in either TX or rx . I just got a new laptop I'm setting it up from the beginning. I'll post all info soon.

It makes no sense that nothing is being received.

svpcom commented 5 years ago

@09Ria09 I've added two-way communication support for mavlink. This requires python + twisted. https://github.com/svpcom/wifibroadcast/wiki/Setup-HOWTO

09Ria09 commented 5 years ago

@svpcom That's cool! Sorry for being offline so long, I didn't have the time available. I'll try it right now!

09Ria09 commented 5 years ago

@svpcom I don't know if i should create a new issue or post in this one. I am not sure if I installed it the right way, I used EZ-Wifibroadcast's image, I extracted the contents of wifibroadcast-18.12.17.57289.linux-raspberry_pi.tar.gz and then I copied usr, lib and etc to /. But, when I run wfb-cli, it gives me this error:

Traceback (most recent call last):
  File "/usr/bin/wfb-cli", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2876, in <module>
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 449, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 745, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 639, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: wifibroadcast==18.12.17.57289

And I don't know how to fix it.

svpcom commented 5 years ago

@09Ria09 It seems that binary distribution for RPI has a bug. Quick workaround:

sudo apt-get install python-future python-pkg-resources python-twisted
sudo tar xzvf ./wifibroadcast-XXXXXXXXX.linux-raspberrypi.tar.gz -C /
sudo mv /usr/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages/
09Ria09 commented 5 years ago

@svpcom That worked! I'm sorry to bother you again, but I don't understand what's telemetry/server.py for if wfb_tx and wfb_rx already exist. From my understanding telemetry/server.py is ran when the user types systemctl start wifibroadcast@gs or systemctl start wifibroadcast@drone. What's the difference between telemetry/server.py and creating 3 pairs of wfb_tx and wfb_rx, 1 pair for video and 2 pairs for bidirectional telemetry?

svpcom commented 5 years ago

telemetry/server.py need for:

  1. Proxy mavlink messages between wfb_tx/rx and user. Because mavlink requires that incoming/outgoing messages have one destination/source port. Two separate processes wfb_tx/rx don't provide this.
  2. Inject mavlink packets with RSSI status
  3. Select TX card based on RX RSSI. (TX diversity)
  4. Provide stats to wfb-cli
  5. Aggregate mavlink packets to a batches to save radio bandwidth.
09Ria09 commented 5 years ago

@svpcom Ah, I understand now. Thank you for helping me!

09Ria09 commented 5 years ago

I will now try to use the tcpdump method from the wiki(I just saw the tcpdump part as I was writing this).

@svpcom Hi! I have finally managed to build and install 2 kernels with version 4.9.y, one for debian(on pc) and one for the raspberry pi(raspbian) using all these patches except linux-4.9.28-dwc-otg.patch and the 2 other patches for kernel 4.14.32. I tried to test wfb with these instructions. The raspberry pi doesn't have NetworkManager, and on Debian I added unmanaged-devices=interface-name:thecorrectwlan to /etc/NetworkManager/NetworkManager.conf. Firstly I run lines 17-20 from here to setup the wifi adapter(I replaced $WLAN with the true wlan address) on both PC and raspberry pi. When I run sudo wfb_tx thecorrectwlan -K drone.key on the raspberry pi and sudo wfb_rx thecorrectwlan -K gs.key on the PC, and then I run nc -lup 5600(if I run as it is in the wiki: nc -u 5600 I get an error like no port[s] to connect to) on the PC and run echo test | nc -u localhost 5600 on the Raspberry Pi I get nothing.

I think I have the same problem as @dposea. There are no errors on either side. On the rx side I get XXXXXX Packet 0:0:0:0:0:0 or something like that, and on the tx side I only get one line: Listen on 5600 for thecorrectwlan. My wifi adapters are both Alfa AWUS036NEH using RT3070.

svpcom commented 5 years ago

@09Ria09 use 127.0.0.1 instead of localhost. It seems that it resolved to ipv6 address ::1 Check your /etc/hosts

svpcom commented 5 years ago

The preferred install scheme is to build deb package. Use make deb. Also you don't need to fix wfb-server.sh - it accept interface name as command-line argument. See https://github.com/svpcom/wifibroadcast/wiki/Setup-HOWTO

09Ria09 commented 5 years ago

@svpcom I didn't edit the wfb-sever.sh, I only copied lines 17-20 and ran them instead of the whole wfb-sever.sh so it doesn't launch telemetry/server.py. I ran echo test | nc -u 127.0.0.1 5600 but nothing changes. I don't know what I should do with tcpdump, it only outputs a lot of data. Also I noticed that you edited that page, if I run only nc -lu 5600, it says UDP listen needs -p arg.

09Ria09 commented 5 years ago

@svpcom I ran ps uaxw | grep tx and I got this output:

root      1303  0.6  0.3   7228  3376 pts/1    S+   15:01   0:00 sudo wfb_tx -K drone.key wlan0
root      1307  0.6  0.1   6932  1204 pts/1    S+   15:01   0:00 wfb_tx -K drone.key wlan0
pi        1309  0.0  0.0   4372   532 pts/0    S+   15:01   0:00 grep --color=auto tx

And using strace -ff -p 1307, I can confirm that the wfb_tx program receives data when I run echo test | nc -u 127.0.0.1 5600.

I don't know it it helps, but here is a part of my tcpdump on tx:

15:23:13.189298 2422 MHz 11n -21dBm signal antenna 1 52.0 Mb/s MCS 5 20 MHz long GI Data IV:2455 Pad 20 KeyID 0
15:23:13.189447 2422 MHz 11n -21dBm signal antenna 1 52.0 Mb/s MCS 5 20 MHz long GI Data IV:2456 Pad 20 KeyID 0
15:23:13.189614 2422 MHz 11n -21dBm signal antenna 1 52.0 Mb/s MCS 5 20 MHz long GI Data IV:2457 Pad 20 KeyID 0
15:23:13.189750 2422 MHz 11n -21dBm signal antenna 1 52.0 Mb/s MCS 5 20 MHz long GI Data IV:2458 Pad 20 KeyID 0
15:23:13.189876 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.190009 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.190179 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2459 Pad 20 KeyID 0
15:23:13.190328 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:245a Pad 20 KeyID 0
15:23:13.190476 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:245b Pad 20 KeyID 0
15:23:13.190975 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.191532 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.191871 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:245c Pad 20 KeyID 0
15:23:13.192442 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.192928 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.193556 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.194108 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.194416 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:245d Pad 20 KeyID 0
15:23:13.194566 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:245e Pad 20 KeyID 0
15:23:13.194714 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:245f Pad 20 KeyID 0
15:23:13.194848 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.195117 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.195378 2422 MHz 11n -19dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2460 Pad 20 KeyID 0
15:23:13.195527 2422 MHz 11n -19dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2461 Pad 20 KeyID 0
15:23:13.195675 2422 MHz 11n -19dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2462 Pad 20 KeyID 0
15:23:13.195807 2422 MHz 11n -19dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2463 Pad 20 KeyID 0
15:23:13.195954 2422 MHz 11n -19dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2464 Pad 20 KeyID 0
15:23:13.196102 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.196266 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.196586 2422 MHz 11n -19dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2465 Pad 20 KeyID 0
15:23:13.196908 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.197656 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.197962 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.198288 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2466 Pad 20 KeyID 0
15:23:13.198438 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2467 Pad 20 KeyID 0
15:23:13.198587 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2468 Pad 20 KeyID 0
15:23:13.199015 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.199404 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.199699 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2469 Pad 20 KeyID 0
15:23:13.199853 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:246a Pad 20 KeyID 0
15:23:13.200002 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:246b Pad 20 KeyID 0
15:23:13.200150 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:246c Pad 20 KeyID 0
15:23:13.200298 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.200621 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.200862 24.0 Mb/s 2422 MHz 11g -21dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.201148 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:246d Pad 20 KeyID 0
15:23:13.201300 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:246e Pad 20 KeyID 0
15:23:13.201451 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:246f Pad 20 KeyID 0
15:23:13.201602 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2470 Pad 20 KeyID 0
15:23:13.201733 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2471 Pad 20 KeyID 0
15:23:13.201851 24.0 Mb/s 2422 MHz 11g -19dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
15:23:13.201993 24.0 Mb/s 2422 MHz 11g -47dBm signal antenna 1 BA RA:30:d1:7e:db:d9:10
09Ria09 commented 5 years ago

@svpcom I fixed the problem! I've done 2 things to fix it. I don't know if the first thing helped to fix the problem, but here it is: I added dwc_otg.fiq_fsm_enable=0 dwc_otg.fiq_enable=0 dwc_otg.nak_holdoff=0 dwc_otg.int_ep_interval_min=0 to cmdline.txt(I am not sure, but after this, packets like 15:23:13.201602 2422 MHz 11n -21dBm signal antenna 1 57.8 Mb/s MCS 5 20 MHz short GI Data IV:2470 Pad 20 KeyID 0 disappeared). But the real issue was that, for some reason, the cards weren't on the same frequency, even thought they should've used the default radioport 1. I tried to fix this by running sudo iwconfig wlan0 channel 1 on the raspberry pi(the PC was on channel 1), but, checking with iwconfig wlan0, it didn't change the channel. Then I tried changing the channel to 6(a small random number) and then to 1, and it worked.

09Ria09 commented 5 years ago

@svpcom Hi! So, now everything works, video and bidirectional data. I have a Flight Controller which uses iNAV. iNAV can't be controlled by Mavlink, it can only be controlled by Multiwii Serial Protocol(eg. RC control). MultiWii Serial Protocol commands are similar to Mavlink commands in terms of size. So I already wrote the code to handle MultiWii Serial Protocol for the server(PC) and for the client(Raspberry Pi on the drone). How can I be sure that the MultiWii Serial Protocol commands are not corrupted during transmission? How does wifibroadcast take care of Mavlink commands?

svpcom commented 5 years ago

WFB can loose packets but it will reject corrupted packets. Mavlink is resistant to packet loss. So if you pack MultiWii Serial Protocol commands to udp packets and your autopilot will not crash if some of them was lost it will work.

09Ria09 commented 5 years ago

@svpcom Hi! So, I implemented a reliable UDP so it can work with one tx port and one rx port, but I think it's slower and less safe to use than TCP. Can I use the proxy intended for mavlink for a tcp connection? What else do I need to change for it to work, except setting inject_rssi = False?

svpcom commented 5 years ago

Mavlink proxy expects to get mavlink packet. You need to write own proxy to translate arbitrary tcp data into udp.

edsellar commented 5 years ago

@svpcom is bidirectional telemetry possible with the patched awus036ach driver? That seems to be the best available high powered device.

(Wondering if these are working in true mimo which is probably not needed or can limit these to specific frequency rather than 2.4/5 at the same time so with some high gain antennas we can get some decent range. Separate question for a separate test - I digress).

Bidirectional Mavlink over would great over the 036ach.

svpcom commented 5 years ago

Yes, 036ach is my primary hw setup now. https://github.com/svpcom/wifibroadcast/wiki/WiFi-hardware

edsellar commented 5 years ago

@svpcom Awesome, that’s the page that led me here but there is a patched kernel how to for the Realtek driver so I was wondering if just to patch the driver for the 36ach as on the linked latched driver page or if there are special instructions separate. Amazing by the way the 36ach can finally be used. I’m going to measure total power output on my rf meter when this is all set up. Hence the mimo query.

svpcom commented 5 years ago

If you want to setup long distance link you can use multipe wifi adapters with directional and omnidirectional antennas. TX/RX diversity for multiple adapters supported out of box (just add multiple NICs to /etc/default/wifibroadcast). For WiFi adapters with two antennas (like Alfa AWU036ACH) TX diversity is implemented via STBC. Cards with 4 ports (like Alfa AWUS1900) are currently not supported for TX diversity (only RX is supported).

edsellar commented 5 years ago

Amazing! I'm thinking of trying one RHCP and one LHCP on each unit so each antenna port has a different polarization. Then maybe something long range on one port and omni on the other before just trying actual multiple receivers. So cool. Now to tackle this and then the OSD. Pretty cool stuff.

09Ria09 commented 5 years ago

Hi! I see that you added IP-over-WFB. How do I use it? I searched through the wiki but I didn't find it in there. Can it be used directly with wfb_rx and wfb_rx or do I need to use the service?

svpcom commented 5 years ago

You need to use service (tunnel use tun/tap kernel driver). It works out of box.

09Ria09 commented 5 years ago

@svpcom How do I connect to the tunnel(from my code)? I see that in master.cfg there is

ifname = 'gs-wfb'
ifaddr = '10.5.0.1/24'

and

ifname = 'drone-wfb'
ifaddr = '10.5.0.2/24'

Why 10.5.0.1 and not 127.0.0.1? Should I connect to 10.5.0.1/24 using TCP? I'm sorry if it's a stupid question.

svpcom commented 5 years ago

You will have network interface gs-wfb with addr 10.5.0.1/24 on GS side and drone-wfb with addr 10.5.0.2/24 on Drone side. So if you need to ssh to drone, you will need to do: ssh 10.5.0.2 from GS

dposea commented 5 years ago

I'm sorry I never got back to you with my problem, but I'll bet it could have been channel related. I'll try to test again as soon as I get a reverse engineering problem solved for my day job. I'm glad you found that issue as I could see nothing wrong in your code. It should have just worked..

svpcom commented 5 years ago

@dposea What is your problem with WFB? Please describe HW and SW setup.

09Ria09 commented 5 years ago

@svpcom Thank you, now everything works: the mavlink connection can actually be used with custom messages(not Mavlink) if I set inject_rssi = False, video works, and the IP-over-WFB tunnel works.

I think you should add wifi_channel to the Setup HOWTO, because the default is a channel for 5Ghz, but some cards are only 2.4Ghz (in my case), and for wifi_region setting the CRDA country to BO doesn't work any more to unlock maximum power, instead setting it to GY works.

svpcom commented 5 years ago

@09Ria09 What card and what drivers do you use? I use Alfa Network AWUS036ACH with https://github.com/aircrack-ng/rtl8812au/ (v5.2.20, because v5.3.4 doesn't have injection support). It transmit on full power by default (crda and tx power limit is disabled in driver code) and txpower setup doesn't work. Also I found that it transmit on full power (27dBm) only in 2.4G band. In 5.8G band max measured power is 14dBm

09Ria09 commented 5 years ago

@svpcom I use two ALFA AWUS036NEH with default drivers on debian and raspbian. They only transmit full power if I set the CRDA country to GY(30dBm compared to 20dBm).

09Ria09 commented 5 years ago

@svpcom Is there a way to disable packet aggregation? I tried to set mavlink_agg_timeout to both 0 and None but it still aggregated packets.

svpcom commented 5 years ago

@09Ria09 Replace agg_max_size=settings.common.radio_mtu to agg_max_size=None in telemetry/server.py. But small wifi packets will drastically reduce your bandwidth.

09Ria09 commented 5 years ago

@svpcom Thank you! I only send 7 packets per second(I might change it to 12 packets per second), so I don't think it will affect the bandwidth too much(correct me if I'm wrong, please). Could you add this as an option in the configuration file (so it will be easier to update Wifibroadcast)?

svpcom commented 5 years ago

@09Ria09 Ok, I'll add option to the next release. What kind of data do you send instead of mavlink?

09Ria09 commented 5 years ago

@svpcom Using the connection for mavlink, I send RC data (it looks like this {M: SET_RAW_RC, p: pitch, r: roll, y: yaw, t: thrust}, SET_RAW_RC, pitch, roll, yawand thrust are all numbers) that will be used in MSP msp_set_raw_rc messages, those control the drone, so I only need the last message and I don't mind a few packets lost.

Using the IP-over-Wifibroadcast tunnel and TCP I send important commands like setting waypoints, commands that shouldn't be lost and should arrive in order.

MSP is used to control INAV, Cleanflight, Betaflight(I think) and maybe others. Here's a longer list of MSP commands.