Wednesday, 21 November 2012

How i learnt threading in python

Today is one of the awesome day so far. I did no work at office! Then what did i do from 10am to 9.30pm ? It was all the fun stuff. I played with lego nxt robot. Yesterday we converted humanoid robo to car like robo so that it can easily move on wheels. Using android phones paired to nxt robo, i played like a kid playing with his lovely toy!

    I was supposed to program lego, so I searched for knowing how to. Finally, I decided for Nxt-python. Though i had written few thousands of lines of java code so far, python is new to me. I studied the sensor's behavior to know how to make use of it. The toy robot has an ultrasonic sensor to detect obstacles, couple of touch sensors - one at front and other at back- to detect accidents with any wall or things. A pair of servo motors attached to wheels to give movement. They all worked, but it was not proper. When i rotate servo motors to move front, back, left, right i was not able to read sensors at the same time to sense objects.

    I was frustrated, i wanted to read sensors and rotate motors at the same time! I got an idea. I  created individual threads for each sensor and then a separate thread to move motors. I faced new problem, that is synchronizing. When a servo motor thread is turning motors and if touch sensor detect an accident my program was crashing because of lack of synchronization.
 
    I let the robo to travel all over office. Ultrasonic sensor detects obstacles, servo motors to move and change direction of motion. Programming a toy robo in python and uploading it over Bluetooth, it was really fun thing for me to do. Wish somebody should have given me a toy robo when i started to learn programming.

Sunday, 18 November 2012

Remembering my college days

An holiday. Relaxed... traveled to chikkaballapur sitting in back seat of my brother's vehicle. Returned back in public transportation bus. It is the same bus that i was using during my college days. It is the same last row window seat that i was more happy to sit. Exactly, this was how my college days were. Sometimes when i get very comfortable free time, my past memories attack me like a flood.

Monday, 12 November 2012

Police love my bike as i love overspeed

   Got a total of 145KM bike ride today! From Nandhi Hills to office in the morning and in the evening, back to home for Diwali celebrations for tomorrow. Day began with awesome mood, but somewhere in the middle of journey to office, Bangalore Traffic police stopped me for over speed and billed a fine of 200Rs. I remember, its 3rd time paying fine to them in past 2 months.

Sunday, 11 November 2012

Nov 11 2012 : Hello World

    I don't know why, I am here today in blogger!. I thought i am missing something in my daily routine. It is: not writing down what i do. 
    Today is an holiday. By the time wall clock showed 11.30am, my eyes said me that it is too much sleep for watching 3 movies back-to-back last night. Finally  my mind came out of  'The Matrix' series of movies and said me that i got enough sleep to work hard for next week!. So continued my readings, read half of 'dive into python' book. Being a  hardcore java programmer, i liked the book. Its so straight forward. And guess what, I started loving python. 
   By late evening, decided to have some fun with python on N9, and i did. Found out something is missing in N9.  Installed Inception to N9, then proceeded to Busybox-power. Then still something was missing. Created a launcher icon for python console. when i click on it, it should directly launch terminal emulator in a new window and it should run python console inside it. Python console came handy on N9.