Tous les articles par Philippe LC

Overlaying telemetry text on video before Wifibroadcast

Overlaying telemetry text on video before Wifibroadcast

Update code here : mavproxy_MyPiModule.py
Github here :github/MyPiDrone/MyPiModule

    • (1) Here a python sample with a named pipe MyPiCamera_sample.py and command execution with tx :
       mkfifo /tmp/MyPiCamera.pipein
      ./MyPiCamera_sample.py | tee $VIDEO | ./tx  -p $PORT -b $BLOCK_SIZE -r $FECS -f $PACKET_LENGTH $WLAN 1>/dev/null 2>&1 &
      sleep 3
      echo 'My telemetry text' > /tmp/MyPiCamera.pipein

      or with gstreamer:
      mkfifo /tmp/MyPiCamera.pipein
      ./MyPiCamera_sample.py | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink port=5000 host=10.0.0.12 >/dev/null 2>&1 &
      sleep 3
      echo 'Welcome PiCamera' > /tmp/MyPiCamera.pipein
  • (2) manage_video.sh and myvideo.service not used anymore

Data transport diagram :

mypidrone1_tarot_data_flow_diagram_v1-2

MyPiModule radio functions :

mypidrone1_tarot_mypimodule_radio_control_v1-1

Demos videos :

File recorded on SD card :

Sample Photo snapshot (to Zoom click on here):

mypidrone-overlaying-telemetry-text-on-video-demo1

Roll Sample :
mypidrone-overlaying-telemetry-text-on-video-roll-demo

Pitch and Roll sample :
mypidrone-overlaying-telemetry-text-on-video-pitch-demo

Firmware update process for APM MavLink to FrSky SmartPort Converter

HOWTO : Firmware update process for APM MavLink to FrSky SmartPort Converter AIRBORNE PROJECTS to be compliant OpenTX 2.1.7.
AIRBORNE PROJECTS

The converter must be disconnected from the Smartports before starting.
converter_medium

You must connect the USB interface converter to the PC with Windows 7, 8 or 10 and install the driver.

  • Installing drivers for the Seeeduino with window7

Download : arduino-1.6.8-windows.exe

Plug in your board and wait for Windows to begin its driver installation process. After a few moments, the process will fail.

Open the Device Manager by right clicking “My computer” and selecting control panel.

Look under Ports (COM & LPT). You should see an open port named « USB Serial Port » Right click on the « USB Serial Port » and choose the « Update Driver Software » option.

Sample driver input directory : C:\Program Files (x86)\Arduino\drivers\FTDI USB Drivers\amd64

  • Installing drivers for the Seeeduino with window8 or windows10

HOWTO here : Installing_drivers_for_the_Seeeduino_with_window8

You should save these files which you are editing before installing driver with window8,because there will several power off during operating.

  1. Press “Windows Key” +”R”
  2. Enter shutdown.exe /r /o /f /t 00
  3. Click the « OK » button.
  4. System will restart to a « Choose an option » screen
  5. Select « Troubleshoot » from « Choose an option » screen
  6. Select « Advanced options » from « Troubleshoot » screen
  7. Select « Windows Startup Settings » from « Advanced options » screen
  8. Click « Restart » button
  9. System will restart to « Advanced Boot Options » screen
  10. Select « Disable Driver Signature Enforcement » (1)
  11. Once the system starts, you can install the Arduino drivers as same as Windows

(1) Screen capture (sorry but in French : option 7) :

windows_tools_small

 Executing the firmware update:

Once your converter is recognized by Windows on a port COM,  you need to run the chapter of procedure :

Appendix A How to update the firmware’s Converter

using the Quick-Start-Guide Guide.pdf

For this you must download the archive frsky_telemetry.zip

Xloader.exe is in the archive here: \frsky_telemetry\Firmware\XLoader

Select Device : Duemilanove/Nano(ATmega328) and frsky_telemetry.hex here: \frsky_telemetry\Firmware

Update your telemetry screen1 and screen2  in  SCRIPTS/TELEMETRY directory with files  telem1.lua and telem2.lua from \frsky_telemetry\Lua\2.1.X

Finaly rediscover your telemetry sensors on Taranis Radio.

Wifibroadcast 2.3ghz and video streaming with Wifi AP

pre-requisites : you must configure your access point on the Ground Control Station (GCS) here : Ground Station Wifi Access Point Configuration

First solution: Broadcast over wifi network at 2.3GHz & 30dBm (1) from the drone « MyPiDrone » using the AP on the ground station (WiFi Access Point on Ubuntu)

This method allow to transmit video to devices connected to the AP of the ground control station (PC with Ubuntu). Also it’s possible to address several other OS such as:

(1) Configuration of wireless network 2.3GHz under Android is not yet finalized for the moment. However  you can validate this solution at 2.4Ghz with Android Beta Tower or QtGStreamerHUD.apk

Here we use a TP-LINK (wlan0) on the drone and a TP-LINK (wlan0) on the ground control station.

Please note however that solution is less efficient than the Wifibroadcast (lower range and more latency): We have validated this implementation without testing effectiveness.

For Android application you  must select : udp broadcast network (10.0.0.255) ou ip (10.0.0.12)

raspivid -ih -t $TIMEOUT -w $WIDTH -h $HEIGHT -fps $FPS -b $BITRATE -n -g $KEYFRAMERATE -pf high -o - |gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink port=5000 host=10.0.0.12
Video for Android application

For a VLC client (http, rtsp) :

## mandatory to run cvlc with root user
strings /usr/bin/vlc|egrep "getppid|geteuid"
C=`strings /usr/bin/vlc|grep -c getppid`
if [ $C -eq 1 ]; then
echo "VLC getppid already set"
else
cp /usr/bin/vlc /usr/bin/vlc.ori
sed -i 's/geteuid/getppid/' /usr/bin/vlc
strings /usr/bin/vlc|egrep "getppid|geteuid"
fi
#### http
raspivid -ih -t $TIMEOUT -w $WIDTH -h $HEIGHT -fps $FPS -b $BITRATE -n -g $KEYFRAMERATE -pf high -o - |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:5000}' :demux=h264
#### rtsp
raspivid -ih -t $TIMEOUT -w $WIDTH -h $HEIGHT -fps $FPS -b $BITRATE -n -g $KEYFRAMERATE -pf high -o - |cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:5000/}' :demux=h264
video for VLC client

Second solution: Transmission Video Wifibroadcast at 2.3GHz from the drone « MyPiDrone » to Ground Control Station (GCS) and  rebroadcast on the 2.4GHz wireless network using the Access Point to the connected equipment.

This solution uses a TP-LINK (wlan1: monitor mode) on the drone and two TP-LINK (wlan0 AP and wlan1: monitor mode) on the ground control station.

On the drone the transmission of video is in Wifibroadcast (wlan1):

raspivid -ih -t $TIMEOUT -w $WIDTH -h $HEIGHT -fps $FPS -b $BITRATE -n -g $KEYFRAMERATE -pf high -o - | tee $VIDEO | ./tx -p $PORT -b $BLOCK_SIZE -r $FECS -f $PACKET_LENGTH $WLAN
wifibroadcast video

Linux on the ground control station receiving video over Wifibroadcast (wlan1)  and rebroadcast video to Android application connected to the AP (wlan0) :

./rx -p $PORT -b $BLOCK_SIZE -r $FECS -f $PACKET_LENGTH $WLAN |gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink port=5000 host=10.0.0.12
Video streaming for Android application

Or retransmission of video VLC to a client connected to the AP (wlan0) :

./rx -p $PORT -b $BLOCK_SIZE -r $FECS -f $PACKET_LENGTH $WLAN |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:5000}' :demux=h264
video streaming for VLC client

NOTE : Instead raspivid you can use picamera. See : Overlaying telemetry text on video before Wifibroadcast

