| View previous topic :: View next topic |
| Author |
Message |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Mon Oct 23, 2006 12:46 am Post subject: Encoder support |
|
|
Hi all, I am just wrapping up my quadrature encoder modification for OpenServo, and want to know if the features described below are adequate, or am I missing an obvious mode...
MODE_CONTINUOUS
The servo is modified for continuous rotation, and the encoder is used exclusively to track servo rotation and velocity.
MODE_COMPLIMENTARY
The servo is used as normal, but the encoder input compliments the potentiometer input to gain higher accuracy.
MODE_EXCLUSIVE
The encoder is used on an unmodified servo, the potentiometer input is disabled.
When I get the source fully tested, I am going to embed my optoelectronics into the servo chassis. I will keep you all updated as to my progress.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
linuxguy
Joined: 16 Oct 2006 Posts: 120 Location: Beaverton, OR
|
Posted: Mon Oct 23, 2006 4:20 am Post subject: Re: Encoder support |
|
|
| "ginge" wrote: | MODE_CONTINUOUS
The servo is modified for continuous rotation, and the encoder is used exclusively to track servo rotation and velocity. |
I could use this feature now, in my little rover robot, as well as some of the other Open Servo features like current sense. I can't tell when its motors are stalled now and it gets hung up on objects too low for its IRPD to detect. I would love to put a couple of Hitec HS-422CD (already modified for continuous rotation) with an Open Servo board into this robot.
Right now, I am considering a Nubotics Wheel Watcher 01 for this robot to accomplish this task.
8-Dale _________________ No, Mr. Jobs, the BiPod is a ROBOT. It does not play music OR interface with iTunes.
The Dynaplex Network - Robotics, Open Source, Linux, and Technology Forums |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Wed Oct 25, 2006 6:53 pm Post subject: |
|
|
I just ran up against a small problem whist testing the continuous rotation mode... Travel distance.
Assumptions:
max distance using current position scheme: 0xFFFF (65535)
wheel diameter: 3cm
encoder resolution: 1024 ticks/revolution
so:-
3 x PI for wheel distance/revolution = 9.425cm
crunching the numbers you get a maximum distance of 603cm
This is limiting my robot to motions of 6 metres at a time.
There is a way out of this, but I don't see it as an elegant solution. The only way I can get a longer distance is to write a new position to the servo, which clears the encoder count, and starts again. I say this is a bad way of doing it as it still adds additional contstraints on the controller making sure it has a valid position, and calculating distance already travelled.
I have a couple of ideas for solutions:
1) Have another 2 position registers for a total precision of 32bits. This is pretty much guaranteed not to overflow (unless you are moving in the 4million metres range)
2) create a single new register that stores the number of full length movements (6m) to perform before using the 16 bit position values. This acts as a simple multiplier.
Any comments would be appreciated.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
linuxguy
Joined: 16 Oct 2006 Posts: 120 Location: Beaverton, OR
|
Posted: Thu Oct 26, 2006 12:20 am Post subject: |
|
|
| "ginge" wrote: | | There is a way out of this, but I don't see it as an elegant solution. The only way I can get a longer distance is to write a new position to the servo, which clears the encoder count, and starts again. I say this is a bad way of doing it as it still adds additional contstraints on the controller making sure it has a valid position, and calculating distance already travelled. |
While it would be nice to have my robot just keep moving until something happens to require changing that, I don't see it as a requirement. As long as my controller can process such things as movement in the background while other things are being done in the forground, I don't see any problems.
The only problem is with microcontrollers that can't do background and foreground processing at the same time. For those, periodic movement commands would have to be given to the servo. I have to do this now with my current microcontroller, so am used to this method of programming. But then, my robot is an indoor robot and I can see where an outdoor robot might have issues with this.
Each time a movement command is going to be issued, I would read the approriate values and accumulate any results I needed to keep totals on. I would not expect the servo to be responsible for keeping my robot moving indefinitely.
| "ginge" wrote: | I have a couple of ideas for solutions:
1) Have another 2 position registers for a total precision of 32bits. This is pretty much guaranteed not to overflow (unless you are moving in the 4million metres range) |
I like this scheme better if it doesn't tax current storage requirements in the servo. I'd prefer to see one large counter with full resolution. Wouldn't this be assuming all microcontrollers can process 32 bit precision numbers and would it be true?
| "ginge" wrote: | | 2) create a single new register that stores the number of full length movements (6m) to perform before using the 16 bit position values. This acts as a simple multiplier. |
What happens if we don't want / need to move in full 6m increments? Will we program a partial plus a number of whole 6m increments to move?
8-Dale _________________ No, Mr. Jobs, the BiPod is a ROBOT. It does not play music OR interface with iTunes.
The Dynaplex Network - Robotics, Open Source, Linux, and Technology Forums |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Thu Oct 26, 2006 7:53 am Post subject: |
|
|
I forgot to omit there is a mode for continuous rotation. With works by sending a go/ stop signal to the servo. WHile this mode is fine for applications that dont need to go certain distances and then stop, I feel it's not in the spirit of ""set the position and forget"".
A friend of mine who is going to be using these encoders is going to need to move the bot in 10-12m lengths, which is how this issue came up.
| "linuxguy" wrote: | | I like this scheme better if it doesn't tax current storage requirements in the servo. I'd prefer to see one large counter with full resolution. Wouldn't this be assuming all microcontrollers can process 32 bit precision numbers and would it be true? |
Yeah, it's not a problem for any microcontroller, as long as it's handled properly. It does add some complexity and processing overhead, however.
| "linuxguy" wrote: |
What happens if we don't want / need to move in full 6m increments? Will we program a partial plus a number of whole 6m increments to move? |
say you want to move 601cm...
You program 0x1 into the distance register, and then 1cm into the position register.
I don't really like this idea though.
Am I being overly concerned with something that the host controller should probably handle, or is there a genuine need for the extended distance support?
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
linuxguy
Joined: 16 Oct 2006 Posts: 120 Location: Beaverton, OR
|
Posted: Fri Oct 27, 2006 12:53 pm Post subject: |
|
|
| "ginge" wrote: | | Am I being overly concerned with something that the host controller should probably handle, or is there a genuine need for the extended distance support? |
I think the host controller needs to be aware of the hardware, be programmed appropriately, and needs to take care of handling distance support. The servo just needs to provide status information to the host and do what the host tells it to do within it's parameters.
The host needs to have control over motion for the most part. Right now, my servos only go a certain distance when I tell them to go, and they are continuous rotation. I keep them moving within my processing loop and it works just fine.
Position (or at least number of rotations or fraction of) information is useful for continuous rotation servos for distance measurment - like what the Nubotics Wheel Watchers do. Host gets current position from servo, gives motion command, gets position again, and calculates distance traveled.
I would love to have the equivalent of a Nubotics Wheel Watcher inside an Open Servo! What you are doing now may be exactly that.
Servo = peripheral. Host = master control. I would not want my printer changing my printout without me having given it specific commands to do so.
This is just my take on things from a user's point of view.
8-Dale _________________ No, Mr. Jobs, the BiPod is a ROBOT. It does not play music OR interface with iTunes.
The Dynaplex Network - Robotics, Open Source, Linux, and Technology Forums |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Fri Oct 27, 2006 3:43 pm Post subject: |
|
|
Okay, I see where you are going with this...
As with all OpenServo functions, the encoder values, and rotation count are exposed through a register. You can use the host controller to do the grunt work.
| "linuxguy" wrote: | | Servo = peripheral. Host = master control. I would not want my printer changing my printout without me having given it specific commands to do so. |
No, as you quite rightly say, you wouldn't. You would, however want the printer to receive the whole page to be printed, and then the controller inside the printer takes care of the rest. Imagine if the PC controlled every part of the printer, including having to send a ""drop ink"" command every 0.001us. You have to draw the line somewhere, and I am trying to figure out where that line is.
This is how I would like the motors to work. You set a distance, and then monitor it from the host controller. If it starts to go awry, update the motors.
I think the idea of the servo managing it's own travel distance is reasonable, and don't think it's unreasonable to leave that feature there.
I will investigate how the Wheel Watcher does the job, and emulate similar functionality. Thanks for the heads up on that.
Cheers,
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
linuxguy
Joined: 16 Oct 2006 Posts: 120 Location: Beaverton, OR
|
Posted: Fri Oct 27, 2006 4:06 pm Post subject: |
|
|
| "ginge" wrote: | Okay, I see where you are going with this...
As with all OpenServo functions, the encoder values, and rotation count are exposed through a register. You can use the host controller to do the grunt work. |
This works perfect for me. I will have the flexibility of controlling things totally from the host if I want to or need to.
| "ginge" wrote: | | This is how I would like the motors to work. You set a distance, and then monitor it from the host controller. If it starts to go awry, update the motors. |
This is exactly what I have been saying, even if I didn't say it well. It's what I meant.
| "ginge" wrote: | | I think the idea of the servo managing it's own travel distance is reasonable, and don't think it's unreasonable to leave that feature there. |
It's a cool feature, for sure. It's fine as long as I have the option of taking more control at the host if I want to.
| "ginge" wrote: | | I will investigate how the Wheel Watcher does the job, and emulate similar functionality. Thanks for the heads up on that. |
It's a cool product and they have a Wheel Commander that goes along with it if you want total closed loop motion control (and don't use Open Servos). It's a little expensive for my budget though.
Next month, I am getting two new Hitec HSR-1422CR servos from Lynxmotion to replace the servos in my robot, and would love to go Open Servo with them.
8-Dale _________________ No, Mr. Jobs, the BiPod is a ROBOT. It does not play music OR interface with iTunes.
The Dynaplex Network - Robotics, Open Source, Linux, and Technology Forums |
|
| Back to top |
|
 |
ggpipe
Joined: 10 Apr 2007 Posts: 2
|
Posted: Thu Apr 12, 2007 2:38 pm Post subject: Status |
|
|
What is the status on the encoder support? I am really interested in this too. I would like to use open servo boards to drive a couple small continous rotation servo motors with encoders.
Thanks,
Glenn _________________ Glenn |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Thu Apr 12, 2007 2:43 pm Post subject: |
|
|
Hi,
At the time of writing those posts there was a less than enthusiastic response for the idea.
It does look as though the idea is gaining traction again, so I will pick up where I left off.
There is a little work that needs to be done to get things working smoothly, but it is possible.
One word of warning though, the OpenServo loses a lot of pulses at fast speeds. You have to make sure you have an encoder with a fairly low resolution output to get things working smoothly.
I will pick this up in the next few days and let you know where I am at with this.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
linuxguy
Joined: 16 Oct 2006 Posts: 120 Location: Beaverton, OR
|
Posted: Thu Apr 12, 2007 6:22 pm Post subject: Re: Encoder support |
|
|
| ginge wrote: | | Hi all, I am just wrapping up my quadrature encoder modification for OpenServo, and want to know if the features described below are adequate, or am I missing an obvious mode... |
Wonderful! I am looking forward to being able to use this feature on my robots.
| ginge wrote: | MODE_CONTINUOUS
The servo is modified for continuous rotation, and the encoder is used exclusively to track servo rotation and velocity. |
This looks good!
| ginge wrote: | MODE_COMPLIMENTARY
The servo is used as normal, but the encoder input compliments the potentiometer input to gain higher accuracy. |
Being new to motors and encoders, I am not sure I understand this usage. Being able to get the highest accuracy is great, of course, but is this the normal usage for an encoder? Maybe MODE_NORMAL or MODE_STANDARD would be a better description if this is indeed how encoders are normally used.
| ginge wrote: | MODE_EXCLUSIVE
The encoder is used on an unmodified servo, the potentiometer input is disabled. |
Would this mean that an external encoder could be used with the Open Servo board with an unmodifed servo? I ask because I just got my Lynxmotion order with two GHM-04 motors and a pair of QME-01 quadrature encoders for them. I am just jumping in with both feet, a total newbie to motors and encoders. I hope I don't blow anything up when I try connecting everything up the first time.
| ginge wrote: | | When I get the source fully tested, I am going to embed my optoelectronics into the servo chassis. I will keep you all updated as to my progress. |
You are doing great work, as is everyone else on Open Servo, and I think this feature will be much used. I know I will be using it and am very glad you have been working on it.
8-Dale _________________ No, Mr. Jobs, the BiPod is a ROBOT. It does not play music OR interface with iTunes.
The Dynaplex Network - Robotics, Open Source, Linux, and Technology Forums |
|
| Back to top |
|
 |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Fri Apr 13, 2007 6:28 am Post subject: |
