Top Banner
Motivation Our Results Summary Real-time data streaming and motion control over the Internet Implement real-time QoS-aware data streaming for Internet-connected things. Andrey Nechypurenko [email protected] Maksym Parkachov [email protected] Ultracode-Munich, April 2014 veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet
19

Real time data streaming and motion control over the internet

Nov 22, 2014

Download

Technology

BeMyApp

Presentation by Andrey Nechypurenko on his project Veterobot.

Join the Ultracode Munich meetup : http://www.meetup.com/Ultracode-Munich
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Real-time data streaming and motion control over the InternetImplement real-time QoS-aware data streaming for Internet-connected things.

Andrey [email protected]

Maksym [email protected]

Ultracode-Munich, April 2014

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 2: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Stream data between connected thingsProblem statement

Let’s build the vehicle and control it over the InternetAs a hobby project, we start developing small vehicle equipped with on-boardcomputer connected to WLan adapter and web-camera. The idea was to control thecar over Internet.

Main challenges

Find or build mechanical platformBuild electronic which can:

Compress live video stream to h264 format in real-timeSupport W-WLan connectivityHave enough IO channels to control motors

Develop software which can:Deliver video stream and sensor data to the remote driverReceive user input such as steering and accelerationDeliver control commands from the driver to the vehicle software and drive actuatorsSupport client and server NAT and firewall traversalProvide high quality video under variable network conditions

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 3: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Stream data between connected thingsProblem statement

High level system overview

The whole system software has two main tasks:

Deliver video stream and sensor data from the vehicle to the remote driver and

Deliver control commands from the driver to the vehicle software and drive vehicleactuators.

Communication happens over the Internet where it is typical to have two firewalls(and/or NATs) on the client and server side.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 4: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Stream data between connected thingsProblem statement

Mechanic and electronic

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 5: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Stream data between connected thingsProblem statement

Need for adaptive video streaming

It is important to provide constant frame rate with predictable latency to preciselycontrol the vehicle. Otherwise, the wall may suddenly appears ahead of the car :-) .

Negative effect of the changing network conditions leads to:

1 Delays in video stream (picture freezes).2 Corrupted frames (because of dropped frames, etc.).3 “Fast forward” effect when the next chunk of data arrives.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 6: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Solution - QoS aware streaming

The adaptive Quality of Service (QoS) aware streaming implementation is required tolet the driver precisely control remote vehicle.

To solve the problems mentioned above:

We constantly observe network conditions.

If sensor data could not be send fast enough, adapt to satisfy main goal.

For example, reduce video frame-rate or increase compression rate (e.g. reducevideo quality).

The core adaptation logic resides in the vehicle on-board application.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 7: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Main software modules

To provide this functionality two main modules are required:

Driver application which will be further reffered as cockpit.Vehicle on-board application which will be reffered as vehicle.

In addition, to perform firewall traversal in the secure and efficient way, additionalapplication is required on the server side. In this project, ZeroC Ice open-sourcemiddleware is used for all communication needs.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 8: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Cockpit application.

Cockpit application

Cockpit application is responsible for receiving video stream, decoding, andvisualizing it.

In addition cockpit application receives control signals from input hardware andtransmit commands to the vehicle.

Implementation is heavily multithreaded and uses graphics hardware acceleration.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 9: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Cockpit application

An OpenGL-based application to remotely control the robot manually. Sensor data(including video from cameras) are rendered in real-time and control commands aresent back to the vehicle.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 10: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

On-board software

The vehicle on-board application has the following responsibilities:

Receive commands (such as steering and acceleration) and control actuators.

Capture video, compress it in real-time and send to the cockpit application.

Collect statistic about network bandwidth to perform adaptation in case ofchanged network conditions.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 11: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

QoS aware streaming

Use TCP instead of UDP to get better feedback about packet delivery status.

Permanently monitor the size of output queue with compressed frames to deducethe current QoS conditions.

Define the set of states characterized by maximum and minimum queue size totransition to the better or worth state. In addition, the time-based weight isintroduced which is calculated based on the overall time spent in certain state. Itprevents the system from permanently jumping from one state to another.

React on the state changes by dynamically adjusting frame size and codec targetbitrate (if it is supported by codec).

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 12: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Alternatives for streaming implementations

Two implementation options wereconsidered:

Using GStreamer RTSP server.

Custom transport protocol for RTPpayload using Ice middleware.

To make final decision, both variants wereimplemented and compared.

Reasons why Ice was considered as communication solution:

Reduce complexity when implementing complex bidirectional communication.

Transparently handles cross-platform issues such as endianess.

There are two versions of Ice. IceE which has reduced footprint and easier tocross-compile. The complete version provides the full set of functionality.

Very easy to change the communication protocol. Changing between UDP,TCP or SSL is the matter of change endpoint description in the configuration file.

There is service application Glacier which solves firewall/NAT related problems.Asynchronous Method Invocation (AMI) which makes possible to collect moreinformation about bufferization and transmission performance.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 13: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Test setup

Stream video using two alternative implementations. UseLinux kernel trafic shaping capabilities to simulate variablenetwork bandwidth.

Use prerecorded video

For test purposes, we feed the prerecorded video instead of live capturing. Original fileis scaled down on the fly to make the test comparable with live streaming fromweb-camera.Decoding pipeline for cockpit application was not changed.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 14: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Test setup

Linux kernel network traffic shaping capabilities are used to restrict the availablebandwidth and see how both streaming implementations would react on it.

1 MPlayer video output window.2 Terminal window where traffic shaping

commands are issued.3 MPlayer console output.4 KNemo network monitor window.

1 Cockpit application window.2 Terminal window where traffic shaping

commands are issued.3 Vehicle application console output.4 KNemo network monitor window.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 15: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Important observations for RTSP server

When available bandwidth decreasedbelow the level required to transmit thevideo with current encoding parameters(resolution, frame rate, quality, etc.):

Communication channel is saturated.

Displayed frame rate is significantlyreduced.

No adaptation is occurred.

“Old” frames might be also droppedwhich leads to lowered frameratecompared to the original video.

Concluion:

Such behavior is unacceptable for real-time streaming required to control remotevehicle.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 16: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Important observations for VETER infrastructure

When available bandwidth decreased:

Vehicle application detects changednetworking condition.

Reacts by reducing frame size (currentimplementation divides the originalsize by the power of two for eachstate).

Keeps the same frame rate as originalvideo.

As a result, used bandwidth is belowcurrent limit and is not saturated.

Conclusion:

Quality of the video is reduced but frame rate remains the same, which isimportant for real-time remote control.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 17: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Implementation StrategyAdaptation

Important observations for VETER infrastructure

After preconfigured amount of time,attempts to return to the original videoquality (frame size).

If required bandwidth available,continues to increase frame size.

Conclusion:

Improved bandwidth usage and as a result best possible quality with constantframe rate is presented to the drivers.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 18: Real time data streaming and motion control over the internet

MotivationOur Results

Summary

Summary

Conclusions:

Currently there is no out of the box solution for adaptive real-time video streamingsuited for IoT embedded systems.

Using GStreamer and Ice it is possible to build such solution.

To react on network QoS changes, frame size could be changed on the fly usingvideoscale or appropriate hardware accelerated elements like for exampleTIVidScale.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet

Page 19: Real time data streaming and motion control over the internet

Appendix For Further Reading

Source code and information availability I

Web site:http://veterobot.orgMain Veter-project web site.

Blog:http://veter-project.blogspot.comVeter-project blog with regular updates about the project.

GitHub:http://www.github.org/veter-teamComplete source code and documentation repostiroy.

veterobot.org, Andrey Nechypurenko, Maksym Parkachov Real-time data streaming and motion control over the Internet