Homework 6: Pose Tracking EE267 Virtual Reality 2018

Similar documents
Homework 1: Getting Started with WebGL and Transformations EE267 Virtual Reality 2018

Assignment 1 due 4/13/2017 at 11:59PM Topic: Getting Started with WebGL and Transformations

General Instructions. Questions

ENGINEERING Electrical Engineering

EE 267 Virtual Reality Course Notes: 3-DOF Orientation Tracking with IMUs

Objectives. Part 1: forward kinematics. Physical Dimension

Image Manipulation in MATLAB Due Monday, July 17 at 5:00 PM

Inertial Measurement Units I!

AE483: Lab #1 Sensor Data Collection and Analysis

MATLAB - Lecture # 4

Image warping , , Computational Photography Fall 2017, Lecture 10

CIS 580, Machine Perception, Spring 2015 Homework 1 Due: :59AM

15-110: Principles of Computing, Spring 2018

Homework 1 (a and b) Convex Sets and Convex Functions

Rendering for Positional Tracking

CSE 252A Computer Vision Homework 3 Instructor: Ben Ochoa Due : Monday, November 21, 2016, 11:59 PM

Ascii Art. CS 1301 Individual Homework 7 Ascii Art Due: Monday April 4 th, before 11:55pm Out of 100 points

CSE 547: Machine Learning for Big Data Spring Problem Set 2. Please read the homework submission policies.

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

MATLAB Demo. Preliminaries and Getting Started with Matlab

HMC CS 158, Fall 2017 Problem Set 3 Programming: Regularized Polynomial Regression

Fall 2017: Numerical Methods I Assignment 1 (due Sep. 21, 2017)

Homework /681: Artificial Intelligence (Fall 2017) Out: October 18, 2017 Due: October 29, 2017 at 11:59PM

Assignment 2 Ray Tracing

EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3

Lab 1 Implementing a Simon Says Game

Laboratory Assignment #3 Eclipse CDT

ECE2049: Embedded Systems in Engineering Design Lab Exercise #3 C Term Making a Time and Temperature Display

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

Autonomous Navigation for Flying Robots

CIS581: Computer Vision and Computational Photography Project 4, Part B: Convolutional Neural Networks (CNNs) Due: Dec.11, 2017 at 11:59 pm

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

MATLAB Introduction To Engineering for ECE Topics Covered: 1. Creating Script Files (.m files) 2. Using the Real Time Debugger

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

COMP 558 lecture 19 Nov. 17, 2010

Programming Exercise 1: Linear Regression

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSC 443: Web Programming

CS1110 Lab 6 (Mar 17-18, 2015)

FAU. How do I. Post course content? Folders

Sphero Lightning Lab Cheat Sheet

CIS 580, Machine Perception, Spring 2016 Homework 2 Due: :59AM

CHAPTER 6. The Normal Probability Distribution

CS 051 Homework Laboratory #2

WideQuick Remote WideQuick Designer

Maths PoS: Year 7 HT1. Students will colour code as they work through the scheme of work. Students will learn about Number and Shape

EECS 4330/7330 Introduction to Mechatronics and Robotic Vision, Fall Lab 1. Camera Calibration

Lab 1 Implementing a Simon Says Game

Student Guide. Document Version: This guide documents features available in NETLAB+ VE version and later.

Laboratory 1 Introduction to MATLAB for Signals and Systems

Matlab notes Matlab is a matrix-based, high-performance language for technical computing It integrates computation, visualisation and programming usin

Assignment 4: Flight Simulator

9/24/2018 Programming Data Structures

Technical Arts 101 Prof. Anupam Saxena Department of Mechanical engineering Indian Institute of Technology, Kanpur. Lecture - 7 Think and Analyze

User Manual. Version 3.1. Copyright 2000 Academia Software Solutions All Rights Reserved

CS184: Using Quaternions to Represent Rotation

DD2429 Computational Photography :00-19:00

Outline for Today. Lab Equipment & Procedures. Teaching Assistants. Announcements

CS 231A: Computer Vision (Winter 2018) Problem Set 2

ENED 1090: Engineering Models I Homework Assignment #2 Due: Week of September 16 th at the beginning of your Recitation Section

Perspective Projection [2 pts]

Computer Vision I Name : CSE 252A, Fall 2012 Student ID : David Kriegman Assignment #1. (Due date: 10/23/2012) x P. = z

MAT 003 Brian Killough s Instructor Notes Saint Leo University

HOMEWORK 7. M. Neumann. Due: THU 8 MAR PM. Getting Started SUBMISSION INSTRUCTIONS

Interlude: Solving systems of Equations

Geometric camera models and calibration

Sixth lecture; classes, objects, reference operator.

Two-view geometry Computer Vision Spring 2018, Lecture 10

Introduction to MATLAB

8/6/2010 Assignment Previewer

Advanced Vision Practical

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

AIRRS. Infrared Distance Measurement Analog Output Signal Narrow Field of View Reliable Easy to use. Analog Infra-Red Ranging System

CS195H Homework 1 Grid homotopies and free groups. Due: February 5, 2015, before class

CS143: Introduction to Computer Vision Homework Assignment 3

APPM 2360 Project 2 Due Nov. 3 at 5:00 PM in D2L

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

Lecture 8: Forward and Inverse Kinematics & Servo Motors. E5 Lab is in Hicks 213, not in Trotter

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras

CSC 101: Lab #8 Digital Video Lab due date: 5:00pm, day after lab session

Programming Exercise 3: Multi-class Classification and Neural Networks

Web API Lab. The next two deliverables you shall write yourself.

Class #10 Wednesday, November 8, 2017

Graphical Analysis of Kinematics

1 Background and Introduction 2. 2 Assessment 2

CS 202: Introduction to Computation Fall 2010: Exam #1

Graphical Analysis of Kinematics

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

CSCI 135 Programming Exam #1 Fundamentals of Computer Science I Fall 2014

Introduction to MATLAB

Homework: More Abstraction, Trees, and Lists

Hartley - Zisserman reading club. Part I: Hartley and Zisserman Appendix 6: Part II: Zhengyou Zhang: Presented by Daniel Fontijne

Lecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han

Advanced Robotic Manipulation

Homework 4: Clustering, Recommenders, Dim. Reduction, ML and Graph Mining (due November 19 th, 2014, 2:30pm, in class hard-copy please)

CS 1803 Pair Homework 10 Newsvendor Inventory Policy Due: Monday, November 29th before 6:00 PM Out of 100 points

Note: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.

EE 301 Signals & Systems I MATLAB Tutorial with Questions

Welcome to Lab! You do not need to keep the same partner from last lab. We will come around checking your prelabs after we introduce the lab

Transcription:

