|
View unanswered posts | View active topics
| Author |
Message |
|
giannisapatis
|
Post subject: ASURO: FUNCTION TO TURN; Posted: Wed Feb 27, 2008 9:44 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
|
Hi,
I was wondering if any of you have a function to turn asuro left or right?
I am mostly interested to turn asuro left or right 90 degrees.
Any help appreciated.
Regards,
giannis
|
|
| Top |
|
 |
|
aalt
|
Post subject: Posted: Thu Feb 28, 2008 2:33 pm |
|
Joined: Mon Mar 28, 2005 12:17 pm Posts: 451
|
|
Hello Giannis,
Most simple way is to do this with the program EASY ASURO.
See the ASURO downloads at our homepage.
Good luck!
Aalt
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Thu Feb 28, 2008 8:56 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
aalt wrote: Hello Giannis,
Most simple way is to do this with the program EASY ASURO.
See the ASURO downloads at our homepage.
Good luck!
Aalt
Thanks for the quick response,
I dont see any software called EasyASURO in your download page.
Do you mean Doctor ASURO?
Regards,
Giannis
|
|
| Top |
|
 |
|
SlyD
|
Post subject: Posted: Thu Feb 28, 2008 9:24 pm |
|
Joined: Fri Mar 25, 2005 6:19 pm Posts: 1378 Location: NRW
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Thu Feb 28, 2008 10:07 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
SlyD wrote: Hello Giannis, the info site is currently not translated to english - sorry for that - here the link to the German Version: http://www.arexx.com/arexx.php?cmd=syst ... pro.dat|DE) The Program itself is in English. It is still BETA Release so you may encounter some Bugs. Anyway - if you want to use C - have a look at : http://www.asurowiki.de/pmwiki/pmwiki.phphttp://www.asurowiki.de/pmwiki/pub/html/index.htmlhttp://sourceforge.net/projects/asuroThis is a mixed german / english language project for a more advanced ASURO Library. It has a function "GoTurn" which does exactly what you want. It can move a specific distance and turn by specific angles. Instead of asuro.h and asuro.c you have to change the makefile to use this library. There are several example files included in the download archive of this library. Best regards, SlyD
Sorry about asking again but because these links are in German and there quite a few links, Could you tell me which file to download from these? I downloaded the one from sourceforce but it does not seem to contain any function GoTurn.
Regards,
Giannis
|
|
| Top |
|
 |
|
SlyD
|
Post subject: Posted: Fri Feb 29, 2008 12:33 pm |
|
Joined: Fri Mar 25, 2005 6:19 pm Posts: 1378 Location: NRW
|
|
There are some different files on Sourceforge!
You need AsuroLib 2.7.1!
Then have a look at the examples folder - and at the file "encoder.c".
GoTurn works like
GoTurn(distance, angle, speed)
if distance > 0 it moves for that distance at speed,
else if angle > 0 it rotates by that angle at speed.
I did not try this myself, but it should be fairly easy to use.
Best regards,
SlyD
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Fri Feb 29, 2008 3:12 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
SlyD wrote: There are some different files on Sourceforge! You need AsuroLib 2.7.1!
Then have a look at the examples folder - and at the file "encoder.c".
GoTurn works like GoTurn(distance, angle, speed) if distance > 0 it moves for that distance at speed, else if angle > 0 it rotates by that angle at speed.
I did not try this myself, but it should be fairly easy to use.
Best regards, SlyD
Thanks a lot for your help my friend.
I will test this within a few day and confirm so other users know it as well.
Regards,
giannis
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Fri Feb 29, 2008 3:29 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
|
Hi,
I am having a look now but it seems that there is a file missing from here. myAsuro.h
Regards,
Giannis
|
|
| Top |
|
 |
