Author Topic: Servo angle and speed question  (Read 3955 times)

0 Members and 1 Guest are viewing this topic.

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Servo angle and speed question
« on: August 03, 2012, 05:10:16 AM »
I am currently working on a robot and in the very early stages.

I am using Webbotlib

I am using modified servo's for this.

What I want to be able to do is send my servo to a specific angle, at a specific speed.

I have this code working very well, and I have encapsulated it in functions to be able send both the angle and speed as a paramater.

What I am doing is something like this pseudo code:

Code: [Select]
servo.connect(); //connect servo
servo.setSpeed(20); //send servo to a certain speed
delay_ms(# of miliseconds calculated to get to that angle at that speed) // go for as long as it will take at that speed to get to desired angle
servo.disconnect(); //stop servo.

It's actually working very nicely, as that is a method and I have more code that does the calcuations for me, so that I just pass in speed and angle.

My concern/question is, I am assuming that as my battery discharges, I will get less voltage to my servo's, which will slow down the servos, and screw up my calculations, hence getting me the wrong angle.

Is there a different way to do this?

Maybe I need a voltage regulator to my servo's, which I am not currently using?

My assumption is that with the modified servo, I lose all feedback capability, so this has to be done programatically.

I would be curious to here peoples opinions on this.

The other thing I was thinking, but not quite sure this could be done, is have something, I don't know what, but something that could read the voltage going into the servo's real time, and feed that into my mcu, and then figure out how that plays into my calculations.




Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: Servo angle and speed question
« Reply #1 on: August 03, 2012, 07:47:18 AM »
By any chance You want to use an encoder, so no matter what voltage You get, servo achieves required velocity.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #2 on: August 03, 2012, 08:11:09 AM »
By any chance You want to use an encoder, so no matter what voltage You get, servo achieves required velocity.

I am pretty new to this, and I don't quite understand what you mean by an encoder in this application.

Is this encoder a  transistor?

Thanks!

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #3 on: August 03, 2012, 10:39:43 AM »
Sounds to me like you've taken a servo, modified it (ie turned it into a motor), and now you want to know how to use a motor as a servo ;D

Think you would be better with an (unmodified) servo - whereby the setSpeed command will cause the servo to move to a fixed location
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #4 on: August 03, 2012, 10:57:19 AM »
Sounds to me like you've taken a servo, modified it (ie turned it into a motor), and now you want to know how to use a motor as a servo ;D

Think you would be better with an (unmodified) servo - whereby the setSpeed command will cause the servo to move to a fixed location

Haha, yes, I suppose that is right.

so here is the question, if you have an unmodified servo, is there anyway to control speed?

Also, I have never worked with unmodified servo's, they only travel in one direction right?

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #5 on: August 03, 2012, 12:35:23 PM »
Quote
if you have an unmodified servo, is there anyway to control speed?
In a word 'No'. Servos are normally instructed to move from position A to position B - their on board controller then tends to ramp up the acceleration and deceleration to get there quickly. By 'modifying' the servo it no longer knows what position it is currently at. So larger changes in position (ie the difference in setSpeed command) will tend to make it turn faster and, since it never thinks it actually gets there, it carries on moving. So the actual speed is often linked to the difference between the previous setSpeed and the new setSpeed. BUT - all servo models work very differently - some have a very flat response ie they are either at rest or they are at full speed. Others are more responsive. It will also vary from one servo to another of the same make/model.

A previous poster mentioned an Encoder. No this is not a transistor - its like a complicated potentiometer - that is used to work out how many degrees the shaft has rotated. Bit like the thing you cut out when you modified the servo !!

Quote
they only travel in one direction right?
. No - if you use the example code generated from WebbotStudio it will turn your servo oner way and then the other way over about a 10 second cycle time.

Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #6 on: August 03, 2012, 01:12:02 PM »
Quote
if you have an unmodified servo, is there anyway to control speed?
In a word 'No'. Servos are normally instructed to move from position A to position B - their on board controller then tends to ramp up the acceleration and deceleration to get there quickly. By 'modifying' the servo it no longer knows what position it is currently at. So larger changes in position (ie the difference in setSpeed command) will tend to make it turn faster and, since it never thinks it actually gets there, it carries on moving. So the actual speed is often linked to the difference between the previous setSpeed and the new setSpeed. BUT - all servo models work very differently - some have a very flat response ie they are either at rest or they are at full speed. Others are more responsive. It will also vary from one servo to another of the same make/model.

A previous poster mentioned an Encoder. No this is not a transistor - its like a complicated potentiometer - that is used to work out how many degrees the shaft has rotated. Bit like the thing you cut out when you modified the servo !!

Quote
they only travel in one direction right?
. No - if you use the example code generated from WebbotStudio it will turn your servo oner way and then the other way over about a 10 second cycle time.


Webbot, thanks.

Since I had no unmodified servo's here, I ran out to radio shack and picked up a parrallax standard servo, and did plug it in using your sample code just before reading this, that is exactly what I found. Interestingly, it seems to go pretty fast for a second or so, seems like to get to a certain position, than very slowly goes back and forth according to your code.

I then was able to get it to go to certain positions in each direction, but as you noted, the speed is consistent and SLOW, at least for this servo.

After reading about encoders, I am not sure that based on price alone, they are something I really want to pursue.

The modified servo (now a motor) is working exactly as I want with the Webbot lib, I am able to very nicely modify speed, and get to a very precise position.

If I could assure the voltage would not drop, and could remain very steady, I would think that would be a viable solution.

My concern is that as the battery discharges, I am quite sure that will mess up everything, or even if the battery is freshly charged, although that could probably be handled nicely with a voltage regulator.

Are there any sensor's that can act like a voltmeter that anyone has used?


Offline jkerns

  • Robot Overlord
  • ****
  • Posts: 270
  • Helpful? 12
Re: Servo angle and speed question
« Reply #7 on: August 03, 2012, 01:24:05 PM »
You could add a potentiometer to the mechanism (just like the servo had) and use that for feedback.

Without feedback, any change in load on the arm, or whatever, will cause you to miss your target position.

The question becomes, can you write a better closed loop control algorithm than the one that came with the servo?
I get paid to play with robots - can't beat that with a stick.

http://www.ltu.edu/engineering/mechanical/bachelor-science-robotics-engineering.asp

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #8 on: August 03, 2012, 01:25:27 PM »
You could add a potentiometer to the mechanism (just like the servo had) and use that for feedback.

Without feedback, any change in load on the arm, or whatever, will cause you to miss your target position.

The question becomes, can you write a better closed loop control algorithm than the one that came with the servo?

I had not thought about that, but I suppose you are exactly right, that is the question.


Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #9 on: August 03, 2012, 01:41:38 PM »
Voltage regulators are also troublesome. An innocent looking servo can consume 1 Amp if you put it under load. Which is the Axon(s) and $50 have an unregulated supply (ie straight from the battery) for servos. The 74'05 regulator on the $50 can only supply 1 Amp max - so you may kill it with just one servo.

Perhaps you could go back to the drawing board and state what you are trying to 'achieve' (rather than saying what hardware you've done/got). Folk may then be able to recommend a better solution to achieve your goal.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #10 on: August 03, 2012, 02:18:06 PM »
Voltage regulators are also troublesome. An innocent looking servo can consume 1 Amp if you put it under load. Which is the Axon(s) and $50 have an unregulated supply (ie straight from the battery) for servos. The 74'05 regulator on the $50 can only supply 1 Amp max - so you may kill it with just one servo.

Perhaps you could go back to the drawing board and state what you are trying to 'achieve' (rather than saying what hardware you've done/got). Folk may then be able to recommend a better solution to achieve your goal.

Makes sense.

I am trying to create a robot that has several (up to 5) DOF, on several "limbs", not  biped limbs, but limbs to be able to do various things like moving, rotating, grabbing, etc..

Any of the DOF's would be required to be able to go to a very specific angle, with very little margin for error on the angle, at very different speeds.

At the moment, I don't plan on using many sensors, more of a mechanical robot than anything. I may add sensors down the road.


Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: Servo angle and speed question
« Reply #11 on: August 03, 2012, 04:31:26 PM »
When servo gets loaded, it tends to "jitter", stepper motors - do not, have You considered them? Using steppers will involve building some control and feedback electronics.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #12 on: August 04, 2012, 07:32:50 AM »
You need to consider the 'load' that the servos/motors will be under. There is a tutorial on this site regarding 'limbs' and the physics/maths involved - don't expect a small Hitec servo to be able to lift anything heavy.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #13 on: August 04, 2012, 09:29:29 AM »
When servo gets loaded, it tends to "jitter", stepper motors - do not, have You considered them? Using steppers will involve building some control and feedback electronics.

I am actually considering steppers. I have read Webbot's and Admin's tutorial on them and they seem very intriguing.

Thanks!

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #14 on: August 04, 2012, 10:06:34 AM »
You need to consider the 'load' that the servos/motors will be under. There is a tutorial on this site regarding 'limbs' and the physics/maths involved - don't expect a small Hitec servo to be able to lift anything heavy.

Thanks, yeah, I have been reading those tutorials and I definitely get that sense.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #15 on: August 04, 2012, 12:43:35 PM »
When servo gets loaded, it tends to "jitter", stepper motors - do not, have You considered them? Using steppers will involve building some control and feedback electronics.

I am actually considering steppers. I have read Webbot's and Admin's tutorial on them and they seem very intriguing.

Thanks!
Steppers are kinda like a motor+encoder ie you tell them when to move to the next 'click' and hence knowing the clicks you know the position. BUT if your motors aren't up to the job/load then you can ask them to move to the next click but they may fail to do so if they can't move the current load. ie they are also subject to slip. Encoders measuring the drive shaft are the only 100% way to know the 'actual' movement. Again - its down to cost/accuracy/load
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Gertlex

  • Supreme Robot
  • *****
  • Posts: 763
  • Helpful? 24
  • Nuclear Engineer ยท Roboticist
    • Index of Oddities
Re: Servo angle and speed question
« Reply #16 on: August 04, 2012, 10:19:28 PM »
For what you seem to have in mind, I would look into digital servos as an option, rather than regular hobby servos.  In particular, Robotis makes the Dynamixel line of servos.  Another manufacturer of similar servos is Kondo.  In fact, such servos are used for the bot that comes to my mind from your description.  The Robotis servos are far more common the US, though.  Webbotlib supports the Dynamixel AX servos, and could easily support the newer MX servos.

These come with a premium of price... but once you start using them, it's hard to accept using hobby servos again :P
I

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #17 on: August 05, 2012, 08:22:09 AM »
The Dynamixel servos IMHO are brilliant. Great torque, you can even modify them into continuous rotation via software and back again, and you can control them all (well up to to about 250 of them!) via a single serial port. But as Gertlex says - they don't come cheap.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline ErikYTopic starter

  • Robot Overlord
  • ****
  • Posts: 186
  • Helpful? 0
Re: Servo angle and speed question
« Reply #18 on: August 05, 2012, 08:35:54 AM »
The Dynamixel servos IMHO are brilliant. Great torque, you can even modify them into continuous rotation via software and back again, and you can control them all (well up to to about 250 of them!) via a single serial port. But as Gertlex says - they don't come cheap.

Guys, thanks! I am going to look into those some more.

Maybe I can carefully combine them with some cheaper servo's to lower the price but get me the functipnality I need.

That is pretty fascinating that you can use software to modify them and back again.

Just out of curiosity, how can you control so many with a serial port? I am assuming you would need to make/buy some type of servo controller?

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Servo angle and speed question
« Reply #19 on: August 05, 2012, 09:49:54 AM »
That is pretty fascinating that you can use software to modify them and back again.
Just out of curiosity, how can you control so many with a serial port? I am assuming you would need to make/buy some type of servo controller?

Nope, you need to add like a 15cent chip to control the serial line but then each servo has its own unique ID. All the servos are on the same serial line and only listen to commands sent with their own ID. Bit like asking 'how do Parcel Force deliver to so many houses with just one truck - answer: each communication instruction (parcel) has the zip code of the recipient'...
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here

data_list