Homework 6: Pose Tracking EE267 Virtual Reality 218 Due: 5/17/218, 11:59pm Instructions Students should use the Arduino environment and JavaScript for this assignment, building on top of the provided starter code found on the GitHub repository. We recommend using the Chrome browser for debugging purposes (using the console and built-in debugger). Make sure hardware acceleration is turned on in the advanced settings in Chrome. Other browsers might work too, but will not be supported by the teaching staff in labs, piazza, and office hours. Students may use the computers in our teaching lab or their own laptops and desktops. The theoretical part of this homework is to be done individually, while the programming part can be worked on in groups of up to two. If you work in a group, make sure to acknowledge your team member when submitting on Gradescope. You can change your teams from assignment to assignment. Homeworks are to be submitted on Gradescope (sign-up code: M6P2J6). You will be asked to submit both a PDF containing all of your answers, plots, and insights in a single PDF as well as a zip of your code (more on this later). The code can be submitted as a group on Gradescope, but each student must submit their own PDF. Submit the PDF to the Gradescope submission titled Homework 6: Pose Tracking and the zip of the code to Homework 6: Code Submission. For your convenience, we have developed an interface to zip up only the relevant code files for submission. When you are ready to submit, drag the entire homework folder (from your local file explorer) into the browser window when the render.html file is loaded and running. Watch the Homework 1 video for a demonstration. This will zip up the relevant files for submission and download the zip file to the homework directory. Submit the zip file to Gradescope. Do not modify the submit.js file or you risk not submitting all required files. For this week s topic, course notes are available on the course website. These notes go into more detail for the mathematical concepts discussed in class. Please review the lecture slides and read the course notes before you start with this homework. Please complete this week s lab before you start to work on the programming part of this homework. 1 Theoretical Part 1.1 Image Formation Model (1pts) Let s say we have the ground truth 6-DOF pose, i.e. orientation θ and position t, of a VRduino given as θ = θx θ y = 45, t = tx t y = 1 1 (in mm) 45 tz 5 θ z We also know that the four photodiodes are mounted on the VRduino on the following positions (specified in mm): p = 42 25 p 1 = 42 25 p 2 = 42 25 p 3 = 42 25 As a Lighthouse base station sweeps its invisible horizontal and vertical laser lines through the room, all four photodiodes would be triggered at a particular time stamp, measured in clock ticks of the microcontroller. Given the parameters above, what are these time stamps for all photodiodes? List both horizontal and vertical time stamp for each photodiode, i.e. 8 values total. Round the clock ticks to the nearest integer. Assume that the microcontroller runs at 48 MHz. Similar to the lecture and course notes, we define the sequence of rotations from local to world coordinates as yaw-pitch-roll, i.e. R = R z (θ z) R x (θ x) R y (θ y)

(see Appendix C of course notes). You can use your favorite tool for the computation (Matlab, Python, etc.) in this problem. There is no need to submit code, but show your derivations/logic in your writeup. 1.2 Robustness of the Inverse Method (15pts) Usually, we do not know the ground truth pose of a VRduino. To compute it from the measured time stamps, we can use the homography method as discussed in class and in the course notes. For this purpose, we need to construct a linear system of equations b = Ah and solve it for h. This requires the matrix A to be inverted. As you know, the robustness of a linear inverse problem with respect to sensor noise or slight errors in the measurements is defined by the conditioning of the matrix. You can use your favorite tool for the computation (Matlab, Python, etc.) in this problem. There is no need to submit code, but show your derivations/logic in your writeup. (i) Show the matrix A constructed from the eight measurements you calculated in Section 1.1. (5pts) (ii) Compute the singular values σ 1,...,8 (A) and condition number κ (A) = σmax(a) σ min of this matrix. Briefly discuss what this (A) number means for the robustness of this inverse problem with respect to noise and measurement errors. (1pts) 1.3 Arranging Photodiodes in 3D (2pts) On the VRduino, all photodiodes are arranged in a planar configuration. While this makes the related calculations a bit easier, it may not be the best approach when robustness and precision of the tracking matter. Indeed, the arrangement of the photodiodes on the controllers and the HMD that the HTC Lighthouse usually tracks is a much more complex 3D configuration. Let s look at such a 3D photodiode arrangement in more detail! You can use your favorite tool for the computation (Matlab, Python, etc.) in this problem. There is no need to submit code, but show your derivations/logic in your writeup. (i) What is the minimum number of photodiodes arranged in a non-planar 3D configuration that results in a square or tall matrix A R m n, m n in the linear equation system? How did you come up with that number? (1pts) (ii) Assume that we have the same four planar photodiodes listed in Section 1.1 as well as two additional photodiodes that extrude from that plane and are located at: p 4 = 25 p 5 = 25 1 1 On this VRduino, we have measured the following horizontal and vertical time stamps on all 6 photodiodes and converted them into normalized coordinates: photodiodes x n y n p -.2926 -.822 p 1.3296.9955 p 2.6459.4924 p 3.1919 -.294 p 4.948.4814 p 5.343.1154 Using the least square solution h = (A T A) 1 A T b to the linear system, retrieve translation vector t and report yaw, pitch and roll angles in degrees. Round translations and angles (in degrees) to the nearest integer. (1pts) Hint: First derive the linear system, invert it to obtain rotation matrix R and translation vector t based on h. Then refer to Appendix C of course notes for details on how to calculate yaw, pitch and roll from R. 2 Programming Part In this part of the homework, you will implement homography-based pose estimation with the VRduino and the Lighthouse. The structure of the starter code is similar to the code in Homework 5. Here is a brief overview: 1. vrduino.ino: Initializes all tracking variables and calls tracking functions during each loop iteration. 2. PoseTracker.cpp: Manages the pose tracking. Inherits the orientation tracking functionalities from OrientationTracker

in Homework 5. 3. PoseMath.cpp: Implements the math for the pose tracking algorithms. 4. Lighthouse*.cpp Handles the photodiode interrupts to record pulse timings from the Lighthouse. These are implemented for you. Implementation hints: You do not need a Lighthouse base station to implement the following tasks. We provide pre-recorded timing data from the Lighthouse so you can implement and test your code off-line and then just test it in the teaching lab at the end to make sure it actually works. Set simulatelighthouse = true in vrduino.ino to work with the pre-recorded data instead of live-captured photodiode timings. Once you are done with the implementation and you are testing the code in the teaching lab with the actual Lighthouse, read the mode of operation (i.e. A, B, or C) of the base station closest to you (there is a small LCD on each base station showing which mode it is set to). Then set the variable basestationmode in vrduino.ino to this value. You can also send, 1, or 2 to the Teensy for modes A, B, and C, respectively. Do not change the mode of operation on the lighthouse base stations in the teaching lab! As in Homework 5, you can press r to reset the orientation and b to recalibrate the bias. Before implementing a function, read the documentation in the header file for additional details. We provide a framework for unit testing in TestPose.cpp. Feel free to add your own tests to this file. Set test = true in vrduino.ino to run the tests. Each part in this assignment depends on the previous part, so make sure each part works before moving on. Use the provided visualizer with the 6D pose mode selected. See Lab 6 for instructions on how to run it. The goal of the remaining programming questions is to implement the function updatepose() in PoseTracker.cpp. Here, you will have to call several other functions, all included in the file PoseMath.cpp, with the correct input and output variables. In the following, we will go through each of these functions step-by-step. You will implement each of the functions in PoseMath.cpp and then call them with the correct arguments in updatepose(). Before starting the homework, please make sure that the CPU speed of Teensy is set to 48 MHz in Tools of Arduino IDE. After implementing all functions, you can run render.html to dive into the VR world with 6DoF capabilities. To match the coordinate system between the lighthouse and the virtual world, reset the orientation tracking by pressing r while facing the VRduino to the lighthouse. If your pose estimation is jittery, you can perform denoising by the temporal filtering, which is already provided in the starter code. To increase and decrease the denoising amount, press 2 and 3 in the browser window. 2.1 Clock Ticks to Normalized 2D Coordinates (1pts) In every loop iteration, we query the photodiodes to see if new timing data is available for all 4 diodes. If new data is available, the clockticks variable in PoseTracker is populated with these timings. We have implemented this functionality for you. Your first task is simple: implement the function convertticksto2dpositions() in PoseMath.cpp. In this function, you should first convert the raw clock ticks measured for horizontal and vertical sweep directions to azimuth and elevation angles, respectively. Then, you convert this angle to normalized coordinates x n and y n on an imaginary plane at unit distance away from the base station. Follow the equations of lecture 11. Once you have implemented convertticksto2dpositions(), call it with the correct arguments in updatepose(). Remember that the clock ticks are available in the clockticks array (sorted in the following order: photodiode.x, photodiode.y, photodiode1.x,...) and you want to write the normalized coordinates into the variable position2d (same order as clockticks), so these should be the arguments for convertticksto2dpositions() in updatepose(). You can run the JavaScript visualizer provided to you in the starter code to visualize your normalized coordinates (upper left browser sub-window with black background, should look like Figure 1 but without labels). Make sure you see these coordinates update correctly in the browser window before continuing. Note that the main file vrduino.ino will automatically stream values of the position2d array with the prefix PD to the serial port. This is how the JavaScript visualizer reads and renders them, but you don t have to do anything for this. 2.2 Populate Matrix A (1pts) Now, set up the matrix A as discussed in the lecture. For this purpose, implement the function forma() in PoseMath.cpp. Once you have implemented this function, call it with the appropriate arguments in updatepose().

