Skip to content

3.4 MotionControl Class

Overview

MotionControl is the core motion-control object for Agilebot robots. It wraps the following capabilities:

  • Speed and acceleration parameter management
  • Coordinate system management
  • Pose conversion
  • Trajectory motion control
  • Position control mode
  • Drag teaching
  • Payload management

Common Usage Flow

After Arm is connected, access the Motion instance through arm.motionControl ; no separate initialization is required.

3.4.1 Get Robot Parameters

3.4.1.1 Get OVC Global Speed Ratio

cpp
GetOVC() -> std::pair<Float64, STATUS_CODE>
ItemDescription
DescriptionGets the current robot OVC global speed ratio. The range is 0~1
Request ParametersNone
Return ValueFloat64: speed ratio, in the range 0~1
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.1.2 Get OAC Global Acceleration Ratio

cpp
GetOAC() -> std::pair<Float64, STATUS_CODE>
ItemDescription
DescriptionGets the current robot OAC global acceleration ratio. The range is 0~1.2
Request ParametersNone
Return ValueFloat64: acceleration ratio, in the range 0~1.2
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.1.3 Get Current TF Tool Frame ID

cpp
GetTF() -> std::pair<int32_t, STATUS_CODE>
ItemDescription
DescriptionGets the TF tool frame ID currently used by the robot. The ID range is 0~50
Request ParametersNone
Return Valueint32_t: tool frame ID
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.1.4 Get Current UF User Frame ID

cpp
GetUF() -> std::pair<int32_t, STATUS_CODE>
ItemDescription
DescriptionGets the UF user frame ID currently used by the robot. The ID range is 0~50
Request ParametersNone
Return Valueint32_t: user frame ID
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.1.5 Get Current TCS Teaching Coordinate System

cpp
GetTCS() -> std::pair<TCSType, STATUS_CODE>
ItemDescription
DescriptionGets the TCS teaching coordinate system currently used by the robot
Request ParametersNone
Return ValueTCSType: teaching coordinate system type
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.2 Set Robot Parameters

3.4.2.1 Set OVC Global Speed Ratio

cpp
SetOVC(Float64 value) -> STATUS_CODE
ItemDescription
DescriptionSets the robot OVC global speed ratio
Request Parametersvalue : Float64 speed ratio, range 0~1 and greater than 0
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.2.2 Set OAC Global Acceleration Ratio

cpp
SetOAC(Float64 value) -> STATUS_CODE
ItemDescription
DescriptionSets the robot OAC global acceleration ratio
Request Parametersvalue : Float64 acceleration ratio, range 0.01~1.2
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.2.3 Set Current TF Tool Frame

cpp
SetTF(int32_t index) -> STATUS_CODE
ItemDescription
DescriptionSets the TF tool frame currently used by the robot
Request Parametersindex : int32_t tool frame ID, range 0~50
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.2.4 Set Current UF User Frame

cpp
SetUF(int32_t index) -> STATUS_CODE
ItemDescription
DescriptionSets the UF user frame currently used by the robot
Request Parametersindex : int32_t user frame ID, range 0~50
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.2.5 Set Current TCS Teaching Coordinate System

cpp
SetTCS(TCSType tcsType) -> STATUS_CODE
ItemDescription
DescriptionSets the TCS teaching coordinate system currently used by the robot
Request ParameterstcsType : TCSType teaching coordinate system type
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.3 Pose and Conversion

3.4.3.1 Get Current Pose

cpp
GetCurrentPose(PoseType poseType) -> std::pair<MotionPose, STATUS_CODE>
ItemDescription
DescriptionGets the current robot pose. Supports pose information in Cartesian space or joint coordinates
Request ParametersposeType : PoseType pose type ( JOINT or CART )
Return ValueMotionPose: robot pose
STATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.3.2 Convert Cartesian Pose to Joint Pose

cpp
ConvertCartToJoint(const MotionPose& pose, int32_t ufIndex = 0, int32_t tfIndex = 0) -> std::pair<MotionPose, STATUS_CODE>
ItemDescription
DescriptionConverts a Cartesian pose to a joint pose. When hasPosture=true , posture information participates in solving; otherwise only the 6D Cartesian position is used
Request Parameterspose : MotionPose Cartesian robot pose ( PoseType::CART ; when posture is not specified, the SDK automatically solves a feasible posture)
ufIndex : int32_t user frame ID, default 0
tfIndex : int32_t tool frame ID, default 0
Return ValueMotionPose: robot pose
STATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.3.3 Convert Joint Pose to Cartesian Pose