Pages

Fixing protection on the Tarot 650 chassis with nylon wire

Two nylon wire of 20 cm were used to secure the canopy of our MyPiDrone.

They come from a pull cable that is found easily in the hardware store for less than 10 Euros.

Each wire is attached to the support with the resin and some fiberglass:

20151212_204050

The diameter of the nylon wire (~2mn) match just a bit more with hole diameter used on the Tarot 650 chassis :

20151213_104357

The pressure is sufficient to maintain protection.

Pages

MyPiDrone: Create your own MAVproxy module to control the RPI2

The Raspberry PI2 consumes between 1A and 2A according to the WiFi is enabled or not and MAVproxy module (MyPiModule) will therefore help preserve the battery and control various functions of RPI2 (AP Wifi, Video Wifibroadcast, shutdown, reboot etc.) from the radio (Taranis x9d opentx in our project)

The main functions of MyPiModule (MAVProxy module):

  • my_battery_check function:
    • Preserve the minimum battery voltage if the drone is in STANDBY mode and if the engines are not armed. Under these conditions with a weak battery module executes the stop Raspberry PI 2 (init 0)
  • my_rc_check function:
    • Run a shutdown of RPI2 from the radio:
      • Conditions: STANDBY + DISARMED
      • On the radio: LOW YAW (RC4) and ROLL HIGH (RC1)
    • Perform a reboot of RPI2 from the radio:
      • Conditions: STANDBY + DISARMED
      • On the radio: LOW YAW (RC4) and ROLL LOW (RC1)
    • enable / disable the wireless network from the radio wlan0:
      • RC8 LOW : wlan0 DOWN and SINGLE MODE OFF
      • RC8 range LOW_MARK-100 to LOW_MARK : set mode STABILIZE
      • RC8 MIDDLE : SINGLE MODE ON
      • RC8 range HIGH_MARK to HIGH_MARK+100 : set mode RTL
      • RC8 HIGH : ifup wlan0
    • enable / disable the video on wifibroadcast wlan1 from the radio:
      • RC6 LOW (also used to tilt the camera left): Video wifibroadcast ON
      • RC6 HIGH (also used to tilt the camera to right): Video wifibroadcast OFF
    • Run a Redo Video WBC with the radio:
      • Conditions: STANDBY + DISARMED
      • On the radio: LOW YAW (RC4) and PITCH HIGH (RC2)

Logs: /var/log/mavproxy_MyPiModule.log


Radio configuration for MyPiModule :

mypidrone1_tarot_mypimodule_radio_control_v1-1

  • Parameters for functions and telemetry:
    (Change in /.mavinit.scr or /root/.mavinit.scr if necessary).

    • mydelayinit: : 30 seconds delay to reboot or shutdown to allow cancel.
    • myminremain : 10% (low battery remaining mark).
    • myminvolt : 10V (battery low voltage mark).
    • mytimebat : 5sec interval data mesurement of the battery voltage.
    • mytimerc : 5sec interval data mesurement of the radio channels.
    • myseqinit : 15sec before init var and start polling
    • mytimeTText : 0.5sec telemetry text refresh Interval Time
    • myrcvideo : channel to control video on / off, default 6.
    • myrcyaw and myrcroll and myrcpitch : channels to control the shutdown, reboot, redo video, default 4, 1, 2.
    • myrcnet : channel to control wlan0 on/off, default 8
    • mychanneltx : Wifibroadcast 2.4Ghz (CH 11) or 2.3Ghz (CH -19)
    • mydebug : True or False
    • myinterfaceadmin : wlan0
    • myinterfacetx : wlan1
    • mylog : /var/log/mavproxy_MyPiModule.log
    • mylogverbose : True or False
    • mypipeout : /tmp/MyPiCamera.pipeout : see start_tx_and_recording_with_raspivid_video_input.sh
    • myseqinit : delay to start 15s
    • myseqpoll : 10sec polling interval to control network status, video recording, flightmode.
    • myvideopath : /root/fpv/videos
  • Video functions :
    • Videos and photos are stored in /root/fpv/videos directory
    • Video Wifibroadcast ON/OFF (default ON) : RC6 LOW (OFF) or RC6 HIGH (ON)
    • Video recording in h264 format on SD card : automatic start/stop with Drone Armed/Disarmed
    • Snapshot photos in JPEG format on SD card (one snapshot per minute) : automatic start/stop with Drone Armed/Disarmed
    • Viewing last Video with Wifibroadcast (redo video) : STANDBY + DISARMED, LOW YAW (RC4) and PITCH HIGH (RC2) (Warning : during redo video the MyPiModule is paused)

  • Console mode functions:
    • mybat : battery status
    • myshut : execute a shutdown (to cancel shutdown execute a new request in time delay of 30 secondes)
    • myreboot : execute a reboot (to cancel reboot execute a new request in time delay of 30 secondes)
    • myrtl : set RTL mode
    • mystabilize : set STABILIZE mode

