Thursday, July 10, 2008

The Rubik's cube Solver bot

Rubik’s Cube Solving Robot ki kahani, project team members ki zubani! :)

Members of the project team : -

patty, amal, sathe

Narrated by Amaleshwar : -

We had planned out a proper training on robotics during our summer vacations. Thanx to pranav bhai, we got a chance at PARI ( Precision Automation and Robotics India Ltd.) We had no idea what exactly would we be doing at PARI. We had heard that they are basically an industrial robotics firm, with no relation with the grid navigators and obstacle avoiders we had been doing all this time. So, we thought that we might have a tough time competing with 3rd yrs. We, the IITians, had some pride of being IITians! And, this thing was at stake. But, still, the tempo was high, we had decided to learn something or the other! Whatever they would teach us, we would somehow or the other gobble up and learn something useful. With this mindset, pranav bhai approached the training-in-charge.

Then came the twist in the story. The man, named N. R .Kulkarni, or better known among us as Kulkarni, told us that our dreams cannot be fulfilled! i.e. They would not accept little facchas as trainees! L

And, to add to that, he was simply not ready to entertain 3 first years’ physical presence at the PARI campus. So…………hence……………..we were feeling the heat of our shattered dreams! L

But, kahaani mein twist hai mere dost….. he asked pranav to get an efficient algorithm to solve the most famed and mysterious puzzle in the world….. The Rubik’s Cube.

At that time… I was in Hyderabad. Literally makhaing with nothing to do.

That day, in the evening… pranav bhai called me up and told me about the disastrous chat he had with Mr.Kulkarni.

Here goes the conversation

Pranav: - Abe, woh rubik’s cube ke upar koi efficient algo dhoondne ko bola hai.

Amaleshwar: - Kaun sa cube????? Kuchh suna hua types lag raha hai.

Pranav: - Abe rubik’s cube! Maine bhi aaj hi suna hai! Who 3X3X3 ka hota hai na… har individual color ko ek unique side dena rehta hai.

Amaleshwar: - Abe teri! Haan yaad aya! Arre haan, aisa kuchh hota hai. Abe!!! Yeh kya diya hai??? Kuchh biped quadraped nahi mila kya usko? Yeh kya utha ke diya hai woh?

Pranav: - Kya karein yaar! Woh jo bola hai wohi karna padega! Apan decide nahi kar sakte hain apna project!

Amaleshwar : - Bhak!

And then, started the series of messaging controversies. Mr.Pushkar Sathe, or rather Sathe, was a quite a halu listener. We decided that I will do some fight maring at hyd, and pranav will do some along with sathe.

But, I think meri kismet kharab thi! Akele karne mein itna frustapa hoga yeh upar wala bhi nahi jaanta tha! L

Now, pranav continues with the narration : -

Pehle 3 din toh barbad the………..soch soch ke dimag ka lassi ho gaya tha, Dahi toh mamuli chiz hai!! J

Fourth day pe kucch kuchh samaz aa raha tha……..wen I was Trying to get how we change the positions of minicubes @ sathe’s house!!........

And WOW……………..i could place the First corner piece as per given in algo on my own after 3 days!!!!!!!!!(After huha Frustapa)

Uske baad bahot sara Fight marne ke baad……………FINALLY I SOLVED THE FIRST RUBIK’S CUBE IN MY LIFE @ 20th MAY 2008 ,4.30PM………….. JJJJJ

On the day after the next, I was supposed to call NRK but………..on 21st my Grandpa xpired……………..so I was unable to continue with d project 4 the time being!!!!..............Meanwhile………Amaleshwar

Was Fight maring on Algos……………..

Ya.one more thing to write……….beech me ek bar sathe ke pehchan ke ek prof the….who was teaching Maths in IITB few yrs ago!!.....Sathe was interested more in getting the Maths behind the cube(I was saying …………sale cube nahi ban raha hai……….maths ke peeche pada hai…….Fukka lagega maths me jindagi bhar)…….but we removed dat thought after following xplanation By Mr.prof

“You can find the 6 determinants for ‘every combination’ of the cube……..and in order to get the final solved cube you can perform determinant operations on that!!.............”

Funda toh accha tha but how does it look after hearing this

“ There are 43 billion combinations of this Damn Cube”

Now sathe was saying--- maths gaya bhad me…pehle cube banate hai!!!!!!!

Same case with me!! J