Figure 1: Visualization of the normalized 2D coordinates x n and y n for all 4 photodiodes. Remember that A describes the linear mapping between the 8 homography values h that we need to estimate and the normalized coordinates of the photodiode timings, which you computed in the last subsection. The physical reference positions of the photodiodes on the VRduino board are listed in the lecture slides and provided in the starter code in the array positionref (defined in PoseTracker.h). So this should be one of the arguments for forma(). Also, create an empty 8 8 array in updatepose() to pass in as the output variable A. Keep in mind that you can access 2D arrays in C/C++ as A[i][j], where i is the row index and j is the column index. 2.3 Solve for h (1pts) With the matrix A and the vector of measurements b in place, we have all the information we need to solve for the homography values h. The measurements, called b in the lecture slides, are just your array position2d that you have already computed above. Implement the function solveforh() in PoseMath.cpp to compute h. Make use of the MatrixMath library perform matrix inversions and multiplications. Check if Matrix.Invert() returns, in which case the matrix is not invertible or is illconditioned. This is usually only the case if you made a mistake somewhere else before calling Matrix.Invert(). Make sure to return false in solveforh() if Matrix.Invert() fails. If the inversion is successful, multiply the matrix inverse with b, storing the result in the output variable hout. Now call solveforh() in updatepose() with the appropriate arguments; updatepose() should return if solveforh() returns false. 2.4 Get Rotation Matrix and Translation from h (15pts) Next, you will implement the function getrtfromh() in PoseMath.cpp to estimate the rotation and translation from the homography matrix. Once implemented, call getrtfromh() in updatepose(). The input to getrtfromh() is the array of 8 homography values h and the output should be a 3 3 rotation matrix and a 3-element translation vector. In updatepose(), make sure to initialize the latter two variables and pass them into getrtfromh() where they should be populated with the correct values. The output translation vector passed into getrtfromh() by updatepose() should be called position please use this variable, because we already implemented the code that streams this variable to JavaScript. The 8 elements of h have so far only been estimated up to a scale factor s (i.e, we assumed that h 9 = 1). So in getrtfromh(), you want to estimate the scale factor s first, then use that to calculate the translation vector from h 3,6,9 and then estimate the 3 3 rotation matrix from s and h 1,2,4,5,7,8. Make sure that the columns of the rotation matrix are orthogonal and unit length, as discussed in the lecture. 2.5 Convert Rotation Matrix to Quaternion (1pts) Now that we have estimated the 3 3 rotation matrix representing the orientation of the VRduino with respect to the base station, we want to convert it to a rotation quaternion before we stream it via the serial port to the host computer for rendering. For this purpose, implement the function getquaternionfromrotationmatrix() in PoseMath.cpp. Refer to the appendices of this week s course notes for all relevant math. Call the function getquaternionfromrotationmatrix() in updatepose() with the rotation matrix you computed in the previous subsection and write the resulting quaternion into the

variable quaternionhm. Questions? First, Google it! It is a good habit to use the Internet to answer your question. For 99% of all your questions, the answer is easier found online than asking us. If you cannot figure it out this way, post on piazza or come to office hours.