This function allows users to use Spline as the interpolation method for servo motion. When this function is turned on, it can appropriately suppress the vibration generated during robot motion and make robot motion more stable. This feature is supported from Coding 315 onwards.


aiservoBeginSplineMotion(mode, frames, frameTime, numFrames)


  • mode: There are 3 modes to choose from.
  • NATURAL_CUBIC: It can moderately reduce the vibration of robot movement and smooth out the robot motion. It should be noted that in order to meet the definition of NATURAL CUBIC SPLINE formula, the interpolated trajectory of robot frame arrangement may exceed the expected motion (overshooting) in some ways.
  • CONSTRAINED_CUBIC: Defined by the CONSTRAINED CUBIC SPLINE formula, which guarantees that there will be no NATURAL_CUBIC defects as described above, but will reduce the smoothing effect.
  • CATMULL_ROM: Defined by the CATMULL-ROM SPLINE formula, it can effectively suppress the overshooting caused by NATURAL_CUBIC, and the smoothing effect is better than CONSTRAINED_CUBIC.
  • frames: The frame array to be used for curve planning.
  • frameTime: the interval time array (in ms) for each frame to be played.
  • numFrames: the number of frames to be curved (i.e. the size of the frames array).




#include "AIServo86.h"
AIServo Servo1;
AIServo Servo2;
AIServo Servo3;
AIServoPort(ROBOTIS, AX12) bus;
AIServoFrame Frames[3];
unsigned long playtime[3] = {200, 500, 100};
void setup() {
  Servo1.attach(bus, 21); Servo2.attach(bus, 22); Servo3.attach(bus, 23);
  Frames[0].positions[0] = 150; Frames[0].positions[1] = 150; Frames[0].positions[2] = 130;
  Frames[1].positions[0] = 240; Frames[1].positions[1] = 140; Frames[1].positions[2] = 180;
  Frames[2].positions[0] = 240; Frames[2].positions[1] = 160; Frames[2].positions[2] = 180;
  Serial.println("Natural CUBIC");
void loop() {
  aiservoBeginSplineMotion(NATURAL_CUBIC, Frames, playtime, 3);
  for (int i=0; i<3; i++) {
    while(isAIServoMultiMoving() == true);

See also

Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Scroll to Top