BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 9:25 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Verifying command complete
PostPosted: Thu Sep 29, 2011 1:44 pm 
Offline
Guru

Joined: Mon Apr 19, 2010 9:13 am
Posts: 63
Is there an easier (more resource friendly) way to verify that a move has been completed with the roboclaw? Currently, I issue the command, then loop continuously waiting for the buffer to decrease to 0. I could be doing other things while waiting for the command to complete. In this application it could be many seconds to minutes for a command to complete. The below works, but I could be interfacing the operator, controlling another motor, watching my EOT switches! etc.

I'm running motor 2 in this example. Motor 1 is a don't care.
Code:
   TRAVERSELOOP
      'READ BUFFER DEPTH
      R1COMMAND = 47
      HSEROUT [R1ADDRESS, R1COMMAND]
      HSERIN [R1BUFFER1, R1BUFFER2, R1CRC]
      PAUSE 1
      'WAIT FOR MOTION COMMAND TO COMPLETE
      IF R1BUFFER2 <> 0 THEN TRAVERSELOOP   


My random thought for the day is some kind of state machine. I would still read the buffer depth, only, I would be reading it in the main program, not the subroutine. When it went to 0, i would return to the subroutine with the next stage of movement, based on what the previous movement was. This way everything else remains operational, but it's still just a buffer reading loop.

_________________
Studio 2.0.0.16 on Win 7 Home x64 updated daily - Original Roboclaw 5A V1.3.9
Mostly a Nano40 for prototyping, but I have others in my bins


Top
 Profile  
 
 Post subject: Re: Verifying command complete
PostPosted: Tue Oct 04, 2011 11:23 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Basically thats how you would do it(eg statemachine). You could also setup a timer based interrupt to check it in the background. The roboclaw will not initiate communications. You must always ask. This was because we knew our devices will be used with many low powered micros that can't deal with an asyncronous system that replies with data without being asked for it(any device that only can use software based serial for example). Those devices that can handle async communications(ones with buffered hardware serial) usually have enough power to implement there own interrupts to check for status of the roboclaw. On low power devices statemachines are pretty much mandatory for performance.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Verifying command complete
PostPosted: Tue Oct 04, 2011 4:15 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Any thought to having a configurable bit to allow the RoboClaw to initiate messages for "higher level" control uP?

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Verifying command complete
PostPosted: Wed Oct 05, 2011 6:55 am 
Offline
Guru

Joined: Mon Apr 19, 2010 9:13 am
Posts: 63
Once again, thanks for the response. I had (still am) to gut most of a big program to implement the state machine, but I think all will turn out decent. I'm still working with the nano40, and I can see a wall coming in regards to speed. Good thing there's a 40x now!

_________________
Studio 2.0.0.16 on Win 7 Home x64 updated daily - Original Roboclaw 5A V1.3.9
Mostly a Nano40 for prototyping, but I have others in my bins


Top
 Profile  
 
 Post subject: Re: Verifying command complete
PostPosted: Wed Oct 05, 2011 10:28 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
There are some plans to add some more functionality to the Roboclaw. I'll keep this in mind once I get to working on those plans.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


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

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO