Search This Blog

Friday, 1 July 2016

ControlJEL - The journey of my first research project

ControlJEL is a command interface made by me for my university on a research project, it's designed to command and control a JEL SCARA robot with three numerically commanded axis.
The JEL robot having just three commanded axis, wasn't that hard at start, these axis where: Z translation, rotation around the base and translation of the effector. Combining all these you can build a cylinder.

The challenge is how to command such an old robot with so low knowledge about it's communication capabilities and working states.

I had only few lines that I know to send to the robot using RS232 Serial communication (an antique way of communication used in older computers, a standard in industry still, being replaced by USB, I will detail more about this in another blog post), with these few lines I had to make the robot move how I want in this 'cylinder'.

Started by writing a simple command interface using my previous work in Love2D for a robot I made for a contest (a line follower contest, where you could command the robot using bluetooth), with this I made the communication possible and got going the interface development.

I had only few hours of testing on the real robot and then I had to do all work at home, writing code that might not work on the real robot was a real pain, but It's all I had but it was worth it, only few tweaks and things were going well.

The interface starts with a connect phase, where you choose what port to use to connect on (where the robot is supposed to be), I've also included a virtual mode using V-REP by using localhost TCP socket.

After you get the interface connected to the robot, you can start to command every axis how you want and get things you want done, you can record the movement (using recorded points) and then play it again.

In between the computer and robot are two major components, one of which we can remove. There is an Arduino Uno controller and the robot controller, we use the Arduino to get a bluetooth link going between the computer and robot as I proposed to myself to make (I will talk more about radio links using Bluetooth in a future post). We can remove Arduino and connect directly to robot's controller using RS232, but in future, we want to remove robot's controller and make our own controller based on Arduino or something similar to command the motors how we want, without having to use JEL's protocol.

JEL's protocol, the tricky part. The most annoying thing I had to work with is the protocol used in the communication between JEL and a computer. The computer sends commands using a prefix '$1' for talking to the 'first' controller of the JEL arhitecture, after this prefix you'll get the command you want to send, for example, to get the current position on axis 1, you need to send '$101', the '01' being the command for getting position of the axis and '1' is the axis number. The very low documented protocol that I had to work with didn't explain anything about $1 or anything else, I've learned more by reverse engineering their software that didn't command motors directly, just uploaded or downloaded the points from the robot, this set me back with few steps, didn't help me at all, more confusion than progress. After a while, I figured a way to get what I want from the robot, using lot of workarounds.

After doing all the communication and getting the interface better, I've decided to give a try to the wonderful world of virtual worlds, or in short virtualization. I started using V-REP (a special software for virtualizing any type of robot that you can imagine on this world, I will make a full post in future about this). V-REP is awesome and it uses my favourite language, Lua (what can be better?), also I can use LuaSockets (TCP and UDP the easiest way possible). I got the 1:1 3D model of the JEL robot on the software and started adding the axis controls while writing the code, it took a while to get going something but it was worth the try, in few hours I got the robot working as it does in the real world (even better..). I didn't know its the most important part of my project while making it, I took it as a side challenge from the sweat taken from communicating with the real controller. The only thing I had to copy from the real controller was the annoying protocol... heh.. but I got it working as I wanted, because was my territory, I could've done anything I want to make it work.

I didn't get the virtual going just in V-REP, I was going to implement it directly to the interface in realtime with the robot or virtual robot. Got the model imported in my interface and added controls for it. Was fun to learn more about 3D programming by directly working with it for my interface.

After all this, the presentation was closer than I expected, I had only two weeks to write my power point presentation (I hate to make power point presentations to be honest, I will try my best to replace power point with something better, if you have a suggestion, hit me!). Done, power point presentation was done, but.. I've got to make now a document to publish in a book about my project, but after doing reverse engineering, making things that nobody had an idea how to make it work, I've got it all going!

Presented the interface that I've been working for the past one-two months, it was all nice, until I had to go back home and get my laptop in the most fast possible way, waiting for the bus and praying (I'm not a religious person at all, but it 'appears' it worked this time, no, I won't change ;-P) to get it faster. Got the laptop and waited my turn, I was nervous, it was the first time I ever presented something to university teachers, but for me, it wasn't the first time I presented something to a large public (20-30 persons for me is a large public and adding the value of professors, it adds up to 50-60 >:P). Got it all nice with a help of a college, I was tired after a night I haven't sleep because I had to help someone and myself to make projects done until the day of the presentation.

A week after all this, I've got the news that I received first place on this research projects, being on first year of college.

This was a part of my journey on making ControlJEL, an interface for JEL SCARA Robot, that I've been developing for a research project for my college. It doesn't end here as I need to get new challenges completed for this project, like making Arduino control the robot directly, Internet remote control and more!

I hope you did like my post about the journey I had, it was a real pleasure to work with all this people and do researching, it was like a hobby, I'm a big hobbyist so it was really fun! I hope to get more research projects to work on, currently I work on making a robot to play Chess with a human player (more information soon), it can even be JEL doing it! (we'll never know, well.. actually, we will know in few weeks).

PS: I did not talk about all I've done on this project, it would probably take a book or two to write ;-)