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.
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.