Drone version not obtained M300 OSDK - nvidia

I am trying to use an Nvidia Jetson Nano as an onboard computer to communicate with the Matrice 300 RTK using the OSDK. The computer and drone are connected using the OSDK Expansion module, and I am using the dual USB cable (USB 3 Type A) to connect to a USB port on the computer.
I am getting the error
ERRORLOG/1 # getDroneVersion, L1707: Drone version not obtained! Please do not proceed.
Possible reasons:
Serial port connection:
* SDK is not enabled, please check DJI Assistant2 -> SDK -> [v] Enable API Control.
* Baudrate is not correct, please double-check from DJI Assistant2 -> SDK -> baudrate.
* TX and RX pins are invert
[4290298.543]STATUS/1 # functionalSetUp, L282: Shake hand with drone Fail ! Cannot get drone version. (1/20)
I have tried using all of the baud rates available in DJI Assistant 2 (changing them in both the app and the UserConfig.txt) and enabled API Control, and had no luck.
These are the current contents of my UserConfig.txt (without my actual app id and app key)
app_id : [id]
app_key : [key]
device : /dev/ttyACM0
baudrate : 921600
acm_port : /dev/ttyACM0
Thank you.

there is no way device port and acm port are same ACM0
When you connect the DJI drone, there should be two-port. Usually one ttyUSB0 and ttyACM0. USB is for normal control and feedback and ACM is only for video tranmission. and usually ACM are optional and will not cause the error that you show.
if you have other USB devices. there could be ttyUSB1 or ttyACM1 or XX2 or XX3. you may find list of this by type
ls /dev
So to minimize the error caused by this. You need to understand what are your device name by calling either lsusb or
ls /dev/serial/by-id/
in my case there is an additional figerprint device that could confuse the system as shown below
Once you find the exact id, you may use the following way to set exact port
app_id : [id]
app_key : [key]
device : /dev/serial/by-id/usb-FTDI_USB-RS232_Cable_FT5T6MGL-if00-port0
baudrate : 921600
acm_port : /dev/serial/by-id/XXXXXXXXXXX

The solution to my problem ended up being that I needed a serial connection to the OSDK Expansion module in addition to the USB connection. Dr. Yuan Shenghai was right, however, that my port setup was incorrect. What I ended up doing was connected three wires from the GND, TX, and RX pins on my Nvidia Jetson to the module as shown in this picture.
This was able to run the dji flight sample with the following UserConfig.txt
app_id : my app id
app_key : my app key
device : /dev/ttyTHS1
baudrate : 230400
acm_port : /dev/ttyACM0

Related

Wifi diagnostic tool

I am working on a room which contains 6 wifi IP cameras. There are also the same wifi IP cameras in other close rooms. This cameras have their own wifi access point. I can't manage anything on this wifi network.
I have a raspberry Model 3 in this room. I tried to set up a wifi access point on this raspberry.
I can't connect to this access point, but if in unplug everything and go to try far away from this rooms, everything works great.
So i am wondering if the raspberry is not disturbed by this big wifi traffic.
What should i do ?
Here is an extract of my /etc/hostapd/hostapd.conf
Do you see something i can change in order to make it work ?
interface=wlan0
driver=nl80211
ssid=XXXX
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=XXXXXXX
rsn_pairwise=CCMP
Thanks
Try changing the channel=6 to channel=1 in your config file. This should help if the wifi cameras are using channel 6 as well.
https://www.lifewire.com/best-wifi-channels-for-your-network-818278
If you have an Android phone handy you could try installing a WiFi Analyzer app, e.g. this one or else you may be able to use iw on the Raspberry PI to do a local scan:
iw dev wlan0 scan
Either/both of the above should show you which channels are being used within range. Then, as Gilbert says you could change the config to use a less congested channel.
I use a modification of the above command to give me a count of access points against each channel:
iw dev wlan0 scan | grep 'primary channel' | sort | uniq -c

Change CDC ACM serial driver information

I'm using a USB CDC serial converter. When I connect it to my computer it displays "USB-CDC Serial<>USB". Now I want to change this information to the name of my product. Does anybody know how to do it in Linux and Windows?
I want to change these information in dmesg:
[100480.031359] usb 2-1.8: Product: USB-CDC Serial<>USB
[100480.031362] usb 2-1.8: Manufacturer: Silicon Labs
[100480.031364] usb 2-1.8: SerialNumber: 1234
Any tip will be very helpful,
Thanks!
There is a field in the USB device descriptor called iProduct at offset 15. This is called the product string descriptor.
You will need to change the firmware of the USB device and have it send the name of your product in this location.
Check out this website for more details on USB descriptors
http://www.beyondlogic.org/usbnutshell/usb5.shtml#DeviceDescriptors

ESP8266 Arduino Hostname (MDNS)

I am having problems with the hostname of my ESP8266. I am using the MDNSResponder and I can successfully access my device with mydevice.local
However, my WiFi router (Netgear WGR614) list the device as ESP_FEA38A. When I use 'Angry IP Scanner' on my mac, there is no hostname listed. Both, the ip scanner and the WiFi router both recognize several raspberrys and other devices like airport express.
Does anybody know what other host naming mechanisms are being used and how I can get my ESP8266 device getting listed with hostname?
If you are using the Arduino environment in the WiFi library there is a method for setting the hostname:
WiFi.hostname(newHostName);
Once I set this to the desired name the ESP8266 showed correctly in DHCP, on the router and, when available, was pingable. From my experimenting this needs to be done before any of the other WiFi actions for it to work effectively.
You can also include the Espressif SDK functionality although looking at the Arduino ESP8266 GitHub project it appears to already be included.
The Espressif SDK sets the hostname with the following command:
wifi_station_set_hostname(myHostname);

Wired connection from iPhone to Raspberry Pi

I would like to build an application on my iPhone that connects to my raspberry Pi. Because these are going to be in close proximity (next to each other), I'd like to use the wired connection (lightning port to USB) to communicate. Is this possible or must I use wireless technologies? My assumption is that wired would be better as it ensures a connection and would be faster, however, I am open to be corrected.
This is related to a hobbyist project where I want to access a raspberry pi sensor on my iphone. The sensor (and Pi) will be next to the iphone. I'm building a custom weird case to combine them.
Any thoughts much appreciated.
Thanks
Iain
For communication with peripheral devices (Raspberry Pi for example) you have several alternatives.
UART via 30-pin or lightning connector (MFi needed)
USB via 30-pin or lightning connector (MFi needed)
Quick start: Microchip's development kits. This module can prolong communication to RPi or you can try to implement the Accessory stack (and communication with authentification chip) to RPi itself.
FSK or similar modulated-audio communication via audio-jack (no MFi needed)
You would have to implement hardware FSK modem on the RPi side and a software one on the iOS side. It is a bit tricky but by no means impossible.
Of course you could implement software modem on the RPi side, too. But since RPi doesn't have audio input you would have to use an USB audio card or something. Or complicate your life trying to sample an analog pin fast enough.
User not really Jake made a quite impressive list of links on this topic here on SO.
Bluetooth as an External Accessory (MFi needed)
Quick start: RN-41/42-APL
Easy to use Bluetooth stack. Communication with authentification chip is handled by the BT module. Note that when communicating with iOS devices data troughput is not much better than when using BLE modules.
Bluetooth as a BLE module (no MFi needed)
Data troughput not much worse then the old BT. Implementing the communication might be a bit more tricky code-wise. This module seems interesting.
WiFi communication (no MFi needed)
WiFi might be a good choice. But for your device and iOS device to be able to find eachother you will need either static IP (for the server device) or minimal Zeroconf (Bonjour) implementation.
When using WiFi you can go either with infrastructure network (using external Access Point) or you could go with AdHoc (created by your device). Later seems promising but be careful - iOS7 & AdHoc network don't seem to work well together yet.
With WiFi you have many modules to choose from. A simpler to use would be a module like RN-XV WiFly Module. TCP stack is already implemented in the module - you can use simple UART communication. I'm not sure how to implement Zeroconf on this one.
Or there are raw WiFi modules like MRF24WG0MA/MB. They are stable and reliable and they can be used on home-etched PCB. Downside for RPi user would be that you would almost certainly need an PIC24 or something between the RPi and MRF24W. Microchip provides free TCP/IP stack for their microcontrollers and this stack includes Zeroconf.
And the easiest way: you could simply use a WiFi dongle (with RPi) for communication. Zeroconf should be easy enough to implement on the RPi - and it's not even needed at the begining if you are ok with assigning static IP to the RPi (if it acts as a server).
This is not possible without signing up for apples MFI program. You have to pay and sign a bunch of NDA's.
https://developer.apple.com/programs/mfi/
You can use other methods, like bluetooth and connection over the audio port.
While #RokJarc's answer is pretty complete, I've also had success with both wired (lightning to usb) and wireless connections using iOS's personal hotspot. Here are the steps:
For wired, on the Pi, install ipheth-utils:
sudo apt-get install ipheth-utils
And add an eth1 network interface by editing /etc/network/interfaces to include:
allow-hotplug eth1
iface eth1 inet manual
For wireless, make sure /etc/network/interfaces has a wireless network entry such as:
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
If you are using wpa_supplicant and add a network entry for the iPhone's hotspot in /etc/wpa_supplicant/wpa_supplicant.conf:
network={
ssid="Banana Phone"
psk="ring ring ring"
key_mgmt=WPA-PSK
id_str="banana"
priority=3
}
The ssid should be the name of the phone from Settings -> General -> About -> Name and the password should come from the personal hotspot screen.
Now start the personal hotspot on your phone. The pi should automatically connect when connected by a usb to lighting cable or using wifi. After connecting, the pi should be assigned an ip somewhere in 172.20.10.x. You can run ifconfig on the pi to figure out which one. (I believe that you should be able to define a static ip here but haven't messed around with that yet)
From there, you can connect another computer to the hotspot and ssh into the pi using the 172.20.10.x ip or even ssh directly from the phone.
In my personal testing, latency over lightning is consistently low and I've used this on both a Raspberry Pi Two and Raspberry Pi Zero for streaming realtime mjpeg video from two cameras to a VR headset. In this scheme, the network is a fairly small source of the 100ms or so latency. The experience is not Vive quality of course, but it is still usable and the iPhone + Pi combo provides lots of fun hacking opportunities
It's possible to do this with Mfi.You can run usbmuxd service on your Raspberry Pi. The usbmuxd will transfer the USB data into socket packets. Your iOS App also need to implement the same protocol to rx/tx the data from/to your Raspberry Pi.
David House has already made this work. https://github.com/davidahouse/PiTalk

any way to detect iPads or iPhones on wireless network? bonjour?

I am trying to detect Apple devices connected to a wireless network. This is relatively simple using Bonjour, however I am also trying to detect what kind of device it is. Like, a MacBook Air, a MacBook Pro, a MacPro, an iPhone, iPod, or an iPad.
I have found that Bonjour requests to MacBook's and MacPros include an "ADDITIONAL SECTION" response to the query which includes the model:
;; ADDITIONAL SECTION:
Q9550._device-info._tcp.local. 10 IN TXT "model=MacPro3,1"
and
;; ADDITIONAL SECTION:
Air._device-info._tcp.local. 10 IN TXT "model=MacBookAir4,2"
From testing an iPhone (3GS and 4), an iPod touch, and an iPad2, all of the iDevices only respond with their name:
;; ANSWER SECTION:
111.1.168.192.in-addr.arpa. 10 IN PTR gmPad2.local.
Clearly, the name may not reflect the device. So, I would not like to try to extrapolate the type of device from the name. Does anyone know any other ways to detect iDevice types?
Edit: just to be clear, the command I am using is: dig #224.0.0.251 -p5353 -x 192.168.1.111 ... substituting the IP address of the Apple device
Use port 62078
The most reliable indicator I have seen is whether you can connect to IP port 62078.
Port 62078 is used for the "iphone-sync" service, and I don't think MacBooks use it. This port always appears to be open for the iPhones and iPads on our (very small) network.
Possibly (but not probably) there are messages you can send to the port to sniff out more details...
I think the official xml list of port assignements is here, although it wasn't working for me just now:
http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
MAC address
In theory the MAC addresses might help - but probably not much use unless you can find somewhere that maintains a reliable list of ranges (e.g. a network security firm, or hardware provider). MAC addresses do depend on the actual chips used (or a flashed MAC). The database is at the organisation level (although organisations sometimes choose to use specific ranges for specific devices).
http://standards.ieee.org/develop/regauth/oui/public.html allows you to download the database of "Organizationally Unique Identifiers", or you can look up "Apple", or the first three bytes of a MAC address e.g. 00264A.
Anecdotally, the MAC lookup doesn't work... First three digits of my iPad MAC are 28-68-BA and that comes up with nothing.
User agent
Probably not useful, but if you can watch the network traffic or have an http proxy, then the user-agent string could help (see http://developer.apple.com/library/IOS/documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3).
Edit (added):
Appleā€™s Bonjour protocol relies on Multicast DNS (mDNS) operating at UDP port 5353 and sends to these reserved group addresses: IPv4 Group Address - 224.0.0.251, IPv6 Group Address - FF02::FB - reference.
This would help get push notification when Apple devices connect to a local network (link-local) by listening for multicast messages on 5353 UDP. Perhaps sniff the packet and see if it has any extra information in it :)
Although I presume that Bonjour API also allows for seeing this...
You can also use the airport utility to do this manually :
1) open AirportUtility
2) Go to "Wireless Clients" (hover mouse by the arrow and click it)
3) Go to DHCP Clients, and you will see iPad,iPhone, computer name, etc.... as the Client ID column.

Resources