|
SlyD
|
Post subject: Posted: Fri Feb 29, 2008 5:21 pm |
|
Joined: Fri Mar 25, 2005 6:19 pm Posts: 1378 Location: NRW
|
Did you try to compile the examples? Does that work?
(for example "MotorTest" - there GoTurn is used...)
If it works - copy one of them completely with all files - especially the makefile. (The makefile need to have all the correct paths set up in order to find the files)
Your Computer is dumb and does not know where files are - you need to tell him
Best regards,
SlyD
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Fri Feb 29, 2008 6:06 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
SlyD wrote: Did you try to compile the examples? Does that work? (for example "MotorTest" - there GoTurn is used...) If it works - copy one of them completely with all files - especially the makefile. (The makefile need to have all the correct paths set up in order to find the files) Your Computer is dumb and does not know where files are - you need to tell him Best regards, SlyD
Hi,
Because I am using the old make file, and i have done quite some work now and i dont really want to change it I have put into a file whatever the function GOTurn needs to run. I will clean this file and put it here these days.
My last problem is that I have this code:
Init();
MotorDir(FWD,FWD);
MotorSpeed(140,140);
GoTurn(0,90,120);
MotorSpeed(0,0);
MotorDir(BREAK,BREAK);
return 0;
To me it would seem that according to that code, asuro should turn 90 degrees and then stop executing. But what it does is keep turning forever.
Could this be because it does no exit the GoTurn function?
Would you have any advice on that?
Kind Regards,
Giannis
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Fri Feb 29, 2008 6:26 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
|
Hi again,
It seems that for some reason, asuro never escapes the following while loop inside the GoTurn function:
while (tot_count < enc_count)
{
tot_count += encoder [LEFT];
diff = encoder [LEFT] - encoder [RIGHT];
if (diff > 0)
{ /* Left faster than right */
if ((l_speed > speed) || (r_speed > 244))
l_speed -= 10;
else
r_speed += 10;
}
if (diff < 0)
{ /* Right faster than left */
if ((r_speed > speed) || (l_speed > 244))
r_speed -= 10;
else
l_speed += 10;
}
/* reset encoder */
EncoderSet (0, 0);
MotorSpeed (l_speed, r_speed);
Msleep (1);
}
Hope this may helps.
Regards,
Ioannis
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Fri Feb 29, 2008 8:37 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
|
Hi Again,
After a quick investigation. I attach the loop of the function I was talking before.
while (tot_count < enc_count)
{
tot_count += encoder [LEFT];
diff = encoder [LEFT] - encoder [RIGHT];
if (diff > 0)
{ /* Left faster than right */
if ((l_speed > speed) || (r_speed > 244))
l_speed -= 10;
else
r_speed += 10;
}
if (diff < 0)
{ /* Right faster than left */
if ((r_speed > speed) || (l_speed > 244))
r_speed -= 10;
else
l_speed += 10;
}
/* reset encoder */
EncoderSet (0, 0);
MotorSpeed (l_speed, r_speed);
Msleep (1);
}
As you can see from the code, the control will go out of the loop as soon the tot_count is equal or greater than enc_count. The variable tot_count depends on the encoder [LEFT]. Which encoder [LEFT] is getting reset to 0 at the end of the while loop every time " EncoderSet (0, 0);". From this it seems to me that the variable tot_count will never be equal or greater to enc_count, thus i think this is the reason why asuro keeps turning forever.
Would you have any suggestion on this?
Furthermore, I dont really understand what is the use of encoder [LEFT] and encoder [RIGHT].
Regards,
Giannis
|
|
| Top |
|
 |
|
SlyD
|
Post subject: Posted: Fri Feb 29, 2008 8:48 pm |
|
Joined: Fri Mar 25, 2005 6:19 pm Posts: 1378 Location: NRW
|
Did you call
EncoderInit();
before using this stuff?
I don't think so
Best regards,
SlyD
|
|
| Top |
|
 |
|
giannisapatis
|
Post subject: Posted: Fri Feb 29, 2008 9:02 pm |
|
Joined: Mon Nov 12, 2007 11:09 am Posts: 16
|
SlyD wrote: Did you call EncoderInit(); before using this stuff? I don't think so Best regards, SlyD
Yeah I did call it in the main method, just before I call the function GoTurn.
So i dont think that this is the reason..
Regards,
Giannis
|
|
| Top |
|
 |
|
SlyD
|
Post subject: Posted: Fri Feb 29, 2008 10:03 pm |
|
Joined: Fri Mar 25, 2005 6:19 pm Posts: 1378 Location: NRW
|
|
Uhm - I just noticed that you did not add a infinite loop at the edn - so try adding a
while(true)
{
}
just before the return 0;
I did not see this before but you always have to create a defined END of your Program on a Microcontroller. (in some cases it may restart if you do not do this! This would explain why it does not stop spinning. You should also add more than one movement - this would directly reveal such issues.)
Best regards,
SlyD
|
|
| Top |
|
 |
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
|