cpp
ConvertJointToCart(const MotionPose& pose, int32_t ufIndex = 0, int32_t tfIndex = 0) -> std::pair<MotionPose, STATUS_CODE>
ItemDescription
DescriptionConverts a joint pose to a Cartesian pose
Request Parameterspose : MotionPose robot joint pose
ufIndex : int32_t user frame ID, default 0
tfIndex : int32_t tool frame ID, default 0
Return ValueMotionPose: robot pose
STATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.3.4 Cartesian to Joint Without Posture Information

cpp
ConvertCartToJointSimple(const MotionPose& pose, int32_t ufIndex = 0, int32_t tfIndex = 0) -> std::pair<MotionPose, STATUS_CODE>
ItemDescription
DescriptionConverts a Cartesian pose to a joint pose. This API always ignores input posture / hasPosture and uses only the 6D Cartesian position
Request Parameterspose : MotionPose robot Cartesian pose
ufIndex : int32_t user frame ID, default 0
tfIndex : int32_t tool frame ID, default 0
Return ValueMotionPose: robot pose
STATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.3.5 Get DH Parameters

cpp
GetDHParam() -> std::pair<std::vector<DHParam>, STATUS_CODE>
ItemDescription
DescriptionGets the robot DH parameters
Request ParametersNone
Return Valuestd::vector<DHParam> : DH parameter list
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

3.4.3.6 Set DH Parameters

cpp
SetDHParam(const std::vector<DHParam>& dhList) -> STATUS_CODE
ItemDescription
DescriptionSets the robot DH parameters
Request ParametersdhList : std::vector<DHParam> DH parameter list
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

3.4.4 Basic Motion

3.4.4.1 Joint-Space Motion

cpp
MoveJoint(const MotionPose& pose, Float64 vel, Float64 acc) -> STATUS_CODE
ItemDescription
DescriptionMoves the robot end effector to the specified position along the fastest path in joint space
Request Parameterspose : MotionPose pose in Cartesian space or joint coordinates
vel : Float64 speed ratio, range 0~1
acc : Float64 acceleration ratio, range 0~1.2
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.4.2 Linear Motion

cpp
MoveLine(const MotionPose& pose, Float64 vel, Float64 acc) -> STATUS_CODE
ItemDescription
DescriptionMoves the robot end effector to the specified position along a straight line between the two points
Request Parameterspose : MotionPose pose in Cartesian space or joint coordinates
vel : Float64 end speed, range 1~4000 mm/s
acc : Float64 acceleration ratio, range 0~1.2
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.4.3 Circular Motion

cpp
MoveCircle(const MotionPose& viaPose, const MotionPose& endPose, Float64 vel, Float64 acc) -> STATUS_CODE
ItemDescription
DescriptionMoves the robot end effector along an arc determined by a via point and an end point
Request ParametersviaPose : MotionPose via-point pose
endPose : MotionPose end-point pose
vel : Float64 end speed, range 1~4000 mm/s
acc : Float64 acceleration ratio, range 0~1.2
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.4.4 Enter Position Control Mode

cpp
EnterPositionControl() -> STATUS_CODE
ItemDescription
DescriptionRequests the controller to enter position control mode
Request ParametersNone
Return ValueSTATUS_CODE: function execution result
NotesUses controller axis group 1
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.4.5 Set Position-Control Trajectory Parameters

cpp
SetPositionTrajectoryParams(int32_t maxTimeoutCount, int32_t timeout, int32_t filterLayer, Float64 wristElbowThreshold, Float64 shoulderThreshold) -> STATUS_CODE
ItemDescription
DescriptionSets trajectory parameters used in position control mode
Request ParametersmaxTimeoutCount : int32_t maximum timeout count, range [1, 100]
timeout : int32_t timeout or send interval, range [1, 100] , unit ms
filterLayer : int32_t filter layer, range [1, 100]
wristElbowThreshold : Float64 wrist/elbow near-singularity threshold, range [10, 100]
shoulderThreshold : Float64 shoulder near-singularity threshold, range [100, 300]
Return ValueSTATUS_CODE: function execution result
NotesIf a parameter is out of range, the SDK returns INVALID_PARAMETER before sending the request
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.4.6 Exit Position Control Mode

