Giter Club home page Giter Club logo

vive-tracker-3-d-data-visualization's Introduction

Vive Tracker 3-D Data Visualization with MATLAB

This code is a script that facilitates data visualization for 3-D coordinates extracted from HTC's Vive tracker.

Figure1

Purpose

The main purpose of this script is to perform data translation and rotation on the Vive tracker coordinates to improve the representation of All-Terrain Vehicles (ATVs). This enables the evaluation of machine-rider fit, quantification of rider's field of vision, and many other applications. Check out two of our projects to know more:

Guilherme De Moura Araujo, Farzaneh Khorsandi & Fadi Fathallah (2022). Ability of youth operators to reach agricultural all-terrain vehicles controls. Journal of Safety Research. DOI: 10.1016/j.jsr.2022.11.010

Guilherme De Moura Araujo, Farzaneh Khorsandi & Fadi Fathallah (2022). How do children perceive the environment around them when riding adult-sized ATVs on farms? Journal of Safety Research GitHub repo

Justification

One of the major problems with HTC's Vive tracker is that its axis system (X, Y, Z) is local, and can change every time you power the device on/off. For this reason, it's practically impossible to assume that Vive's x,y,z coordinates are similar to any system we know (for example, UTM's easting, northing, and altitude). Therefore, we developed this code to establish and reconfigure the coordinate system based on the ATV's orientation. Our goal was to have the X axis along the horizontal axis of the ATV from its top view (i.e., left to right wheels), the Y axis along the vertical axis of the ATV (i.e., left rear to left front wheel), and the Z axis along the ATV's height.

How it works

For context: We collected 38 points (x,y,z) for each ATV. Each set of points is saved in a csv file. Data collection is performed in a standard order, so we know exactly which point represents which feature of the ATV. For example, points 1-5 represent the ATV's seat. Points 34-37 represent the wheels of the ATVs and so on. Detailed information is available in the figure below.

The script begins by adding the necessary files to the path and defining which ATVs should be processed. The script then proceeds to identify the correct axes by performing an error and trial attempt. It first assumes that X = x and Y = y, and then rotates all points to perfectly align the wheels of the ATV (points #34-#37). The script then makes the same assumption for X = x and Y = z, and X = y and Y = z. At each step, the script calculates a few metrics that assist in determining which column (x, y, z) corresponds to each axis (X, Y, Z). For instance, the average distance from the seat reference point (SRP) to the center of the handlebar of an ATV is 65 cm. We can calculate the euclidian distance between points 1 (SRP) and 7 (handlebar's center) for each transformation and which one gets closer to reality.

By rotating the data, the script automatically lines up the points in the correct XY plane, i.e., the wheels, seat center, and the handlebar are automatically aligned. After reading all the Excel files, the script begins the process of data translation and rotation. It starts with the backup of data, which is the data of the y and z columns. Then, the script performs the same process again, translating the points, finding angles, making transformations, getting error metrics, and visualizing how the transformation worked.

The second part of the code is mostly for visualizing the data in different ways. The first figure block creates a figure for each ATV in the list, plots the different parts of the ATV (wheels, seat, handlebar, etc.) on the figure and then applies a rotation to align the points based on the assumption that X = x and Y = z. The second figure block creates a 3D plot for each ATV, plots the different parts of the ATV in 3D, and then applies a rotation to align the points based on the assumption that X = x and Y = z.

The final part of the code is cleaning up the variable space, organizing the newly rotated data, and saving the data in a CSV file. First, the code creates an array of strings that indicate the ATV number. Then, it prompts the user to save the newly rotated data in a CSV file using a dialog box. If the user confirms, the code creates a new directory called "Rotated Data" in the directory where the original data is located, and then saves each ATV's coordinates in a separate file with the naming format "ATV number _rot.csv". Finally, the code removes all the variables that are no longer needed from the workspace.

How to run the code

The script is written in Matlab and requires the Matlab software to be able to run it. It can be run by opening the script in Matlab and clicking the "run" button or by typing the name of the script in the command window and hitting enter. It is important to ensure that all necessary files are in the correct path before running the script.

Example

In addition to the script, this repository also includes examples of ATVs' coordinates in CSV files. These files are used as input for the script and provide a demonstration of how the script can be applied to real-world data.

vive-tracker-3-d-data-visualization's People

Contributors

guilhermedemouraa avatar

Watchers

 avatar

Forkers

yoltay

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.