Arduino uno 6dof

Home Forum Everything Else Arduino uno 6dof

  • This topic has 2 voices and 15 replies.
Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #6106
    AvatarAnonymous
    Inactive

    Hi,
    as a Newbie I’m struggeling with a code for Arduino uno and six servos connected to pins 3,5,6,9,10,11.
    I’v build Steward platform, but I can’ get servos moving with code bellow
    Any Ideas, thank you in advance

    #include 
    const float pi = 3.14159,
    theta_r = radians(48.0),
    theta_p = radians(23.2),
    theta_s[] = { -pi / 3, 2 * pi / 3, pi, 0, pi / 3, -2 * pi / 3},
    RD = 2.395,
    PD = 3.3,
    L1 = 1.0,
    L2 = 4.72,
    z_home = 4.25,
    servo_min = 3.5,
    servo_max = 5.5,
    servo_mult = 6,
    p[2][6] = {{PD * cos(pi / 6 + theta_p), PD * cos(pi / 6 - theta_p), PD * cos(-(pi / 2 - theta_p)), -PD * cos(-(pi / 2 - theta_p)), -PD * cos(pi / 6 - theta_p), -PD * cos(pi / 6 + theta_p)},
    {PD * sin(pi / 6 + theta_p), PD * sin(pi / 6 - theta_p), PD * sin(-(pi / 2 - theta_p)), PD * sin(-(pi / 2 - theta_p)), PD * sin(pi / 6 - theta_p), PD * sin(pi / 6 + theta_p)}
    },
    re[2][6] = {{RD * cos(pi / 6 + theta_r), RD * cos(pi / 6 - theta_r), RD * cos(-(pi / 2 - theta_r)), -RD * cos(-(pi / 2 - theta_r)), -RD * cos(pi / 6 - theta_r), -RD * cos(pi / 6 + theta_r)},
    {RD * sin(pi / 6 + theta_r), RD * sin(pi / 6 - theta_r), RD * sin(-(pi / 2 - theta_r)), RD * sin(-(pi / 2 - theta_r)), RD * sin(pi / 6 - theta_r), RD * sin(pi / 6 + theta_r)}
    };

    /*
    theta_r = angle between attachment points
    theta_p = angle between rotation points
    theta_s = orientation of the servos
    RD = distance to end effector attachment points
    PD = distance to servo rotation points
    L1 = servo arm length
    L2 = connecting arm length
    z_home = default z height with servo arms horizontal
    servo_min = lower limit for servo arm angle
    servo_max = upper limit for servo arm angle
    servo_mult = multiplier to convert to milliseconds
    p = location of servo rotation points in base frame [x/y][1-6]
    re = location of attachment points in end effector frame [x/y][1-6]
    */
    const int servo_pin[] = {9, 3, 5, 11, 6, 10};
    const int servo_zero[6] = {1710, 1280, 1700, 1300, 1680, 1300};
    /*
    servo_pin = servo pin assignments,
    servo_zero = zero angles for each servo (horizontal)
    */
    Servo servo[6];
    /*
    Servos 0, 2, 4: reversed (+ = down, - = up)
    Servos 1, 3, 5: normal (+ = up, - = down)
    */
    void setup()
    {
    //Serial.begin(9600);
    for (int i = 0; i < 6; i++)
    {

    servo.attach(servo_pin);
    servo
    .writeMicroseconds(servo_zero);
    }
    delay(1000);
    }

    void loop()
    {
    static float pe[6] = {0, 0, 0, radians(0), radians(0), radians(0)}, theta_a[6], servo_pos[6], q[3][6], r[3][6], dl[3][6], dl2[6];

    }
    /*
    pe = location and orientation of end effector frame relative to the base frame [sway, surge, heave, pitch, roll, yaw)
    theta_a = angle of the servo arm
    servo_pos = value written to each servo
    q = position of lower mounting point of connecting link [x,y,x][1-6]
    r = position of upper mounting point of connecting link
    dl = difference between x,y,z coordinates of q and r
    dl2 = distance between q and r
    */
    #7035
    AvatarAnonymous
    Inactive

    I prefer to work with vectors and think in dot products, cross products, etc.
    I can draw the model and how to build the equations easier that way.

    #7036
    AvatarAnonymous
    Inactive

    @i-make-robots wrote:

    I prefer to work with vectors and think in dot products, cross products, etc.
    I can draw the model and how to build the equations easier that way.

    thank you for your response.
    Would you be so kind and show me an example, maybe one relating to Stewart Platform 6dof

    regards
    Mario

    #7037
    AvatarAnonymous
    Inactive
    #7038
    AvatarAnonymous
    Inactive

    thank you i-make-robots,
    I downloaded the files, but there is no other description except,
    how to assemble rods and motors, but there is a missing image of wireing
    and other description. If you have any information or description Il be gratefull.
    @i-make-robots wrote:

    https://github.com/MarginallyClever/RotaryStewartPlatform

    As I’m a real newbie I looked at the code named rap-center.ino and I would like to know
    what i stands for in the code bellow
    int i;
    for(i=0;i<6;++i) {
    arm.attach(7-i);
    arm
    .write( 90 );

    thank you again
    Mario

    #7039
    AvatarAnonymous
    Inactive

    It’s connecting servos to pins 1-6 (inclusive) and then moving them to middle position. I used this code to center the servos so then I could attach the servo arms and know they’re *pretty close* to horizontal.

    #7040
    AvatarAnonymous
    Inactive

    thank you, for replay.

    I’v used RSP_Center.ino, to set up the positions of servos to zero position ,parallel to the horizon.
    I’v run RSP_Test.ino and I think that the servos have to wide range of motion. I was again unsuccesfull trying
    to reduce the range of oscilation in the code bellow. Any tips what to change

    void loop() {
    float t=millis()*0.001;

    int i,j;
    for(i=0;i<6;++i) {
    j = sin(t+(float)i*PI/3.0)*30;
    set_servo(i,j);
    Serial.print(j);
    Serial.print(‘t’);
    }

    Serial.print(‘n’);
    delay(50);

    #7041
    AvatarAnonymous
    Inactive

    change *30 to *20 or *10… the smaller the number, the smaller the oscillation.

    #7042
    AvatarAnonymous
    Inactive

    Hi,
    thank you again. I managed to succesfully run my first 6DOF experiment.
    Next step would probably be Rumba controller.
    But right now I would like to do the following procedure:
    Use the platform as it is, but servos connected to inputs as
    you programmed in RSP_Listen.ino. Than record movements in to
    software CoolTerm.
    Run RSP_MasterSlave.ino and use recorded data from CoolTerm instead
    of the second 6DOF platform functioning as remote.
    What do you think

    Regards
    MArio

    #7043
    AvatarAnonymous
    Inactive

    I think it’s a good plan. Post updates as you go, I want to learn more about cool term.

    #7044
    AvatarAnonymous
    Inactive

    Hi,
    my report about CoolTerm.
    What I expected did not happen.
    When CoolTerm saves received data to a text file, the time stamps tell you when which data was received. Sending the same text file via CoolTerm, however, does not interpret the time stamps as pauses. It treats the timestamps in the file as text, just like any other data in the text file. Thus, CoolTerm will send the timestamps as text to the your servo controller. Any file sent by CoolTerm will be sent all at once.

    So I decided to replicate your Master Slave Scenario.
    I build two Platforms and Arduino Uno. Servos from Platform A connected to outputs, pins 2-7,
    Servos from Platform B to inputs A0-A5.
    When I run RSP Center Platform A moves in to Zero position. So OK
    When I Run RSP Listen Platform B when I move it transfers data, which can be observed
    on seriam Monitor. So, probably OK
    When I run RSP Master Slave I calibrate MIN MAX positions, but when finished Platform A
    starts to move erratically

    #7045
    AvatarAnonymous
    Inactive

    erratically how? Can you make a video please?

    #7046
    AvatarAnonymous
    Inactive

    immediately after calibration the following behavior

    #7047
    AvatarAnonymous
    Inactive

    Something is sending random PWM signals to your servos. What happens if your arduino sends only (MAX+MIN)/2 to all the servos?

    #7048
    AvatarAnonymous
    Inactive

    How do I do that?

    #7049
    AvatarAnonymous
    Inactive

    It was my mistake.
    I made a wiring error. Small Breadboard, so many wires….

    Thank you for your help

Viewing 16 posts - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.