cpp
ExitPositionControl() -> STATUS_CODE
ItemDescription
DescriptionRequests the controller to exit position control mode
Request ParametersNone
Return ValueSTATUS_CODE: function execution result
NotesUses controller axis group 1
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.5 Drag Teaching

3.4.5.1 Enable or Disable Drag

cpp
EnableDrag(bool dragState) -> STATUS_CODE
ItemDescription
DescriptionSets whether the robot enters drag mode
Request ParametersdragState : bool robot drag switch. true enters drag mode; false exits drag mode
Return ValueSTATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

3.4.5.2 Get Axis Lock Status

cpp
GetDragStatus() -> std::pair<DragStatus, STATUS_CODE>
ItemDescription
DescriptionGets the current robot axis lock status. Axis locking applies only to teaching motion
Request ParametersNone
Return ValueDragStatus: axis lock status. true means the axis can move; false means it is locked
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

3.4.5.3 Set Robot Axis Lock Status

cpp
SetDragStatus(const DragStatus& dragStatus) -> STATUS_CODE
ItemDescription
DescriptionSets the current robot axis lock status. Axis locking applies only to teaching motion
Request ParametersdragStatus : DragStatus lock state for each axis. Default is all true , meaning unlocked
Return ValueSTATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): Not supported

3.4.6 Other APIs

3.4.6.1 Get Robot Soft Limits

cpp
GetUserSoftLimit() -> std::pair<std::vector<SoftLimit>, STATUS_CODE>
ItemDescription
DescriptionGets the current robot soft limit information
Request ParametersNone
Return Valuestd::vector<SoftLimit> : robot soft limit information. The first list layer represents axes; the second layer represents lower and upper limits for each axis
STATUS_CODE: function execution result
Compatible Robot Software VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.6.2 Set UDP Feedback Parameters

cpp
SetUdpFeedbackParams(bool flag, const std::string& ip, int32_t interval, int32_t feedbackType, const std::vector<int32_t>& doList = {}) -> STATUS_CODE
ItemDescription
DescriptionConfigures UDP feedback parameters for robot data pushed to a specified IP address
Request Parametersflag : bool whether UDP data push is enabled;
ip : std::string receiver IP address;
interval : int32_t send interval in milliseconds;
feedbackType : int32_t feedback data format ( 0 : XML, 1 : JSON, 2 : PROTO);
doList : std::vector<int32_t> DO signal list, up to 10 items, optional
Return ValueSTATUS_CODE: function execution result
NotesParameter settings take effect only when UDP data push is enabled
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

3.4.7 Payload Subobject

Payload-related capabilities are grouped under arm.motionControl.payload .

3.4.7.1 Get Current Active Payload ID

cpp
payload.GetCurrentId() -> std::pair<int32_t, STATUS_CODE>
ItemDescription
DescriptionGets the currently active payload ID
Request ParametersNone
Return Valueint32_t: payload ID
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.7.2 Get Payload Information by ID

cpp
payload.GetById(int32_t payloadId) -> std::pair<PayloadInfo, STATUS_CODE>
ItemDescription
DescriptionGets payload information for the specified ID
Request ParameterspayloadId : int32_t payload ID
Return ValuePayloadInfo: payload information
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.7.3 Activate the Specified Payload

cpp
payload.SetCurrentId(int32_t payloadId) -> STATUS_CODE
ItemDescription
DescriptionActivates the specified payload by ID
Request ParameterspayloadId : int32_t payload ID
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.7.4 Add a Custom Payload

cpp
payload.Add(const PayloadInfo& payloadInfo) -> STATUS_CODE
ItemDescription
DescriptionAdds user-defined payload information to the robot controller cabinet
Request ParameterspayloadInfo : PayloadInfo user-defined payload information
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.7.5 Delete Payload

cpp
payload.Delete(int32_t payloadId) -> STATUS_CODE
ItemDescription
DescriptionDeletes the user-defined payload with the specified ID from the controller
Request ParameterspayloadId : int32_t payload ID
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+
NotesThe currently active payload cannot be deleted. To delete the active payload, activate another payload first

3.4.7.6 Update Payload

cpp
payload.Update(const PayloadInfo& payloadInfo) -> STATUS_CODE
ItemDescription
DescriptionUpdates existing user-defined payload information in the robot
Request ParameterspayloadInfo : PayloadInfo object containing the updated payload information
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.7.7 Get All Payloads

