Author Topic: axon + servo question  (Read 2838 times)

0 Members and 1 Guest are viewing this topic.

Offline E.MkTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
axon + servo question
« on: February 25, 2010, 08:40:49 PM »
Hello everyone,

I'm a new guy on these forums.  First off, I'm glad there's a site such as this with as many tutorials and a forum for robots.


I've done a fair amount of research - including searching the forum about how to control a servo with the axon as well as read the servo_control.c file.  I believe I understand the basics of it, but have a few more.

To keep it simple, let's say I write the following calls in a loop;

Code: [Select]
servo(PORTA, 7, 700);
delay_ms(20);

this moves the servo(unmodified HS-311) go to 0 degrees, and then it starts to twitch for as long as the command keeps getting sent.

I thought if a servo continuously got same high pulse followed by 20m of low pulse, the servo would move to its desired position and stay there.

If I stop sending the command, obviously, the servo stops twitching.

It feels like the command I'm sending the servo isn't somewhere where it can move and stop moving, it'll keep twitching, as if the position I specified is in-between two points or something.

Is there some basic servo rule that I am forgetting?


Thanks in advance!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,704
  • Helpful? 173
    • Society of Robots
Re: axon + servo question
« Reply #1 on: February 26, 2010, 04:23:50 AM »
servo twitching is caused by many things:

electrical noise - anything else happening?
counter torque applied to the servo - whats the servo for?
a poorly timed signal - other servos being used? have a delay of at 20ms before the next pulse?

That said, I recommend using WebbotLib. My original Axon code is outdated ;D

Offline E.MkTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: axon + servo question
« Reply #2 on: February 26, 2010, 06:51:51 AM »
Hey Admin,

Thanks for the speedy response.

Right now, the servo has no load, as I'm trying to get the gist of controlling one servo and nothing else(I'm trying to get my feet wet before jumping in)

Webbotlib, huh.  Okay, I'll give that a try.  I've seen that being thrown around, but thought it was for Axon II since the Axon tutorial didn't mention it.  I wanted to make sure I got the basics(as outlined in the tutorial) working with the Axon before trying something new.

Thanks

Offline GWER57

  • Full Member
  • ***
  • Posts: 65
  • Helpful? 2
Re: axon + servo question
« Reply #3 on: February 26, 2010, 07:27:58 AM »
The pulse has to happen once every 20 ms but if you delay for 20 ms it is happening less than that often
(the pulses are once every 20 + servopulse ms apart)

try shortenting the delay length by just a little (~1) ms so that the pulse happens exactly every 20 ms(or slightly more often).
The reason it is twitching is that after 20 ms of no pulse the servo will leave its position.
GTW

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,704
  • Helpful? 173
    • Society of Robots
Re: axon + servo question
« Reply #4 on: February 26, 2010, 08:27:57 AM »
Keep in mind that every servo is different - even if they have the same model number. A timing that works great for one servo may not work for another.

El-cheapo servos will often twitch much more due to el-cheapo components inside. *Some* twitch is considered normal, whereas heavy twitching could result in your servo frying itself.

Offline E.MkTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: axon + servo question
« Reply #5 on: February 26, 2010, 10:53:01 AM »
The pulse has to happen once every 20 ms but if you delay for 20 ms it is happening less than that often
(the pulses are once every 20 + servopulse ms apart)

try shortenting the delay length by just a little (~1) ms so that the pulse happens exactly every 20 ms(or slightly more often).
The reason it is twitching is that after 20 ms of no pulse the servo will leave its position.

y'know, I totally overlooked that - I calculated the number of cycles pass to servo function and then waited 20ms delay afterwards...

but if you keep telling the servo to move to 0 degrees, should the servo twitch after getting there?

Offline E.MkTopic starter

  • Jr. Member
  • **
  • Posts: 15
  • Helpful? 0
Re: axon + servo question
« Reply #6 on: February 26, 2010, 11:06:00 AM »
Keep in mind that every servo is different - even if they have the same model number. A timing that works great for one servo may not work for another.

El-cheapo servos will often twitch much more due to el-cheapo components inside. *Some* twitch is considered normal, whereas heavy twitching could result in your servo frying itself.

boy... there are a lot of factors to consider... so I expanded the software so I can change the cycle value for the servo function, but I'm going back to my original question... if I specified the angle that the servo should go to, and I keep providing the pulse sequence, the servo should move and stop when it gets there without any twitching, correct?


later I'll try using the webbotlib and see if that yields better results.

My expectations of a servo is that when specified an angle, it'll move to it or stop if it's already there. 

Am I wrong in believing that the position should constantly be fed into the servo, so that if horn tries to rotate to a different angle, the servo should re-orient itself?

Offline KurtEck

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 12
Re: axon + servo question
« Reply #7 on: February 26, 2010, 11:15:45 AM »
Hi, there are several that can give a better answer here, but I will try.

As for twitching it depends on the servos.  If are outputting a consistent pulse every 20ms I have not had that much twitching.  You may get a little as there may be a little slop (either mechanical or electrical) in the servo and they may react slightly different...

If you are using analog servos, than you need to output the pulses every 20ms (more or less) or the servo will lose power and not stay at the location you want.  It is sometimes beneficial to be able to stop outputting servo pulses, especially if you have your robot at a rest location and you are trying to save on battery usage.

However if you are using digital servos it is a whole different ball game.  That is you can tell a digital servo to go to some location once and it will stay there until you tell it to go someplace else.  With many of these servos like a hitec HS-5645... I have not found any way to turn them off... Some you can (HSR-...)

Good luck

Kurt

 

SMF spam blocked by CleanTalk