Notifications
Clear all

Greetings from the Philippines

3 Posts
2 Users
1 Reactions
411 Views
(@efren7962)
Member
Joined: 7 months ago
Posts: 2
Topic starter  

Hello everyone. I learned so much about programming in Arduino through DroneBot. I am currently working on a 6 DOF aluminum robotic arm and simply want to learn how to make the movements very smooth despite using servo motors with power ratings of only 11 kg to 45 kg. 



   
Quote
Topic Tags
robotBuilder
(@robotbuilder)
Member
Joined: 7 years ago
Posts: 2467
 

@efren7962

Would be interesting to see the details if you decide to post them sometime.

 



   
ReplyQuote
(@efren7962)
Member
Joined: 7 months ago
Posts: 2
Topic starter  

The following if part of the sketch I used:

// Move a servo to a given angle instantly
void moveServo(uint8_t channel, int angle) {
  pwm.setPWM(channel, 0, angleToPulse(angle));
}


// Jerk-limited 7-segment S-curve motion profile
void sCurveMoveServo(uint8_t channel, int fromAngle, int toAngle, int durationMs = 2000, int steps = 200) {
  int stepDir = (toAngle > fromAngle) ? 1 : -1;
  float totalDist = abs(toAngle - fromAngle);


  for (int i = 0; i <= steps; i++) {
    float t = (float)i / steps;  // 0 → 1
    // Quintic polynomial: smooth position, velocity, acceleration, jerk
    float s = (10 * pow(t, 3)) - (15 * pow(t, 4)) + (6 * pow(t, 5));


    int angle = fromAngle + stepDir * (s * totalDist);
    moveServo(channel, angle);


    delay(durationMs / steps);
  }
}
 

This post was modified 6 months ago by DroneBot Workshop

   
THRandell reacted
ReplyQuote