Shutdown and reboot may be canceled : execute a new command before delay (30sec) to do that .

The STATUSTEXT progress message is displayed on the screen 2 on the telemetry radio.

A YAW MAX 3 seconds (ARMED) also cancels all requests for shutdown or reboot in progress.


Here the module test procedure:

  1. Install MAVproxy with git clone https://github.com/Dronecode/MAVProxy.git
  2. Create your MAVProxy Module/modules/mavproxy_MyPiModule.py module available here: git clone https://github.com/MyPiDrone/MyPiModule
  3. Execute python setup.py build install
  4. Execute ArduPilot:
  5. /usr/bin/ArduCopter-quad -A /dev/ttyAMA0 -C udp:127.0.0.1:14550
  6. Execute MAVProxy (in console mode remove –deamon) /usr/local/bin/mavproxy.py –master=udp:127.0.0.1:14550 –quadcopter –out=/dev/ttyUSB0,57600 –default-modules=’MyPiModule’ –daemon
    You can also load the module when MAVProxy is already started with the command module load MyPiModule or module reload MyPiModule

You can add this self-loading in file /.mavinit.scr or /root/.mavinit.scr by adding the line module load MyPiModule

MAVproxy load ten modules and –default-modules=’MyPiModule’ option allows load only the list of desired modules (comma separator) to consume less CPU on RPI2 and therefore less battery.

  1. Observe the behavior in the log file: tail -f /var/log/mavproxy_MyPiModule.log

example :


2016-02-27 08:41:19 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11617 MyCurrent 150 MyRemaining 97 MyRC2Raw 0 MyRC3Raw 0 : Reboot ByRadio
2016-02-27 08:41:19 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11617 MyCurrent 150 MyRemaining 97 Reboot ByRadio after 30sec
2016-02-27 08:41:19 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11617 MyCurrent 150 MyRemaining 97 MySeverity 1 MyStatusText Reboot ByRadio after 30sec at 08h41m19s
2016-02-27 08:41:20 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11617 MyCurrent 150 MyRemaining 97 MySeverity 6 MyStatusText SIMPLE mode on
2016-02-27 08:41:23 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11574 MyCurrent 164 MyRemaining 97 LowVolt >10000 or LowRemain >10 : Good status
2016-02-27 08:41:24 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11579 MyCurrent 147 MyRemaining 97 ifup wlan0 RPI2
2016-02-27 08:41:24 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11579 MyCurrent 147 MyRemaining 97 cmd [‘ifup’, ‘wlan0’] sdtout
2016-02-27 08:41:24 INFO Armed: False MyState: 3 Mythrottle 0 MyVolt 11579 MyCurrent 147 MyRemaining 97 cmd [‘ifup’, ‘wlan0’] stderr ifup: interface wlan0 already configured


Radio STATUSTEXT example (menu screen2 telem2.lua) :

20160228_113522_mypimodule

Pages

SiteMap EN_US

Pages