Skip to content

Advanced Applications

servo_move Tracking Motion

servo_move() receives a set of waypoints, performs smoothing based on timeStamp, and sends them to the servo for tracking motion.

ServoMovePara Parameter Description

ParameterTypeDescription
robotNumintWhich robot to control
clearBufferboolWhether to clear previously sent waypoints that have not started interpolation calculation
targetModeint0-Independent point; 1-Continuous trajectory
sendModeint0-Transmit all trajectory waypoints at once; 1-Transmit partial waypoints at once
runModeint0-Move after receiving all; 1-Move while receiving
sumintTotal number of transmissions
countintCurrent transmission number
coordint0-Joint coordinate system; 1-Cartesian coordinate system
sizeintNumber of waypoints in this transmission
posvector<vector<double>>2D array, first dimension is number of waypoints, second dimension is 7 joint angles or Cartesian coordinates
axisvelvector<vector<double>>Velocity of each axis
axisaccvector<vector<double>>Acceleration of each axis
timeStampvector<double>Time to reach each waypoint (unit: ms)

Prerequisites

In run mode, you need to run a job file containing the external point command on the controller (the external point command is responsible for receiving data transmitted by servo_move).

Example: Continuous Trajectory One-time Transmission

py
def test_7000(socketFd):
    print('Starting test 7000...')
    socket_7000 = aa.connect_robot("192.168.1.13", "7000")
    servomovepara = aa.ServoMovePara()
    pos = aa.VectorVectorDouble()
    time = aa.VectorDouble()

    time_pos = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550]
    for value in time_pos:
        time.append(value)

    axis_pos = [
        [0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 1, 0],
        [0, 0, 0, 0, 0, 2, 0],
        [0, 0, 0, 0, 0, 3, 0],
        [0, 0, 0, 0, 0, 4, 0],
        [0, 0, 0, 0, 0, 5, 0],
        [0, 0, 0, 0, 0, 6, 0],
        [0, 0, 0, 0, 0, 7, 0],
        [0, 0, 0, 0, 0, 8, 0],
        [0, 0, 0, 0, 0, 9, 0],
        [0, 0, 0, 0, 0, 10, 0],
    ]
    for value in axis_pos:
        pos.append(value)

    for k in range(11):
        servomovepara.pos = pos
    for j in range(11):
        servomovepara.timeStamp = time

    servomovepara.runMode = 0
    servomovepara.clearBuffer = True
    servomovepara.targetMode = 1
    servomovepara.coord = 0
    servomovepara.size = 11

    result = aa.servo_move(socket_7000, servomovepara)
    print("return ", result)