I know I haven't posted in a few weeks but that doesn't mean I haven't been work on the project. To make up for that I am going to do two in quick succession now!
The first thing that I have been doing is getting the Arduino talking to MATLAB, which was harder than it may first seem. Initially MATLAB couldn't even recognise the Arduino UNO but for some strange reason it could recognise the Duemilanove so...? But I eventually realised that if I specified the port and board type then it would recognise it. I then quickly worked out servos and moved on to the actual programming of the robot whereupon I found an issue.
The issue was that if I set one servo going then the other servo going, paused then turned them both back off again, the robot drifted. This was because although the amount of time between each command being run is tiny, it is still noticeable between one servo beginning and the other. The result was its final position was about half a centimetre to the left or right depending on which way round I put the commands.
The first though that popped into my mind was 'parallel processing' as MATLAB is built off C in which it is relatively easy to just start a new thread or two and it just works. I was initially discouraged due to the fact that I discovered something called the "Parallel computing toolbox" which, although I didn't do too much research as to what it contained, sounded like exactly what I needed; the only problem was that it costed money. So I messed around a bit with the program tried having the code in separate functions or in for loops anything to at least lessen the drift a bit if not completely remove it. However in my research I came across a function which is in the main area of matlab called parfor. I added this to my program and I think I can see a difference...
One thing I think that I may need to do is somehow add a function called parpool which creates workers but whenever I add it in the wheels just spin in opposite directions forever so I don't really know how to fix that.
More posts will follow soon
Thanks
Alexander Nathanail
Top Comments
-
DAB
-
Cancel
-
Vote Up
+1
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Comment-
DAB
-
Cancel
-
Vote Up
+1
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Children