Simple Servo Position Control Program - Is this right?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Location
    Northern Colorado
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Simple Servo Position Control Program - Is this right?

    Not to bring up a dead subject, and I am not sure if anybody is going to have any interest in helping out. But if I am using a code similar to Alain's that he posted above ^^^, how can I slow down the movement of the servo? Basically, the servo goes straight from one point to another. I want to add something that will make it so that rather then jumping from position one to position two and back again that it takes, say 10 seconds, to gradually move from position one to position two. I have an idea in mind to basically have it move from say position 200 to 300 by 1 every .1 seconds so that after 10 seconds it has reached the second position. I would think a counting function or something would work so that it would go
    Code:
    IF I >= 50 THEN
    position=200
    pause 100
    position=201
    pause 100
    position=202
    pause 100
    ...
     ELSE 
      POSITION = 200
     ENDIF
    And if that is what it takes that I need to type out the whole process count down then so be it. But I would think there would be an easier option..

    Application: My problem right now is that there is a 4 inch piece of copper rod on the servo with a ceramic insulator attached to the end of that copper arm. So whenever it moves from position one to position two, the momentum of the mass of the ceramic insulator is causing the servo to overshoot its programmed position. Maybe its a servo issue, but I thought I would start with this.

    Any thoughts or help?
    Last edited by marcusvm; - 28th March 2011 at 04:51.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default Re: Simple Servo Position Control Program - Is this right?

    Simple solution:

    Code:
    For position=start to finish
        pause 100 
        gosub Servo_Control
    Next position
    Ioannis

  3. #3
    Join Date
    Oct 2010
    Location
    Northern Colorado
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Simple Servo Position Control Program - Is this right?

    Ioannis, would you mind explaining that code a little bit to me? I'm a bit of a newbie and haven't dealt with a lot of different code. Is it as simple as copy and pasting in ....

    Code:
    For position=start to finish
        pause 100 
        gosub Servo_Control
    Next position
    Or are there values for start and finish? and is
    Code:
    gosub Servo_Control
    another program loop? If so what for? Sorry if this is a simple code and I am being an idiot.

    Thanks.

    -Marcus

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts