Lib4U

‎"Behind every stack of books there is a flood of knowledge."

Autonomous Robotic Car using Kinect (with source)

kinect_2.jpg.scaled1000

Kinect is one of the greatest inventions of our life-time. If you havent tried it yet, you are missing the taste of future. It is revolutionizing the technical innovations and is the biggest thing since the iphone, maybe bigger.

 

Foradian is experimenting with Kinect to build futuristic application like virtual shopping. We are also building a cool virtual UI for Project Fedena similar to the ones you see in hollywood films. Keep tuned to the updates. 

Story of Kinect

Kinect was launched in on November 4, 2010 and Kinect holds the Guinness World Record of being the “fastest selling consumer electronics device”. Even though Kinect was meant to use with XBox, the hacking community started reverse engineering the drivers and published opensource drivers within weeks of launch of Kinect. You can read more about Kinect at http://en.wikipedia.org/wiki/Kinect

How Kinect works

 

Kinect is based on software technology developed internally by Rare, a subsidiary of Microsoft Game Studios owned by Microsoft, and on range camera technology by Israeli developer PrimeSense, which interprets 3D scene information from a continuously-projected infrared structured light. This 3D scanner system called Light Coding employs a variant of image-based 3D reconstruction. 

 

The beauty of Kinect is in its simplicity of depth detection. If you are an electronics student/engineer have a look at their patent document. http://www.freepatentsonline.com/20100118123.pdf 

Kinect Hacks

With the availability of opensource drivers, hackers around the world started experimenting on Kinect, which caused a kinect hack revolution. You can also download the drivers and start hacking Kinect from http://openkinect.org

You can get more hacks at http://www.kinecthacks.com/. Dont forget to see their list of Top 10 Kinect hacks – http://www.kinecthacks.com/top-10-best-kinect-hacks/

Our robotic car hack

It all started with the blog post by Brad Templeton “Where will 3-D cameras like Kinect lead?“. There was a already Kinect hack in youtube which demonstrated an autonomous robotic car.

Team Violator contacted its creators, but there was no response. So Team Violator with the help of Srihari (Internet Engineer – Foradian) built a quick hack using a Kinect and OpenKinect drivers. The aim was to study the use of Kinect as a depth detector for indoor uses. Entire thing was built on two to three days.

 

 1 of 4

 

Limitations

  • It wont work outdoor
  • Area of movement of the car depends on the length of power/data cable of the kinect (Can be improved with a wifi hack or Carrying Laptop along with the Kinect on top of the car with DC power)

Tools used

  • PC running Ubuntu 10.04
  • Openkinect drivers
  • RC Car
  • Kinect
  • Breadboard
  • Transistors switch electronics

How to clone the hack

Difficulty level: High

You should have system level knowledge on linux. You should know how to compile a custom C program using “cmake” utilities. Also information on i/o programming and some electronics knowledge on switching circuits using transistors.

Warning: This is a quick and dirty hack which can damage your PC and other things around you. We are not responsible for any damages. Do it at your own risk.

Our suggestion: If you have plenty of time available, we suggest you to use a good electronic prototyping hardware like “Adruino”. We used a dirty hack of parallel port, since there was some issue with interface using USB and it needed more time.

Here we go. We strongly suggest you to play with the glview functionality of the openkinect library before you begin step4.

Step1: Buy Kinect Hardware with all the interfacing cables

Step2: Buy an RC car, which has the ability to carry a Kinect on its top. Preferably a laptop too, incase you plan to improvise the hack.

 

 

Step3: Reverse engineer the RC car and its control system. Remove the cover of the remote control of the RC Car. Study how it works. We need to interface this remote control with the PC which process the depth data using kinect. There are various ways to do this. We used the parallel port available in the PC and used the data pins to control the remote control and thereby controlling the car. The main controls are “steer-left”, “steer-right”, “start”, “stop”. We can forget the other controls for the moment. Our aim is to build a car, which thinks on its own. An awakened machine 🙂 

Step4: Install Parapin Library in the PC (Ubuntu).

How to install – http://parapin.cvs.sourceforge.net/viewvc/parapin/parapin/INSTALL

About parapin library – http://parapin.sourceforge.net/doc/parapin.html

Why the parapin Library ? We first wanted to do a laptop mounted car, so that it will have good coverage and it is more flexible. But the I/O program using USB to Parallel/Serial converters are a bit tricky and demanded more time and research. So we decided to go for the classic parallel cable communication to save time.

Step5: Hack ! Download the freenect library from github –https://github.com/OpenKinect/libfreenect .

We modified the glview.c in the examples directory to suit our need.

We also need to compile this file with parapin library headers. Modify the cmake file to do this. (Line No. 54)

 

1
target_link_libraries(glview freenect ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB} parapin )

 

Modifications in glview.c

For locating the obstacle , we divide the screen into three areas(Left,Center,Right).The following function returns which area a particular point is in:

1234
int find_area_index(int x_cordinate){
int x_offset = x_cordinate%FREENECT_FRAME_W; return x_offset/(FREENECT_FRAME_W/3);
}
view rawglview.cThis Gist brought to you by GitHub.

 

Now in the glview main loop , we locate the area with minimum obstacle :

123456789101112131415
int min_index=0;
for(i=0;i<3;i++)
if(area_sums[i] < area_sums[min_index])
min_index = i;
int j;
printf(“Minimum at %d\n”,min_index);
if(pin_is_set(LP_PIN[min_index+2])){
//do nothing
}
else{
for(j=0;j<5;j++)
clear_pin(LP_PIN[j]);
set_pin(LP_PIN[min_index+2]);
}
view rawglview.cThis Gist brought to you by GitHub.

 

Download the modified CMakeLists.txt file

Download the modified glview.c file

Step6 : Compile the modified program, you can find the compiled executable in the examples directory itself.You will need to run it as a superuser for accesing the usb devices.

Step7: Connect the parallel port cable to the remote. Port number 2,3 and 4. You can test the port numbers using an LED.

Step8: Powerup the remote control and switch on the car. Your car will have its own life.

Happy hacking. If you have any doubt, you can leave it as comment below.

Future of this hack

We have no plans to improvise this hack since more powerful hacks are available as opensource from the ROS user community. See the video given below.

The Kinect is mounted on a quadrotor and used for closed-loop altitude control and basic obstacle avoidance. You can make a similar one using the instructions available here –Quadrotor Altitude Control and Obstacle Avoidance

 

 

This hack was part of the Driverless car project done by Divya R Pillai, Arun Asok, Varun K, Arun Ramesh and Aparna Rajeevan. They have successfully completed the project. If you want to do internship at foradian, contact us via join@foradian.com

Source:

http://blog.foradian.com/autonomous-robotic-car-using-kinect-with-sour

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Virtual Fashion Technology

Virtual Fashion Education

toitocuaanhem

"chúng tôi chỉ là tôi tớ của anh em, vì Đức Kitô" (2Cr 4,5b)

VentureBeat

News About Tech, Money and Innovation

digitalerr0r

Modern art using the GPU

Theme Showcase

Find the perfect theme for your blog.

lsuvietnam

Learn to Learn

Gocomay's Blog

Con tằm đến thác vẫn còn vương tơ

Toán cho Vật lý

Khoa Vật lý, Đại học Sư phạm Tp.HCM - ĐT :(08)-38352020 - 109

Maths 4 Physics & more...

Blog Toán Cao Cấp (M4Ps)

Bucket List Publications

Indulge- Travel, Adventure, & New Experiences

Lib4U

‎"Behind every stack of books there is a flood of knowledge."

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

%d bloggers like this: