Saturday, February 23, 2013

Kinect + Raspberry Pi

I have been trying to get the Kinect to work with Raspberry Pi (attempting to get raw depth data) but still keep on hitting roadblocks. The motor was able to tilt when using libfreenect. As for Open NI, I was able to get it to recognize the kinect but unable to get data from the camera.


Install libraries using this tutorial (use unstable) http://mewgen.com/Ge107_files/20120921%20Setting%20up%20Rasberry%20pi%20for%20the%20Xtion%20and%20kinect.html

alternate link: http://gremsi.blogspot.com/2013/04/installing-openni-sensorkinect-and.html

Status: Recognizes the kinect but cannot transfer data.

General Commands:
compile sample files
~/Desktop/kinect/OpenNI/Platform/Linux/Build $ make

build/install open ni
~/Desktop/kinect/unstable/OpenNI/Platform/Linux/CreateRedist $ sudo ./RedistMaker.Arm
~/Desktop/kinect/unstable/OpenNI/Platform/Linux/Redist $ sudo ./install.sh

Trial and Error

  1. used this site to change usbinterface line in unstable sensor kinect: http://daybydaylinux.blogspot.com/2012/12/how-to-compile-openni-and-sensorkinect.html
    1. cd ~/kinect/SensorKinect/Platform/Linux/Redist/Sensor-Bin-Linux-Arm-v5.1.2.1/Config/

      sudo vi GlobalDefaultsKinect.ini
      modify`;UsbInterface=2` into `UsbInterface=1`
    2. Status: instead of saying usb interface not supported, it says: UpdateData failed: A timeout has occurred when waiting for new data!
  2. Attempt to fix timeout issue: change line in Include/XnTypes.h for data_timeout from 2000 to 20,000 and build open ni
    1. status: changing it to 20seconds and 1 minute and did not work
  3. Was not able to change the FPS for depth because it only supports 15fps (http://openni-discussions.979934.n3.nabble.com/OpenNI-dev-How-to-change-FPS-td2500973.html)

Trace Back: NiSimpleRead

Attempting to trace the problem to see where it occurs.


  1. Samples/NiSimpleRead/NiSimpleRead.cpp
    line 103: context.
    WaitOneUpdateAll(depth)
  2. Include/XnCppWrapper.h
    line 9421: return
    xnWaitOneUpdateAll(...)
  3. Source/OpenNI.cpp
    line 2601:
    xnWaitForCondition(...)
  4. Source/OpenNI.cpp
    line 2552:
    xnOSWaitForCondition(...)
  5. Source/XnOS.cpp
    line 236:
    xnOSWaitEvent(...)
  6. Source/OpenNI/Linux/LinuxEvents.cpp
    line 160: pEvent->Wait(...)


Somehow xnOSWaitEvent is linked with Source/OpenNI/Linux/XnUSBLinux.cpp: xnUSBReadThreadMain. I am assuming its linked because I got an warning (after i set the usb interface to 1): USB events thread - failed to set priority. And this error message originates in the file XnUSBLinux

I'm currently trying to see if data is being transferred at all or if the Kinect is just waiting and not sending data.

Side note: you can change the option to print out the logs for OpenNI in the Data/SampleConfig.xml file.


[Update: 2/24]: Some people had some success with the beagleboard and the kinect:

  http://www.pansenti.com/wordpress/?page_id=1772
  http://instructionalrobotics.blogspot.com/2013/01/kinect-under-beagleboard-c4.html 

[Update: 2/27]:
I updated the file XnUSBLinux.cpp to printout the transfer status. In the xnUSBReadThreadMain method, I added these lines (in bold):

//more code...

else // transfer done
{

if (pBufferInfo->nLastStatus == LIBUSB_TRANSFER_COMPLETED || // read succeeded
pBufferInfo->nLastStatus == LIBUSB_TRANSFER_CANCELLED)   // cancelled, but maybe some data arrived
{
if(pBufferInfo->nLastStatus == LIBUSB_TRANSFER_COMPLETED)
{
printf("***** pBufferInfo->nLastStatus = LIBUSB_TRANSFER_COMPLETED\n");
}
else if(pBufferInfo->nLastStatus == LIBUSB_TRANSFER_CANCELLED)
{
printf("***** pBufferInfo->nLastStatus == LIBUSB_TRANSFER_CANCELLED\n");
}
if (pTransfer->type == LIBUSB_TRANSFER_TYPE_ISOCHRONOUS)
{
XnUInt32 nTotalBytes = 0;
// some packets may return empty, so we need to remove spaces, and make the buffer sequential
for (XnUInt32 i = 0; i < pTransfer->num_iso_packets; ++i)
{
struct libusb_iso_packet_descriptor* pPacket = &pTransfer->iso_packet_desc[i];
if (/*pPacket->status == LIBUSB_TRANSFER_COMPLETED && */pPacket->actual_length != 0)
{
XnUChar* pBuffer = libusb_get_iso_packet_buffer_simple(pTransfer, i);
// if buffer is not at same offset, move it
if (pTransfer->buffer + nTotalBytes != pBuffer)
{
// printf("buffer %d has %d bytes. Moving to offset %d...\n", i, pPacket->actual_length, nTotalBytes);
memmove(pTransfer->buffer + nTotalBytes, pBuffer, pPacket->actual_length);
}
nTotalBytes += pPacket->actual_length;
}
else if (pPacket->status != LIBUSB_TRANSFER_COMPLETED)
{
xnLogWarning(XN_MASK_USB, "2 Endpoint 0x%x, Buffer %d, packet %d Asynch transfer failed (status: %d)", pTransfer->endpoint, pBufferInfo->nBufferID, i, pPacket->status);
}

if(pPacket->status == LIBUSB_TRANSFER_COMPLETED)
{
printf("*****pPacket->status = LIBUSB_TRANSFER_COMPLETED. Length: %d\n", pPacket->actual_length);
}
else if(pPacket->status == LIBUSB_TRANSFER_CANCELLED)
{
printf("*****pPacket->Status = TRANSFER CANCELLED Length: %d\n", pPacket->actual_length);
}
}
if (nTotalBytes != 0)
{
// call callback method
pBufferInfo->pThreadData->pCallbackFunction(pTransfer->buffer, nTotalBytes, pBufferInfo->pThreadData->pCallbackData);
}
}
else
{
// call callback method
pBufferInfo->pThreadData->pCallbackFunction(pTransfer->buffer, pTransfer->actual_length, pBufferInfo->pThreadData->pCallbackData);
}
}
//more code...


After building and installing, I ran ./Sample-NiSimpleRead again. Click here to see the output (the lines that begin with '*****' are my print line statements). 

The main things to focus on are these lines:
*****pPacket->status = LIBUSB_TRANSFER_COMPLETED. Length: 1760 
*****pPacket->status = LIBUSB_TRANSFER_COMPLETED. Length: 1920 
*****pPacket->status = LIBUSB_TRANSFER_COMPLETED. Length: 0

The transfer seems to be completed but the length of the packet is 0. Not sure why this is happening. 

I left Sample-NiSimpleRead running longer, and noticed I was getting data back from the Kinect. The packet would hold 1760 or 1920 bytes at a time. (the log file has been updated with the new log)

[Update 3/29]
Unfortunately, I wasn't able to get it working with the Kinect. I am currently looking into other options. 

  • Asus Xtion + Raspberry Pi: I was able to get frames back from an Asus Xtion.
  • Kinect + Beagle Board (or Panda Board): I haven't had the chance to try this out but in theory since this is a little more powerful than the RPi, it could work with the kinect. 
I am currently working on getting and compressing the depth images using OpenNI. See OpenNI + Depth Compression



Amy Cuddy: Your body language shapes who you are


Friday, December 14, 2012

Assassins: A Real World Game That Uses NFC



Project Links Github

#of Team Members: 4


This project description was written by the whole team. “Assassins” is a live-action "killer" game. Players try to eliminate each other from the game using mock weapons in an effort to become the last surviving player. Currently, players must eliminate their target in person and report their success to a webpage online or to a game administrator in person; this reporting system is tedious and relies heavily on an honor system. In our solution, each player will be assigned a target when the game begins. The assassin (a player with a target) will need to eliminate the target inconspicuously. The target’s phone will report its location randomly throughout the day. If the target notices the assassin first, he will be able to bump phones with the assassin to create a “timeout” period where the assassin will not be able to eliminate the target. However, if the assassin successfully locates the target without getting noticed, he will be able to bump phones to eliminate the target. These scenarios will be dependent on an honor system of who is noticed first. Assassin When the game begins, the assassin (who is also a target, as everyone playing has an assigned assassin and an assigned target) receives a notification with the name of their target. At random intervals throughout the day, they receive updates on the location of their target. They also are notified of their target’s location whenever their target “kills” their own target. When they successfully “kill” their target using whatever rules have been agreed upon, they then bump phones with the target, and the app registers the kill. The assassin’s assigned killer is also notified of the assassin’s location, and the assassin is given a new target. Target The target will use the application if he notices the assassin before getting eliminated. He will bump phones with the assassin, while the app is open, and initiate the transfer. This will create a “timeout” period where the assassin cannot eliminate the target for a set amount of time. We plan to use the Android SDK to build the game and NFC technology to share data between users. Location services such as Google Maps will also be used to display targets and other information. Google Cloud Messaging might be used if we need push notifications from servers to users.


Medical Viewer for Emory


Project Links
Github

# of Team Members: 5



This was my senior design project; we worked with emory to create a tablet app that lets doctors and nurses monitor patient data and annotate this data. It uses a variety of technologies and the goal is to make the application as easy to use while still showing all essential data.

Project Documents
Project Documentation/Description
This project documentation/description was written by the whole team.


Monday, October 15, 2012

MRS: Mobile Response System


Project Links

# of Team Members: 4




This project description was written by the whole team.

Our project is designed to be a complete replacement for the current Student Response System provided by TurningPoint.  The turning point system requires students to purchase a $50 ‘clicker’ device or purchase a 3 month subscription to their mobile service (the semester is 3.5 months long), which is not optimum for students who are already being hit with tuition and fee increases virtually every semester.  Additionally, professors and TAs have complained about the software that comes with TurningPoint for managing sessions and collecting student responses; it has caused issues with some classes’ gradebooks in the past and has generally been very unreliable.    

The solution to this is a web-based, GTMob plugin that will make use of location services when available and alternate location-detection when not available that will allow students to effectively “bring their own device” as a personal response device.  We also plan to allow professors to upload a gradebook CSV file from Sakai, which will then be populated with the student’s PRS scores.  This file can then be downloaded from our tool on GTMob and reuploaded to Sakai, importing grades.   

Friday, May 4, 2012

CourseBuzz






















A web and mobile application that provides a clean interface to Georgia Tech's course lookup system. It also combines information from three different webpages and displays them in one page. 

CourseBuzz first started out as an Android application that scrapes data from different pages in Oscar and displays it to the student in a clean interface. The source code has support to display notifications from a server using C2DM (deprecated). The website does the same thing but does not support notifications.



Heads up! The android app has been removed from Google Play due to issues with the scraper. You can visit CourseShark for the the seat watcher function. The website is still up and running and will work for Spring 2013.


There are a few limitations for this application. First, the user will not be able to register for a class or have the application register for that class as soon as an open spot is available. Second, schedules of classes of past semesters and future semesters will not be available. Storing schedules from the past is unnecessary because the user will only need alerts for that current registration period.

Project Documents

Saturday, April 14, 2012

Pad: a simple notepad


Project Links

Pad provides a new and simple way to jot down notes. There are no tabs, pages, ads, clutter, and etc. It's only one page that auto saves as you type.

Pad started off as a simple android application that lets you jot down your thoughts easily. Pad+ has widget support and a holo interface. Dropbox support will come soon.   

The website leverages HTML5 offline storage to store the notes. There are a few bugs with it so don't expect it to work completely!