Posts

Showing posts from 2016

Holiday Greetings from LOGO Santa Claus

Image
Greetings from Santa Claus ... a little exercise in Three.js (WebGL) based on a LOGO-like custom syntax. Although this could appear as a voxel designed object it is actually generated via a command sequence parsed using Regular Expressions. For example the head is:

S2,2Cw.US4,4.U.UCp.P8Z2S1,1.p8UP8Z-1S6,2Cp.p8P8Z1X-2S1,1Cp.RCb.RCp.RCb.RCp.p8US5,5Cw.US3,3Cr.US2,2.X1S2,1.U.X1.X1S1,1D.

The drawing syntax is based on boxes with height 1 size specified by S command, color by C command, write by the dot "." and a bunch of moving terms. Finally hierarchy is provided via anchors A#, while some spatial memory stores are based on the P(ush) and p(op) commands.

The outline effect is based on the interesting postprocessing pipeline from Three.js examples.

Source Code: github
Website: here


Research wise LOGO in 3D can be found in some examples: Paliokas, Ioannis, Christos Arapidis, and Michail Mpimpitsos. "PlayLOGO 3D: A 3D interactive video game for early programming education: Let …

anycat - general decompressor at command line

This is a micro post about a simple command-line utility that is decompresses several file types and sends them to stdout much like cat. Its' called anycat. The rationale is that in some cases we do not now in advance which file we need to decompress, or we want to test different algorithms. Another usage is in the context of flexible networking tools such as socat.

The source code of this script is on git.

The script invokes the correct decompressing tool using the extension of the input file or by means of an argument. Supported compression formats are: gzip,bzip2,xz,lzma,lz4.

anycat can extract a file contained in a tar or zip archive path; in this case compressed tar files are also supported.

Some examples:

anycat some.lz4 

Decompresses some.lz4 identifying it by the extension

cat some.lz4 | anycat -4 -

Decompresses the stdin content to stdout using an argument (-4) to identify the compression type

anycat -a under/someinside.xml some.zip

Extracts the file under/someinside.xml fr…

Lone Wolf story graph

Image
Few days ago Joe Daver of the Lone Wolf fame passed away, that a pity, it was an enjoyable type of book when I was a child. Since several years Project Aon is freely publishing his works in a browsable way.

Project Aon provides a graph representation of the books (e.g. here) but I wanted to have my twist as remembrance.

I have prepared a browsable story graph of the first 7 books, highlighting deaths, combats, quiz nodes, looping edges and death probability. In particular I have create also one single view with all these 7 books that gives an impression of the flow at glance.

Legenda Click on the nodes to get to the page.
Nodes:
Orange octagons are fighting situations. Red cut circles are deadly situations.Sommerswerd mention is in magentaStart and End are in green Edges: Looping edges have special arrowEdges are colored by death probability (only DAG graphs)Edge label is the death probability (only DAG graphs)Bold edge means shortest pathDashed edges means subject to random pick
Graphs…

Bandwidth usage for USB cameras: ZED tests under Linux

Robotics and Computer Vision applications are taking advance of a range USB3 cameras that are characterised by large resolution, high-frame rate and low-latency. Examples of such cameras we worked with are the StereoLabs ZED that provides a side-by-side low-latency stereo image, or monocular PointGrey cameras.

These cameras belong to the USB Video Class that has, since long time, reduced the need of specific drivers. A typical challenge in the use of this camera is the management of USB bandwidth in particular when multiple cameras have to be integrated over a same computer.

The theoretical bandwidth of USB3 is 5 Gbps but then it is known that the effective bulk transfer bandwidth is 440MB/s. In addition to this there are issues of protocol overhead that affect the use of a given resolution and rate selection.

When using multiple cameras there are also limitations in the chipset used in the motherboard. Some chipset have one single USB3 bus shared among multiple ports, instead, if an…

Unattended SSH bridging for Jetson TX1

We have recently received a marvelous NVidia Jetson TX1 and we needed to access it remotely for some tests. Unfortunately due to the local network configuration we cannot access it directly via SSH. Instead of using VPN I have configured an automatic SSH access that is used to remotely access the board via SSH.

The utility https://github.com/apenwarr/sshuttle
can be used for this purposes. This post discusses the approach without sshuttle.


Docker for our ROS robotic overlords

The typical robotic stack is based on the Robotic Operating System (ROS) whose version is linked to a specific Ubuntu LTS distribution, e.g. Indigo-14.04 and Kinetic-16.04 to mention the most recent ones. When working with recent laptops it is possibly that even with a kernel update (like Linux 4.4) it is not possible to have a good working machine.

This post aims at providing some basic indications for using the Docker container system for creating a ROS setup with a different Linux distribution together with GPU support, e.g. running ROS Indigo inside Ubuntu 16.04. Docker is used in the industry for isolation and easy deployment, and in this case it solves the compatibility problem with minimal performance penalty.

We are using this approach internally at PERCRO laboratory of SSSA for working with research robots developed in RAMCIP and ReMeDi, and also with the Baxter robot from Rethink Robotics. The post provides a basic recap also on Docker for the minimal elements useful for pu…

NVidia Driver Status Linux Commands & Headless X11

This is a short post listing the ways to check the NVidia driver status at different levels of the Linux system.

Prepared as gist


Little hack for C++ function replacement in OpenCV

This is a small post on using shared library preloading for replacing a C++ function by another for filtering the OpenCV behavior. In particular we are disabling imshow.

The trick is based on LD_PRELOAD plus dlsym, and it needs to be customized by function lookup due to C++ mangling

Target:

#include <opencv2/opencv.hpp>intmain(int argc,charconst*argv[]){auto p = cv::imread(argv[1],0); cv::imshow("ciao",p); cv::imshow("!ciao2",p); cv::waitKey(0);return0;}

The source code can be found: https://github.com/eruffaldi/redirectcv

Note that for building this example uses cmakego



Short lectures on OpenMP and CUDA

Image
In the context of the Component-Based System Design of Prof. Buttazzo at Scuola Superiore Sant'Anna I have given a 10-hour module about OpenMP and GPU computing.

The slides can be found here:

OpenMP lectures (slides of both Lectures)GPU lectures (slides Lecture1 and Lecture2) The exercises with solutions are available on the following repository:
https://github.com/eruffaldi/course_openmpgpu 
One of the exercises has been the OpenMP/CUDA implementation of Mandelbrot, simple enough to provide a starting point.


Mandelbrot solution OpenMP and CUDA.
In the case of OpenMP it is possible to play with the scheduling parameters of parallel for and the ordering of execution can be graphed. Here have, for example (clockwise from top left): static, dynamic, auto, guided.

This talk is also related to the recent work on OpenMP pre-scheduling at SAC 2016 (pdf).

Final note about the temporary report on Programming Models (for multicore, GPU and FPGA): pdf.

Starting with UEFI with CMake and VirtualBox

In the beginning there was the BIOS and every OS had to switch from real mode to protected mode. Basic services where provided via interrupts with an interface whose principles were grounded in the '80s and before. As a fact of the introduction of the Itanium platform there was an effort in defining a new boot level interface capable of supporting more functionalities and a solid interface: Unified Extensible Firmware Interface (UEFI). UEFI grew fast and now the last 2.7 account for 2700 pages.

Some time ago I played with boot procedure and the switch to 32-bit flat address protected mode (PitOS in 2002), and then I have been curious on testing the UEFI capabilities. In this post, and the associated github repository (uefiboot) I wanted to build a UEFI application using CMake and test it in both QEmu and VirtualBox.

In the conclusion I report the possibility of multiprocessing using UEFI.

Clang reflector for Data Layout and OpenMP

Image
This is a Work in Progress related to a tool for analyzing C++ code. In particular two operations are of interest:
Extraction  of the memory layout of all the types used in a program, event std ones, for the purpose of accessing them without manual serialization. This means that only fully instantiated templates are reported.Extraction of the OpenMP statements in the program The output of the program is a JSON containing the information above. The implementation is based on CLang, specifically 3.7 due to the support of OpenMP, and the program itself is a CLang tool so it can accept all the CLang options.
The source code is on github: https://github.com/eruffaldi/yreflectcxx

Updated 2016-1-31: discussion about execution flow and added lines

Updated 2017-10-31: Facebook provides a broader tool for converting C++ AST into JSON and then analyze it using OCaml:  https://github.com/facebook/facebook-clang-plugins OpenMP Analysis The OpenMP static analysis is useful in the context of research …

OSX Command line exclusion of folders from Indexing or Backup

Build folders contains tons of files (built PCL, for example, is 7k files) and it is not typically needed to make Spotlight index them or Time Machine to backup them.

For both services it is possible to control exclusion from the User Interface but sometime we want to control them from the command line.
Indexing The fastest way to prevent indexing  of a directory tree is to add a file called ".metadata_never_index", for example via touch. Time Machine OSX provides a sticky way to set exclusion for the folder meaning that it works even if the folder is moved around. The operation is performed with:
tmutil addexclusion PATH
The sticky capability is obtained by writing a special attribute in the folder as it is visible with the xattr command. The attribute is "com.apple.metadata:com_apple_backup_excludeItem" with a special value.
Listing Exclusions Using mdfind it is possible to find all excluded paths:

mdfind "com_apple_backup_excludeItem = 'com.apple.backupd&#…