cpp
payload.GetAll() -> std::pair<std::vector<PayloadSummary>, STATUS_CODE>
ItemDescription
DescriptionGets the list of all payload information
Request ParametersNone
Return Valuestd::vector<PayloadSummary> : all payload summaries, containing only id and comment
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.0.0+
Industrial (Bronze): v7.5.0.0+

3.4.7.8 Check Axis-3 Horizontal Level

cpp
payload.CheckAxisThreeHorizontal() -> std::pair<Float64, STATUS_CODE>
ItemDescription
DescriptionChecks whether robot axis 3 is horizontal
Request ParametersNone
Return ValueFloat64: horizontal angle of axis 3, in degrees
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported
NotesThe horizontal angle must be within -1~1 degrees before payload identification can be performed

3.4.7.9 Get Payload Identification State

cpp
payload.GetIdentifyState() -> std::pair<PayloadIdentifyState, STATUS_CODE>
ItemDescription
DescriptionGets the payload identification state
Request ParametersNone
Return ValuePayloadIdentifyState: payload identification state
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

3.4.7.10 Start Payload Identification

cpp
payload.StartIdentify(Float64 weight, Float64 angle) -> STATUS_CODE
ItemDescription
DescriptionStarts the payload identification process
Request Parametersweight : Float64 payload weight. Use -1 if unknown;
angle : Float64 axis-6 allowed rotation angle, range 30~90 degrees
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported
NotesEnter payload identification state before starting payload identification

3.4.7.11 Get Payload Identification Result

cpp
payload.GetIdentifyResult() -> std::pair<PayloadInfo, STATUS_CODE>
ItemDescription
DescriptionGets the payload identification result
Request ParametersNone
Return ValuePayloadInfo: payload identification result
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

3.4.7.12 Start Interference Check

cpp
payload.InterferenceCheckForPayloadIdentify(Float64 weight, Float64 angle) -> STATUS_CODE
ItemDescription
DescriptionStarts the interference check for payload identification
Request Parametersweight : Float64 payload weight;
angle : Float64 axis-6 rotation angle, range 30~90 degrees
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

3.4.7.13 Enter Payload Identification State

cpp
payload.IdentifyStart() -> STATUS_CODE
ItemDescription
DescriptionEnters the payload identification preparation state
Request ParametersNone
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

3.4.7.14 Finish Payload Identification State

cpp
payload.IdentifyDone() -> STATUS_CODE
ItemDescription
DescriptionEnds the payload identification preparation state
Request ParametersNone
Return ValueSTATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported

3.4.7.15 Full Payload Identification Workflow

cpp
payload.Identify(Float64 weight, Float64 angle) -> std::pair<PayloadInfo, STATUS_CODE>
ItemDescription
DescriptionRuns the complete payload identification workflow, including all payload identification steps. Use this API unless you need custom step control
Request Parametersweight : Float64 payload weight. Use -1 if unknown;
angle : Float64 axis-6 rotation angle, range 30~90 degrees
Return ValuePayloadInfo: payload identification result
STATUS_CODE: function execution result
Compatible VersionsCollaborative (Copper): v7.5.2.0+
Industrial (Bronze): Not supported
NotesThe returned payload can be added to the robot or written into an existing robot payload
Full workflow:
1. Move to the specified horizontal position and check whether it is horizontal
2. Enter payload identification state
3. Start payload identification
4. Get the payload identification result
5. Finish payload identification state

Minimal Call Example

cpp
#include <iostream>      // Standard output stream for printing motion query results
#include "arm_api.h"    // Arm entry point; after connection, motion APIs are accessed through arm.motionControl
#include "status_code.h" // STATUS_CODE for checking SDK call results
int main()
{
    Arm arm;
    STATUS_CODE connectRet = arm.Connect("192.168.110.2", "");
    if (connectRet != STATUS_CODE::OK) {
        return 1;
    }

    auto [ovc, ovcRet] = arm.motionControl.GetOVC();
    auto [jointPose, poseRet] = arm.motionControl.GetCurrentPose(PoseType::JOINT);
    if (ovcRet != STATUS_CODE::OK || poseRet != STATUS_CODE::OK) {
        return 1;
    }

    auto [cartPose, convertRet] = arm.motionControl.ConvertJointToCart(jointPose);
    if (convertRet != STATUS_CODE::OK) {
        return 1;
    }

    std::cout << "ovc=" << ovc << "\n";
    std::cout << "joint_count=" << jointPose.joint.size() << "\n";
    std::cout << "cartesian_count=" << cartPose.cartesian.size() << "\n";
    return 0;
}

