Top Banner
11th International Symposium on Distributed Computing and Artificial Intelligence. Salamanca, 4nd-6th Juny, 2014 Performance and results of the triple buffering built- in in a Raspberry PI to optimize the distribution of information from a Smart Sensor Jose-Luis Jimenez-Garcia, Jose-Luis Poza-Lujan, Juan-Luis Posadas- Yagüe, David Baselga-Masia, José- Enrique Simó-Ten School of Engineering in Computer Science (ETSINF) University Institute of Control Systems and Industrial Computing (ai2) Universitat Politècnica de València (UPV) (Spain
14

Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

Jun 25, 2015

Download

Engineering

Currently, 3D sensors can be considered an evolution of cameras by providing the image with its depth information. These sensors have a generic function and the programmer has to process the received information in order to be adapted and used in a specific environment. In robots navigation, the 3D information can be useful for basic behaviours such as “obstacles avoidance” or even more complex behaviours such as “maps generation”. In this article an image management system provided by the xTion intelligent sensor is presented. The xTion sensor provides a VGA image and a 3D depth, which allows it to be used for several purposes. In order to distribute the data, it is acquired, processed and sent to several clients with a triple buffer system modified to serve the most recent image to the client. The system is programmed in C for Linux and built-in in a Raspberry PI. The article exposes the performance and results from monitoring the frame's delay comparing it with a simple and a double buffer system widely used in this kind of systems.
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: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart SensorJose-Luis Jimenez-Garcia, Jose-Luis Poza-Lujan, Juan-Luis Posadas-Yagüe, David Baselga-Masia, José-Enrique Simó-TenSchool of Engineering in Computer Science (ETSINF)University Institute of Control Systems and Industrial Computing (ai2)Universitat Politècnica de València (UPV) (Spain

Page 2: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Why smart sensors?Use of sensors in robot navigation:

Survival behaviours reactive navigation simple sensorsComplex behaviours deliberative navigation has been used information from reactive information sensors

Currently, robots need sensors associated to behaviours.

However, this information is useful to build an environment map or to locate specific objects during the navigationThe information that a sensor produces is interesting it to be distributed to different behavioural processes

Page 3: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

ComponentsFrom sensor to smart (intelligent) sensor (device)

Arduino

Intel Galileo

Raspberry PI

Reliability (and price)

Computing

Computing

Reliability (and price)

Temperature

PIR RGB-DSENSORS

CONTROLLERS+

Page 4: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

ProblemsIntelligent sensor : pre-processing and Distributing the sensor data

Intelligent Sensor

RGB image

Depth map

Acquisition Process

···

Distribution

···

···

···

···

Clie

nts

Smart Resource

QoS

Page 5: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

System

Real Robots

xTion

Raspberry Pi

USB

OpenNI

OpenCV

TCP Server

Ethernet

Smart Resource

Robots

TCP Client

Control

Simulation

Real implementation

Page 6: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Buffering techniquesSensor acquisition

Sensor distribution

Solution

1: Wait()2: Swap()3: Send()

1: I 0 2: Adquisition() frame3: while I < frame.MaxPixel do4: frame.Process()5: end while6: Swap()7: Signal()

Page 7: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Buffering

tacc < tdistributionAcquisition()

Process Thread()Process()

signal()

Send Thread()wait()swap() swap() send()

Clients

A1(fi+1)

A3(fi)

swap() & signal()

swap()

acquisition & process() send()

Intelligent Sensor

send()

send()swap() & signal()

send()

swap() & signal() send()

acquisition & process()

acquisition & process()

Frame A3 is last frame,

Frame A2 is not sent swap()acquisition & process()

send()swap() & signal()

..., fi, fi+1, fi+2, fi+3, fi+4, ...

A3(fi)

A3(fi)

A3(fi)

A1(fi+1)

A1(fi+1)

A1(fi+1)

A1(fi+1)

A1(fi+1)

A1(fi+1)

A1(fi+1)

A2(fi+2)

A2(fi+2)

A2(fi+2)

A3(fi+3)

..., fi, fi+1, fi+3, ...

A2(fi+2)

A3(fi+3)

A2(fi+4)

A2(fi+4)

A3(fi+3)

A3(fi+3)

A2(fx)

A2(fx)

Page 8: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Buffering

tacc > tdistribution

A1(fi+1)

A3(fi)

swap() & signal()

acquisition & process() swap() & send()

swap() & signal()

acquisition & process()

acquisition & process()

A3(fi)

A3(fi)

A1(fi+1)

A1(fi+1)

A2(fi+2)

A2(fi+2)

A2(fi+2)

A3(fi+3)

A3(fi+3)

A2(fx)

A2(fx)

wait()acquisition & process() A1(fi+1)

A2(fx)

A3(fi)

A3(fi)

acquisition & process()

acquisition & process() A2(fi+2)

A3(fi)

A1(fi+1)

wait()

swap() & signal() A1(fi+1)

wait()

swap() & send()

wait()

A1(fi+1)

acquisition & process()

A3(fi+3)

A1(fi+1)

A2(fi+2)

wait()

A1(fi+1)

A3(fi+3)

A2(fi+2)

wait()

swap() & send()

swap() & send()A1(fi+4)

A2(fi+2)

Acquisition()Process Thread()

Process()signal()

Send Thread()wait()swap() swap() send()

Intelligent Sensor

..., fi, fi+1, fi+2, fi+3, fi+4, ... ..., fi, fi+1, fi+2, fi+3, ...

Clients

Page 9: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Double buffer in front of triple buffering

Triple There is always a frame ready to be sentDouble Always sends the last frame

OptimizationTime

Triple buffer Send i

Acquisition & Process

Frame delay (i+2)

Frame Period

i+2 i+5

i i+3Double buffer Send

i+8

i+10 i+11i+9i+8i+7i+6i+5i+4i+3i+2i+1i

Frame delay (i+3)

i+9i+6

Page 10: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Real system to measure double vs triple buffering methods

Experiments

ControlDistributing

Page 11: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Smart sensor introduces a frame delay

Buffering vs number of clients

Results

1 client 2 clients 4 clients

Variables PC RPI PC RPI PC RPI

Simple buffer 67350 3176925 66936 592390 66945 1293636

Double buffer 67350 203086 66936 334824 66945 640506

Triple buffer 66940 199647 67386 332900 66930 611752

𝑇 𝑓𝑟𝑎𝑚𝑒𝑑𝑒𝑙𝑎𝑦=𝑡𝑎𝑑𝑞+𝑡𝑤𝑝+𝑡𝑝+𝑡𝑤𝑠+𝑡 𝑠

Page 12: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

ConclusionsPowerful computer (PC) differences between the types of buffer are not significant.An embedded system provides less efficient results (delay times) but… Double buffer offers the last frame with some delay time. In triple buffering there is always a frame available to be sent.

Page 13: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Future workHow the buffer used affects to robot navigation? Reactive behaviours require information as quickly as possible so the triple buffer seems the most appropriate method. However, the immediacy of the double buffer, can improve certain non-critical behaviours as tracking paths, due to they provide latest information, but with less immediacy.As future work, it is planned to adapt the triple buffer to a system where the obtained data from the intelligent sensor would have several distinct parallel processes, in example, locating free paths to the robot trajectory at the same time that interesting objects to surrounding maps generation are detected like corners, walls or door steps.

Page 14: Performance and results of the triple buffering built-in in a Raspberry PI to optimize the distribution of information from a Smart Sensor

11th International Symposium on Distributed Computing and Artificial Intelligence.Salamanca, 4nd-6th Juny, 2014

Thanks for your attention