Shop OBEX P1 Docs P2 Docs Learn Events
Coordinated Servo Control — Parallax Forums

Coordinated Servo Control

whitelancerwhitelancer Posts: 23
edited 2006-07-19 15:34 in General Discussion
To anyone that can help,

I am trying to coordinate the movements of a fish robot through five servo motors.

However, I am running into several problems. I attached two programs and I am working on the straight swimming motion. Everything else is a variation of the swimming straight motion. The program moves the fins forward and horizontal, delays .3 seconds, and then moves them to the rear at an angled position. The tail motor simply moves back and forth.

What needs to happen is that the side fins need to move with a slow speed to the rear and then rotate to a horizontal position fast to go to the front. When the side fins are up front the tail fins should be in the center and when the side fins are in the rear the tail fin should alternate to being on the left and right side.

The following link is to the micro servo controller that talks about speed commands (Page 7) as seen in the attached programs.
http://www.pololu.com/products/pololu/0207/ssc03a_guide.pdf ·

I am wondering if the coordinated fins could be accomplished simply through guess and check speed settings (which has proved difficult) or if there is a better more computer savvy method that you can help with. Also I was wondering if there is a better method than absolute position commands.

Thank you for any help.
Sincerely,
Jon

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-14 06:39
    I think it would help if you setup a timetable regarding the motions.
    Like:
    motion· time· duration· servo1· servo2· servo3· servo4· servo5
    straight· 0····· 0.5·····neutral·· neutral· neutral· neutral· neutral

    Time holds when one of the servos must change speed or direction
    Duration specifies how long an action is performed.
    servo1 to servo5 hold specific commands to perform those changes.

    Once you have logically defined those actions you can read out your timetable
    and send commands to the servo controller. At first just describe the servo actions,
    like: turn +2.4 degrees in 0.6 seconds

    Using absolute commands has the benefit of having a fixed origin (the neutral position).
    You can calculate relative positions easily by subtracting the neutral position (3000)
    from the actual position (500 to 5500).

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-14 07:22
    The fish robot homepage:
    http://www.nmri.go.jp/eng/khirata/fish/index_e.html
    There might be useful info there.

    regards peter
  • whitelancerwhitelancer Posts: 23
    edited 2006-07-19 15:11
    To anyone that can help,

    I have set up an array of positions with speeds resembling the table that Peter suggested. When I compile the program it says everything is okay but comes up as an error when I try to download it. I am trying to run the robot in the swimming straight mode and have set up the arrays in that location of the programming. Please let me know if you can help,

    Sincerely,
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-07-19 15:34
    You can't use double and byte[noparse]/noparse[noparse]/noparse in method swimStraight.
    I suggest using
    ······ int[noparse]/noparse speedArray = { 20, 21 }; //10x speed values
    and compensate for the 10x greater values in your calculations.

    I adapted your class to use single dimension arrays.
    Now it will compile and link (and thus download).

    regards peter
Sign In or Register to comment.