Scenario Examples

The snippets below cover parameter read/write, pose conversion, basic motion, drag/UDP, payload management, and payload identification. They assume the arm object from the minimal example is already connected. Calls that move the robot or change configuration remain commented out; run them only after checking the site.

Read and Set Motion Parameters

cpp
auto [ovc, ovcRet] = arm.motionControl.GetOVC();
auto [oac, oacRet] = arm.motionControl.GetOAC();
auto [tf, tfRet] = arm.motionControl.GetTF();
auto [uf, ufRet] = arm.motionControl.GetUF();
auto [tcs, tcsRet] = arm.motionControl.GetTCS();
if (ovcRet == STATUS_CODE::OK && oacRet == STATUS_CODE::OK && tfRet == STATUS_CODE::OK && ufRet == STATUS_CODE::OK && tcsRet == STATUS_CODE::OK) {
    std::cout << "ovc=" << ovc << " oac=" << oac << " tf=" << tf << " uf=" << uf << " tcs=" << static_cast<int>(tcs) << "\n";
}
// STATUS_CODE setOvcRet = arm.motionControl.SetOVC(0.5);
// STATUS_CODE setOacRet = arm.motionControl.SetOAC(0.5);
// STATUS_CODE setTfRet = arm.motionControl.SetTF(tf);
// STATUS_CODE setUfRet = arm.motionControl.SetUF(uf);
// STATUS_CODE setTcsRet = arm.motionControl.SetTCS(tcs);

Read Pose and Convert Coordinates

cpp
auto [jointPose, jointRet] = arm.motionControl.GetCurrentPose(PoseType::JOINT);
if (jointRet != STATUS_CODE::OK) {
    return;
}
auto [cartPose, cartRet] = arm.motionControl.ConvertJointToCart(jointPose);
auto [jointFromCart, cartToJointRet] = arm.motionControl.ConvertCartToJoint(cartPose);
auto [jointSimple, simpleRet] = arm.motionControl.ConvertCartToJointSimple(cartPose);
if (cartRet == STATUS_CODE::OK && cartToJointRet == STATUS_CODE::OK && simpleRet == STATUS_CODE::OK) {
    std::cout << "joint_count=" << jointPose.joint.size() << " cart_count=" << cartPose.cartesian.size() << "\n";
}

Execute Basic Motion

cpp
auto [jointPose, jointRet] = arm.motionControl.GetCurrentPose(PoseType::JOINT);
auto [cartPose, cartRet] = arm.motionControl.ConvertJointToCart(jointPose);
if (jointRet != STATUS_CODE::OK || cartRet != STATUS_CODE::OK) {
    return;
}
// STATUS_CODE moveJointRet = arm.motionControl.MoveJoint(jointPose, 0.1, 0.1);
// STATUS_CODE moveLineRet = arm.motionControl.MoveLine(cartPose, 50.0, 0.1);
// STATUS_CODE moveCircleRet = arm.motionControl.MoveCircle(cartPose, cartPose, 50.0, 0.1);

DH, Drag, and UDP Push

cpp
auto [dhList, dhRet] = arm.motionControl.GetDHParam();
auto [dragStatus, dragRet] = arm.motionControl.GetDragStatus();
auto [softLimits, limitRet] = arm.motionControl.GetUserSoftLimit();
if (dhRet == STATUS_CODE::OK || dragRet == STATUS_CODE::OK || limitRet == STATUS_CODE::OK) {
    std::cout << "dh_count=" << dhList.size() << " soft_limit_count=" << softLimits.size() << "\n";
}
// STATUS_CODE setDhRet = arm.motionControl.SetDHParam(dhList);
// STATUS_CODE enableDragRet = arm.motionControl.EnableDrag(true);
// STATUS_CODE setDragRet = arm.motionControl.SetDragStatus(dragStatus);
// STATUS_CODE udpRet = arm.motionControl.SetUdpFeedbackParams(true, "192.168.110.10", 100, 1, std::vector<int32_t>{0, 1});

Query and Maintain Payloads

cpp
auto [payloadId, payloadIdRet] = arm.motionControl.payload.GetCurrentId();
auto [payloads, payloadsRet] = arm.motionControl.payload.GetAll();
if (payloadIdRet != STATUS_CODE::OK) {
    return;
}
auto [payloadInfo, payloadRet] = arm.motionControl.payload.GetById(payloadId);
if (payloadRet == STATUS_CODE::OK || payloadsRet == STATUS_CODE::OK) {
    std::cout << "payload_id=" << payloadId << " payload_count=" << payloads.size() << "\n";
}
// STATUS_CODE setPayloadRet = arm.motionControl.payload.SetCurrentId(payloadId);
// STATUS_CODE addPayloadRet = arm.motionControl.payload.Add(payloadInfo);
// STATUS_CODE updatePayloadRet = arm.motionControl.payload.Update(payloadInfo);
// STATUS_CODE deletePayloadRet = arm.motionControl.payload.Delete(payloadId);

Payload Identification Workflow

cpp
auto [axisAngle, axisRet] = arm.motionControl.payload.CheckAxisThreeHorizontal();
auto [identifyState, stateRet] = arm.motionControl.payload.GetIdentifyState();
auto [identifyResult, resultRet] = arm.motionControl.payload.GetIdentifyResult();
if (axisRet == STATUS_CODE::OK || stateRet == STATUS_CODE::OK || resultRet == STATUS_CODE::OK) {
    std::cout << "axis_angle=" << axisAngle << " identify_state=" << static_cast<int>(identifyState) << "\n";
}
// STATUS_CODE interferenceRet = arm.motionControl.payload.InterferenceCheckForPayloadIdentify(-1.0, 45.0);
// STATUS_CODE identifyStartRet = arm.motionControl.payload.IdentifyStart();
// STATUS_CODE startIdentifyRet = arm.motionControl.payload.StartIdentify(-1.0, 45.0);
// STATUS_CODE identifyDoneRet = arm.motionControl.payload.IdentifyDone();
// auto [identifiedPayload, identifyRet] = arm.motionControl.payload.Identify(-1.0, 45.0);

Example code:

cpp17/motion_basic/src/main.cpp
cpp
#include "query_motion_state/run.h"
#include "query_current_pose/run.h"
#include "convert_pose/run.h"
#include "query_limits/run.h"
#include "write_motion_config/run.h"
#include "run_motion_apis/run.h"

int main(void)
{
    // [ZH] 默认只调用一个门面方法;如需体验其他接口,请把下一行替换成下面任意一行。
    // [EN] The main function calls only one facade by default. Replace the next line with any line below to try other APIs.
    return RunMotionBasicQueryMotionState();
    // return RunMotionBasicQueryCurrentPose();
    // return RunMotionBasicConvertPose();
    // return RunMotionBasicQueryLimits();
    // return RunMotionBasicWriteMotionConfig();
    // return RunMotionBasicRunMotionApis();
}
cpp17/motion_pose/src/main.cpp
cpp
#include "query_current_pose/run.h"
#include "convert_joint_to_cart/run.h"
#include "convert_cart_to_joint/run.h"

int main(void)
{
    // [ZH] 默认只调用一个门面方法;如需体验其他接口,请把下一行替换成下面任意一行。
    // [EN] The main function calls only one facade by default. Replace the next line with any line below to try other APIs.
    return RunMotionPoseQueryCurrentPose();
    // return RunMotionPoseConvertJointToCart();
    // return RunMotionPoseConvertCartToJoint();
}
cpp17/motion_drag/src/main.cpp
cpp
#include "query_drag_status/run.h"
#include "enable_drag/run.h"
#include "set_drag_status/run.h"

int main(void)
{
    // [ZH] 默认只调用一个门面方法;如需体验其他接口,请把下一行替换成下面任意一行。
    // [EN] The main function calls only one facade by default. Replace the next line with any line below to try other APIs.
    return RunMotionDragQueryDragStatus();
    // return RunMotionDragEnableDrag();
    // return RunMotionDragSetDragStatus();
}
cpp17/motion_payload/src/main.cpp
cpp
#include "query_payload_info/run.h"
#include "manage_payloads/run.h"
#include "identify_payload/run.h"

int main(void)
{
    // [ZH] 默认只调用一个门面方法;如需体验其他接口,请把下一行替换成下面任意一行。
    // [EN] The main function calls only one facade by default. Replace the next line with any line below to try other APIs.
    return RunMotionPayloadQueryPayloadInfo();
    // return RunMotionPayloadManagePayloads();
    // return RunMotionPayloadIdentifyPayload();
}