|
|
I've been working for the last few weeks to build a balancing robot and I'm using a board that utilizes the LS7366 chip from LSI which is a 32-bit Quadrature Counter with SPI Serial Interface. Because it implements the quadrature counting in hardware it can work at very high RPMs without missing a beat. It seems to be a bit hard to get ahold of, but I'm told that you can get them through Gemini Electronic Components if you call them. Like Dale, I'm using the GHM-04 motors and a pair of QME-01 encoders in my 'bot.
The chip is connected through a PIC so I don't have experience working with it directly (I'm an AVR guy), but it looks like it would be trivial to connect to an AVR either through the SPI pins or bit-banging on some spare IO pins.
Once I get through building this 'bot and another OpenServo related project I would be interested in helping to support this or a similar quadrature chip in the OpenServo. I'm not as enthusiastic about implementing quadrature counting in the AVR itself for the issues Barry pointed out. I think this is a case of using the right tool for the right job.
I do have a question. I'm assuming that support for a quadrature encoder would not necessarily mean supporting the same PCB form factor as the current OpenServo. Correct?
-Mike |
|
| Back to top |
|
 |
linuxguy
Joined: 16 Oct 2006 Posts: 120 Location: Beaverton, OR
|
Posted: Fri Apr 13, 2007 7:52 am Post subject: |
|
|
| ginge wrote: | | One word of warning though, the OpenServo loses a lot of pulses at fast speeds. You have to make sure you have an encoder with a fairly low resolution output to get things working smoothly. |
Is this due to the microcontroller being too slow to catch all the pulses?
8-Dale _________________ No, Mr. Jobs, the BiPod is a ROBOT. It does not play music OR interface with iTunes.
The Dynaplex Network - Robotics, Open Source, Linux, and Technology Forums |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Fri Apr 13, 2007 7:53 am Post subject: |
|
|
I like that chip, although the SPI does put me off a little. It does mean that some pins that are previously allocated to the headers need to be reassigned to the SPI interface. In theory it would be possible to bit-bang the device using a different set of unused IO, but this would add latencies that would make the quadrature encoder values be several us (ms) out of date.
As Mike has mentioned, I am not overly enthusiastic about incorporating the interrupt counters directly into the OpenServo, as it is just too slow. The only workaround I can see is to use something like the LS7366 or a small attiny45 which does the pulse tracking and provides a serial interface. This is the route I went down to test my rig, and it works fairly well. I put the whole project onto the back burner while I considered latency options. Having another chip in the loop introduces another layer of comms that need to be dealt with. For example, the test rig with the attiny on it introduced a latency between the the host and the slave in the order of 8ms. This doesn't seem like a lot, but when you are talking fast moving motors and quick transition times, it is practically a huge amount of time.
| mpthompson wrote: | | I do have a question. I'm assuming that support for a quadrature encoder would not necessarily mean supporting the same PCB form factor as the current OpenServo. Correct? |
For the most part, yes. I don't use the micro servos that some of you guys have, so I had a little room to embed my encoders in the servo, as well as shoehorn the counter chip into the cavity above the pot. I doubt you would have this luxury.
For something that should be trivial, it certainly is not.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
ginge Site Admin
Joined: 14 Jan 2006 Posts: 1027 Location: Manchester, UK
|
Posted: Fri Apr 13, 2007 7:58 am Post subject: |
|
|
| linuxguy wrote: | | ginge wrote: | | One word of warning though, the OpenServo loses a lot of pulses at fast speeds. You have to make sure you have an encoder with a fairly low resolution output to get things working smoothly. |
Is this due to the microcontroller being too slow to catch all the pulses?
8-Dale |
You managed to slip this one in before I got mine in, so I nearly missed you
Yes, the AVR is pretty much taxed with the TWI and motion control routines. The Encoder generates fron hundreds to thousands of pulses per revolution in a phased output. Although you can use the external interrupt timer to track this, a bit of software jiggery pokery needs to be done to catch the direction and calculate velocity. This leaves very little power left in the poor OpenServo so it starts to miss the pulses.
See my post above for more info.
Barry _________________ http://www.headfuzz.co.uk/
http://www.robotfuzz.co.uk/ |
|
| Back to top |
|
 |
|
|
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 vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|