Finally after 8-10 days of frustapa………..we have got a decent enough human compatible algo to solve the cube!!!...I was gathering Courage 2 tell this to Mr.Kulkarni…………

!!

On 28th May i called NRK and told this to him…………..his reaction was “OK..thik hai”

I was saying –sale, itna fight marke algo laya hai…….kucch toh ‘gud’ ya ‘accha’ types bol

Now AMAL will continue------

To chalo bhai log.. continue karte hain… algo ke bare mein pranav ne bataya NRK ko… usne sirf “OK” keh ke use frust kiya. Uske baad, bot ke mech design ke bare mein fone pe hi bataya! Which was virtually impossible to be understood, even if u r AIR 1! So…. Pranav bhai halu ho ke dekh rahe the…. Jo samajh aya… mujhe bata diya…..aur mujhe aur bhi halu kar diya!! Kya karein bhai…..and… meanwhile sathe bhai peace mar rahe the…. Happy insaan!

Then, we decided to make the simulator and do some coding, in VB as said by NRK. But….. problems never end! We, little chaps having just one semester of experience in programming, were supposed to program an entire gigantic algorithm for a rubik’s cube, which was virtually impossible to implement even 50% of it manually!!

But…. Darne ki kya baat hai….. tempo jab saath hai!!!!

Now, I reached pune on 7th June, with just enough experience to solve the first layer of the cube. And, by that time, pranav had barely managed to solve the entire cube on his own. And, with this much experience… hum kuchh raahi… chal pade algorithm cracking ki raah par. Tab tak decide ho gaya ki kya karna hai kaise karna hai…………

Fir…. Arre bhai, load ana kabhi kam hota hai kya???? Tab tak sathe bhai hawa ho gaye! Dikh hi nahi rahe pune mein! Baad mein pata chala ki ghumne gaya hua tha. Aur, fir pranav bhai ke java classes waalon ne aur bhi load de diya. Timings badha diya… aur time kam ho gaya humare paas!

Lekin… fir bhi….hausla banaye rakha humne! :-D

Then, we started on our first day…. Built the simulator by coding around 670 lines. And, it was working perfectly! We were too happy with our first achievement in this project.

Then….. there came day… when I was all alone at home.. With nothing to do! Coding was impossible alone! I had to just sleep around! Huha frust hua tha bhai!!!

Fir…. That frustapa had a solution. Sathe came back from his tour.

Fir… shuru hua ek naya karyakram. Roz subah pranav java classes se pehle mujhe sathe ke ghar pe drop kar deta tha…. Aur fir aate waqt le jata tha…. Jaise bache ko crèche mein daal deta ho… aur fir le jata ho! :-D

By that time….we had cracked the first layer. Then.. the second layer was somehow completed alongwith sathe. Then, the third layer was cracked at night the next day at pranav’s house. But, it took 2-3 days to increase the efficiency of the algorithm.

Everything was going perfectly……..fir achanak sathe ko brainwave…. Nahi……… brainTsunami aya ki use bhi java class join karna chahiye. Fir to main huhaa ulti masto fundooo frust ho gaya! L

Ab kya karun??? I tried my best to convince sathe not to join the class…. But sathe to sathe raha… join kar hi liya…

Waise, meri kismet achhi thi ki tab tak coding ka kaam khatm tha. Aur, PARI ka mech design ka kaam poora nahi tha. So, we decided to meet NRK and find out the final solution to this problem. We met him on 12th evening…. Our first visit to the PARI campus. And, we were literally HALU at the campus…. After having a look at the big huha types machinery.

Till then, we had coded enough to show NRK the first two layers coded.

After waiting for abt half an hour, we met him…. And again………. NRK toh NRK thehra.. humari baatein thodi na suni usne! Woh to bhaiya…….hey bhagwaan! Kaise kahun!!! ….. woh to…. Humari kuchh na sun ke humein ulta funda dene laga mech design ka. Lekin, humne dhairya rakha…… funda suna uska… 75% funda kaan se filter hokar alag ho gaya… aur jo 25% useful tha… bas wahi register hua! J

When, we tried to show him our hardwork… he just appreciated our attitude that we have the confidence that this problem can be solved. That’s it! No appreciation for the hard work we had put in all these days.

We asked him if we could keep this project on hold for a few days, so that we could start work once pranav’s and sathe’s java classes are over. He agreed to that. Whew! Some relief at last!

So, I happily left for home…… but, by that time I discovered one algo, better known as speed cubing algorithm, by Lars Petrus, which took 30% less steps than the conventional layer-by-layer algo. So, we thought…. That when I come to pune for the second time, we can build up an entirely new code, based on the speed cubing algorithm. So, at home… fight maring on the speed cubing method continued.. and pranav and sathe were happily getting frust with their java classes! ( when I came to pune, I found this! ;-) )

Then…. I came back to pune on the 1st of july.

Now. Pranav bhai continues-----

Our algo was not 100% perfect…………beech me sala atkta tha kucch kucch cases pe!!!

After few Hrs of tiresome and Frustrating work we found out where the load was!!!..............second layer….ya Third layer……….or both!!.......ek toh cube solve karne ke liye our code was taking more than 150 steps……sumtimes it crossed the magic figures like 250!!! J………

So we Decided to say ‘Tata-ByeBye’ to this code and Start with new Speed Cubing algo!!!

Whoosh………actually this wasn’t much frustrating at first few moves as we were now familiar with the cube……………but as it went further………….Frustapa and Frustapa and Frustapa!!!! Nolthing Else…..

You can imagine wat our state wud be if we were supposed to handle 72 cases just for placing 3 Edges on the cube!!.............uff!!

But we handled the case with patience and intelligence!! Yes…….our coding for the 2*2*3 cube was ready and it was taking just 30-40 steps!!...wich was quite a big achievement for us!!

The whole day we were thinking of The cube , cube and Cube………..nothing else…..

And to add to our frustration beech beech me the code wich performed perfectly right a few hrs b4….started giving ERROR after few hrs!!!!!!!!’

That damn second layer was dreally a big Frustrating thing!!

We Worked Almost whole day on this second layer!!!.........We tried everything!!................

Amal found a Mathematical algo wich was really huha types!!!.........we programmed it with high tempo and waited for the result!!

But when we tried it on our simulator……………don ask the result!!!

Kucch Kucch Errors de raha tha sala!!............kucch ajib hi ho raha tha!!

Just too much for us to debug……………

Once again Amal thought a new Recursive Algo……and we decided to try dat one!!

We were used to errors………..main frust hoke lappy ka screen dekh raha tha…and Amal pressed “SOLVE” on the screen……………………..and suddenly……I saw the cube with its two Layers solved………The “ abe sala………….HUHA” sound broke the silence in the room!!!!!!!! Yes we have cracked the two layers with speed cubing…………....... There was nothing like that “machau feeling” at that time! J

Now we moved on to the Third layer………..which we thought to be very simple but in the end wich turned out the most difficult thing to deal with!!!

Now Amal will Continue-----

Hmm… the third layer. Was supposedly quite simple when we had done it last time with the layer by layer algo. Then, came a time when perfection is replaced by bare completion. This time, our task was to make this algo perfect! Humne pichhli baar jo program banaya tha sala kuchh kuchh cases mein seriously huha types error de raha tha! Humein to laga ki yahi agar submit kiya to NRK utha utha ke maarega. Fir..ab apne ko perfection lane ka tha. Isme, bhaiya perfection haasil karne ki koshish karo to load aana hi hai.

We directly used the previous function based on our older algorithm. But…. It gave errors still!!! And, the error was not a simple one. It made the program enter an infinite loop. We tried out the debugging. We didn’t find a single problem in the code. We still tried on for several hours………… in the end we found one case of the rubik’s cube which was quite tough to implement mathematically. We tried out all possible methods to solve it for the entire day, but, fruitlessly. I doubted whether it was mathematically possible to solve it. So, I constructed a software to find it out. And…. I found it mathematically impossible. Then… believe this or not….. apne pranav bhaiya ko tempo types aa gaya… fir isi code mein kuchh kuchh kuchh kuchh kuchh kuchh kiya………… aur fir woh SOLVE KARNE LAGA!!!!!!!!! Just imagine! Something mathematically impossible ko bana diya possible… without even knowing it. Aaj bhi humein nahi pata hai ki pranav ne usmein kya kiya hai jo woh kaam karne laga hai. And needless to say, pranav bhai ko bhi nahi pata hai!

Ab…….. jahan tak program ka sawal hai….. program to bindas peacefully kaam kar raha tha. Humne bana liya yeh program, with an estimated 30% reduction in the no. of steps. Fir bhaiyaa…. Kaise kahein…. Har case solve kar raha tha yeh zalim program. Khushi ke leher man mein daudne lage…

Aisa feel hua jaise hum duniya ke be-taaj badhshaah ho gaye! :-D

Fir….. shaam huyi… pranav ne puchha “abe, yeh jo steps ka list nikalta hai, isko dobara laga ke dekhte hain, aakhir yeh solve karta hai ya nahi”

We tried that……………and again….. shattered dreams production ltd………… it wasn’t working!!!! L

What the hellll?????? The program was solving the rubik’s cube according to the simulator. But, the steps which it gave out couldn’t do that??? Is that a joke? I was deeply shocked!!! Pranav had similar feelings too. We started out debugging at around 5 pm. Now, just imagine…. Searching for this bug in a 5,500 line program………… which is literally HUGE!!! But, still we moved on. And, after 3 hrs of pain, we found out the bug! And woah, it was working after fixing the bug.!!! And then…. Suddenly pranav and I shouted out “yaayyyyyyy!!!” loud enough to be heard 5 houses away! Just imagine our happiness. And………. I rang up home to tell this achievement of ours! J

Then….. comes the peace maring time. We have completed the project. It has ended well. And, as the saying goes, All’s well that ends well. And, now the final presentation to Mr.Kulkarni. We have to show them the entire thing.

Lekin ,sawal fir se man mein aane lage. Humne kaafi complexities mein algorithms ko code kiya hai. 4 algos combine kar ke yeh banaya hai. Fir, poora algo chamakne mein humein ek mahine types lag gaya, to bhala yeh kulkarni ek ghante mein kya ukhad lega?

Sochna pada kaafi kuchh. Dimaag mein confusion jama raha. Fir, plan kiya ki sirf working dikhayenge, algo samjhana gaya bhaad mein. Fir, working etc. sab document kar liya, cam pics kaise lega who bhi likh dala. Fir, parallel port pe fight chali, jispe hum teeno failure the! :-D

Uske baad, humne final soch liya, thoda sa documentation le jaayenge, ki is software ka working kya hai, aur iska mechanical steps mein break down kaise hoga. Bas!!

Fir, who din aya, jab kulkarni ke saath meeting hua. PARI campus pohonche.

Kulkarni ne kaha ki woh ek senior software engineer ko bulaya hai, jisko explain karenge iska working etc.

Fir, meeting chala achha khaasa 1 hr ka. Jispe humein aascharya tha ki kulkarni ne itna time humein kaise de diya! Kaafi kuchh explanation hua, working dikhaya. Explain kar kar ke main aur pranav huha types frust ho gaye.

Now, comes the good part, kulkarni sahib ne kaha… “Great!!”

Woh “great!” humare dilon ko chhu gaya…. Literally!

Humari mehnat rang laayi!

Humne kuchh kar dikhaya finally! J

yO!

Fir….. certi ki baat huyi, and he was ready to give a certi to us. But, stipend ki baat nahi ki L

Khair, jo bhi ho, 1st yr mein stipend expect bhi nahi kar raha tha! :-P

Anyways, us shaam ko camp area mein ghuma……aur raat ko train pakad ke hyd ke liye kat liya!

We became a happier team altogether!

Wednesday, May 7, 2008

For all those who like travelling..........

How many of you have ever said that "I like travelling!!"??? Well, i would like to engage you in a debate. Don't mind buddy, i m writing this blog in a very frustrated mood!

So, here goes, today i write this blog on 7th may, 2008. And, seriously speaking, i have been travelling far and wide for the last 8 days, i.e. since 30th April. Firstly, as an intro, i would like to tell you that going home from college is sometimes damn hectic! especially when you are 1500 kms away, and the train takes more than 24hrs! i.e. kgp to hyd.

This time , my parents advised me to head for my paternal hometown, i.e. muzaffarpur, some 100 km north of patna. Now, therez no direct train from kgp. So, a break journey was the only option. So, decided to go from Calcutta. But, on the last day, i changed my plans, and had to go through Jamshedpur. On 30th April, I left kgp, for a short 2 hr journey alongwith another friend of mine, for jamshedpur. Then, in the evening we caught a train locally called the tata-chhapra express. Now, for your kind information, which i didn't know, it passes through the most infamous route of thieves! i.e. this route has the largest no. of theft records in the east. And, we had 2 laptops!!! the most easily targetted item! So, we planned not to sleep. We spent the entire night staying awake on a seemingly never-ending 14 hr journey! And, slept only once we reached home.


The very next day, we had to leave for my maternal uncle's house in patna. This was another nightmare. In this process, we had to cross the country's longest bridge spanning more than 4.5 km across the river Ganga. And, this bridge had a traffic jam which made us 6 hrs late!! We had to walk half the bridge carrying all the luggage.

The next day, we returned, and had another hectic journey of 3 hrs in a rather shaky government bus. By this time, i was exhausted by the journeys.

Then, fortunately, God blessed me and i had a day off!! No journey on one single day! yO! i was so happy!!!!

But, the next day we had to leave for home.

Now, I wonder if God was angry with me, or whatever, but there was no direct train again!! :((
So, had a break-journey through Calcutta.

And, journeying through 3 trains, changing at Calcutta and Vijayawada, i reached home after 48 hrs!!!

And woah! i am almost dried up! nothing left in me!

Thats all i wanted to say!! Thanx a lot for reading this much!! :)

Saturday, April 5, 2008

A meeting with the founder.

At about 11 mithilesh called up saying that Aneesh reddy will visit the TRS Lab. As said, the whole first year team reached in time to meet the man. Till now i had only heard about him. We heard "unhone bohot fight mara hai TRS ke liye" and all such stuff. But, we could never feel the presence of the man. This day came, and he was seen in person. He was a bit shorter than i had expected. He was looking at the lab as if it was just his own child! He knew every nook and corner of it!

But, there were levels of disappointment in him. He was the founder of TRS. Only he knew the motive behind the founding. Till now, we have concentrated on the improvement of the robotics fest i.e. ROBOTIX. He asked us first years what we felt about the robotix event. Palkush answered that it was a good first experience with such a large fest. That was what everyone of us echoed in our minds. But, Aneesh wasn't so happy with that. He appeared slightly disappointed. I wondered why! Then questions started coming into my mind. Why was the robotix event initiated? Why was TRS founded by him? Why was the TRS lab established? Why??

Aneesh then opened up what was going on. He explained his emotions in a rather diplomatic sense that robotix was not established as a fest. It was established to be something more than what a fest is. He said that TRS is supposed to improve the robotics fraternity among the general people. ( as far as i could decipher from what he said). He said that we have given enough attention towards the participation. Now how much do we increase the no. of participants? In 2008 there were 3000! How much do we increase the participation? We are already larger than all robofests in the country. How much do we increase? what statistics do we want to obtain? What aim are we heading for?


He asked to concentrate on KRAIG more than ROBOTIX now.
A few days ago akash had conveyed
"Hum jab bhi chaahein, 1000 teams kgp mein khada kar sakte hain. Ab humein event ke quality pe dhyan dena chahiye."
I think what aneesh and akash said are quite similarly oriented. Both need a more technological development rather than managerial development.

He referred to product launches. KRAIG can launch robotics products! These will bring KRAIG into the limelight!
I believe there are ideas in each and everyone of us. We can incorporate those ideas.


Amal

Sunday, February 24, 2008

ROBOTIX 2008

Well, a lot has been said about the event, so therez little i can say.

Here i am to express my views on what i saw and what i felt ever since i joined the team.
When i joined the team, i was a completely halu chap. i dint know what we'll be doing. we members were supposed to be a team, but i never saw the team spirit among us as seen in the sub-heads and heads. but now, after my first robotix, i feel that we really ARE a team! the real sense of team spirit grasped us during the event!

Similar to what samar said, i used to feel quite distant from the heads and the co-ordis were like gods looking over us... but now , i feel we are really in a team!



today, when i recall what i have done during the event.......... its all about shouting at and managing the junta waiting for their turn at tr,about fighting to get the team t-shirts at cal, about desperately attempting to seal the leakage in the tr arena, about getting frust at the help desk by answering the question "Terra Ranger mein kaun se team ka run chal raha hai??" more than 40 times continuously, about directing the junta to the ktj control tent for questions like "paper soap kahan milega?", "Mera dost kho gaya hai, aap use dhoond sakte ho kya??" and "when will the cryptology event start??", about telling the highly expecting junta that the registration for rocketry is over at kalidas, about having the samosas, chhedi burgers and tikka chowmein, which we relished a lot,about cycling from shantanu to kanchan and patel to RK......... and the list never ends!


as for what sassy said on the last day, i think he has done the right thing..........when the younger brother does something wrong, the elder brother scolds him, i guess we have a similar situation here. I feel we can rectify all our mistakes wherever we went wrong.!



ROBOTIX KA TEMPO HIGH HAI!!!!!!!!!!!!!!