SDR4space / Examples

Virtual Machine examples
24 stars 7 forks source link

[GPS support] Basic example #2

Open SDR4space opened 2 years ago

SDR4space commented 2 years ago

Not yet documented, sorry, here is a short example to access GPS from SDR4space.lite

var gps= System.GPSAvail() ;
print(gps);
sleep(2000);
var mypos = System.GPSInfos();
print(JSON.stringify(mypos));
SDR4space commented 2 years ago

If GPS is present, IQ objects are tagged with actual position.
Perform a 4 seconds capture @436MHz using PlutoSDR :

sudo ./sdr4space.light -g /dev/ttyACM0 -f capture.js

Capture.js :

var rx = Soapy.makeDevice({'query' : 'driver=plutosdr' }) ;
rx.setRxCenterFreq( 436 );
rx.setGain( 65 );
rx.setRxSampleRate(2e6);

print("Freq : ",rx.getRxCenterFreq().toFixed(0)," MHz");
print("SR : ",rx.getRxSampleRate().toFixed(0));
print("GPS : ", System.GPSAvail());
var IQ = rx.Capture( 8e6 );
print('Start capture');

IQ.saveToFile('/tmp/capture.CF32') ;
IQ.dump();

Console :


 SDR4.Space  - Build : 20211011
      (c) SDR-Technologies SAS - http://sdr4.space/
---------------------------------------------------------------------------------
Creating Radio Device factory
 Disk free space : 37.4 % 

 VM starting...

 Loading : [capture.js]

ad9361-phy,model=ad9364 ad9361-phy,xo_correction=40000087 backend_version=0.21 (git tag: v0.21  ) fw_version=v0.32-dirty hw_model=Analog Devices PlutoSDR Rev.B (Z7010-AD9364) hw_model_variant=0 hw_serial=104473....60 library_version=0.21 (git tag: 6d49eec) local,kernel=4.19.0-g6edc6cd24b48-dirty uri=usb:1.11.5 usb,idProduct=b673 usb,idVendor=0456 usb,libusb=1.0.21.11156 usb,product=PlutoSDR (ADALM-PLUTO) usb,release=2.0 usb,serial=104473dc59930017f0ff2b00a61c2ab560 usb,vendor=Analog Devices Inc. 
Found 1 frequencies: RF 
Found 1 frequency range(s): 70000000 - 6000000000 (step 0) 
Found 1 sample rate range(s): 65104 - 61440000 (step 0) 
Found 11 bandwidth range(s): 200000 - 200000 (step 0) 1000000 - 1000000 (step 0) 2000000 - 2000000 (step 0) 3000000 - 3000000 (step 0) 4000000 - 4000000 (step 0) 5000000 - 5000000 (step 0) 6000000 - 6000000 (step 0) 7000000 - 7000000 (step 0) 8000000 - 8000000 (step 0) 9000000 - 9000000 (step 0) 10000000 - 10000000 (step 0) 
Found current bandwidth 1000000
Found native stream format: CS16 (full scale: 2048.0)
Using convertion factors : (native-0.000000)/2048.000000 
(boot:0)> Freq : 436 MHz
(boot:0)> SR : 2000000 
(boot:0)> GPS : TRUE 
[INFO] Using format CF32.
[INFO] Auto setting Buffer Size: 65536
[INFO] Set MTU Size: 65536
[INFO] Has direct RX copy: 1
(boot:0)> Start capture
(boot:0)> IQData object dump:
(boot:0)>  name       : no_name
(boot:0)>  sample rate: 2.000 MHz
(boot:0)>  length     : 8000000 samples
(boot:0)>  Center Frq : 466.000 MHz
(boot:0)>  Channels   : 1
(boot:0)>  duration   : 4.000 secs. [1852.5 msecs]
(boot:0)>  GPS status : FIX
(boot:0)>  Latitude   : 47.6535250 degs N
(boot:0)>  Longitude  : 1.0886303 degs E**
(boot:0)>  Altitude   : 47.2 meters 
(boot:0)>  Attribute  : not set