Skip to content

Kinematics APIs

The kinematics APIs are implemented by the following classes. You can find the corresponding header files in the c++\include\core\algo\kinematics directory to access the complete set of APIs.

Header FileClass NameDescription
kinematics.hKinematicsBase class for kinematics algorithms.
arm_kinematics.hArmKinematicsArm kinematics class, derived from Kinematics.
torso_kinematics.hTorsoKinematicsTorso kinematics class, derived from Kinematics.
collision.hAbcCollisionEntityCollision entity class used for collision modeling.
  • Method:

    AbcErrorCode forward_kinematics(const std::vector<AbcType>& joints, PoseType& pose)
  • Parameters:

    Parameter
    Type
    Description
    jointsInputJoint angles. For details, please refer to AbcType.
    poseOutputPose computed by forward kinematics. PoseType is a placeholder type name.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode inverse_kinematics(
    const PoseType& pose,
    const std::vector<AbcType>& ref_joints,
    std::vector<AbcType>& joints,
    int mode)
  • Parameters:

    Parameter
    Type
    Description
    poseInputThe target pose. PoseType is a placeholder type name.
    ref_jointsInputReference joint angles. For details, please refer to AbcType.
    jointsOutputJoint angles computed by inverse kinematics. For details, please refer to AbcType.
    modeInput- 0: Numerical solution, single-step mode. Suitable when the current pose is close to the target pose; recommended for continuous motion.
    - 1: Numerical solution, multi-step mode. Suitable for larger differences between current and target poses; requires more computation time.
    - 2: Analytical solution.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode forward_velocity(
    const std::vector<AbcType>& joint,
    const std::vector<AbcType>& joints_v,
    AbcPose& end_effector_pose,
    AbcPoseVelocity& end_effector_v)
  • Parameters:

    Parameter
    Type
    Description
    jointInputJoint angles. For details, please refer to AbcType.
    joints_vInputJoint velocities. For details, please refer to AbcType.
    end_effector_poseOutputEnd-effector pose. For details, please refer to AbcPose.
    end_effector_vOutputEnd-effector velocity. For details, please refer to AbcPoseVelocity.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode inverse_velocity(
    const std::vector<AbcType>& joint,
    const AbcPoseVelocity& end_effector_v,
    std::vector<AbcType>& joints_v)
  • Parameters:

    Parameter
    Type
    Description
    jointInputJoint angles. For details, please refer to AbcType.
    end_effector_vInputEnd-effector velocity. For details, please refer to AbcPoseVelocity.
    joints_vOutputJoint velocities. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode check_range(const std::vector<AbcType>& j)
  • Parameter:

    Parameter
    Type
    Description
    jInputJoint angles. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates all joint values are within limits. For other error codes, please refer to AbcErrorCode.

  • Method:

    static std::unique_ptr<ArmKinematics> create(ArmType type)
  • Parameter:

    Parameter
    Type
    Description
    typeInputRobotic arm type. For details, please refer to ArmType.
  • Return Value:

    A std::unique_ptr<ArmKinematics> on success, otherwise returns nullptr.

  • Method:

    AbcErrorCode forward_kinematics(const std::vector<AbcType>& joints, AbcPose& pose)
  • Parameters:

    Parameter
    Type
    Description
    jointsInputJoint angles. For details, please refer to AbcType.
    poseOutputPose computed by forward kinematics. For details, please refer to AbcPose.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode inverse_kinematics(
    const AbcPose& pose,
    const std::vector<AbcType>& ref_joints,
    std::vector<AbcType>& joints,
    int mode)
  • Parameters:

    Parameter
    Type
    Description
    poseInputEnd-effector pose. For details, please refer to AbcPose.
    ref_jointsInputReference joint angles. For details, please refer to AbcType.
    jointsOutputJoint angles computed by inverse kinematics. For details, please refer to AbcType.
    modeInput- 0: Numerical solution, single-step mode. Suitable when the current pose is close to the target pose; recommended for continuous motion.
    - 1: Numerical solution, multi-step mode. Suitable for larger differences between current and target poses; requires more computation time.
    - 2: Analytical solution.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

Search Redundant Parameters for Inverse Kinematics

Section titled “Search Redundant Parameters for Inverse Kinematics”
  • Method:

    AbcErrorCode inverse_kinematics_parameter_search(
    const AbcPose& pose,
    const size_t& select,
    const std::function<AbcType(std::vector<AbcType>& joints)>& cost,
    std::vector<AbcType>& joints,
    AbcType& param)
  • Parameters:

    Parameter
    Type
    Description
    poseInputEnd-effector pose. For details, please refer to AbcPose.
    selectInputIndex of the inverse kinematics solution set. It is recommended to use 0. Important: During continuous end-effector motion, do not change this value; keeping the selected solution fixed ensures motion continuity.
    costInputCost callback function.
    jointsOutputJoint values of the inverse kinematics solution. For details, please refer to AbcType.
    paramOutputRedundancy parameter.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

Analytical Inverse Kinematics (Single Solution)

Section titled “Analytical Inverse Kinematics (Single Solution)”
  • Method:

    AbcErrorCode inverse_kinematics_analytical(
    const AbcPose& pose,
    const AbcType& parameter,
    const size_t& select,
    std::vector<AbcType>& joints)
  • Parameters:

    Parameter
    Type
    Description
    poseInputEnd-effector pose. For details, please refer to AbcPose.
    parameterInputRedundancy parameter.
    selectInputIndex of the inverse kinematics solution set. It is recommended to use 0. Important: During continuous end-effector motion, do not change this value; keeping the selected solution fixed ensures motion continuity.
    jointsOutputJoint angles of the inverse kinematics solution. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

Check Collision Between the Robotic Arm and the Environment

Section titled “Check Collision Between the Robotic Arm and the Environment”
  • Method:

    AbcErrorCode arm_environment_collision(
    const std::vector<AbcType>& joints,
    const std::vector<AbcCollisionEntity>& environment,
    const std::vector<AbcPose>& environment_entities_pose,
    const std::vector<std::vector<bool>>& collision_bypass,
    std::vector<std::vector<AbcType>>& collision_matrix)
  • Parameters:

    Parameter
    Type
    Description
    jointsInputJoint angles. For details, please refer to AbcType.
    environmentInputEnvironment obstacles. The AbcCollisionEntity class defines the geometry and dimensions of obstacles.
    environment_entities_poseInputPoses of the environment obstacles.
    collision_bypassInputCollision bypass matrix used to skip specific collision checks.
    collision_matrixOutputCollision detection results matrix.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

Check Collision Between the Robotic Arm and the Torso

Section titled “Check Collision Between the Robotic Arm and the Torso”
  • Method:

    AbcErrorCode arm_body_collision(
    const std::vector<AbcType>& arm_joints,
    const std::vector<AbcType>& torso_joints,
    std::vector<std::vector<AbcType>>& collision_matrix)
  • Parameters:

    Parameter
    Type
    Description
    arm_jointsInputRobotic arm joint angles. For details, please refer to AbcType.
    torso_jointsInputTorso joint angles.
    collision_matrixOutputCollision detection results (7×7 matrix).
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode forward_velocity(
    const std::vector<AbcType>& joint,
    const std::vector<AbcType>& joints_v,
    AbcPose& end_effector_pose,
    AbcPoseVelocity& end_effector_v)
  • Parameters:

    Parameter
    Type
    Description
    jointInputJoint angles. For details, please refer to AbcType.
    joints_vInputJoint velocities. For details, please refer to AbcType.
    end_effector_poseOutputEnd-effector pose. For details, please refer to AbcPose.
    end_effector_vOutputEnd-effector velocity. For details, please refer to AbcPoseVelocity.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode inverse_velocity(
    const std::vector<AbcType>& joint,
    const AbcPoseVelocity& end_effector_v,
    std::vector<AbcType>& joints_v)
  • Parameters:

    Parameter
    Type
    Description
    jointInputJoint angles. For details, please refer to AbcType.
    end_effector_vInputEnd-effector velocity. For details, please refer to AbcPoseVelocity.
    joints_vOutputJoint velocities. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode check_range(const std::vector<AbcType>& j)
  • Parameter:

    Parameter
    Type
    Description
    jInputJoint angles. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates all joint values are within limits. For other error codes, please refer to AbcErrorCode.

  • Method:

    void set_numerical_precision(AbcType precision)
  • Parameter:

    Parameter
    Type
    Description
    precisionInputDesired precision. For details, please refer to AbcType.
  • Return Value:

    None (void).

The admittance control law is defined in the c++\include\core\algo\control\admittance_control.h header file. It computes the joint angles for the next time step based on the current end-effector pose, the desired pose, external forces, and the stiffness and damping parameters.

  • Method:

    AbcErrorCode addmittance_control_law(
    std::unique_ptr<alphabot::ArmKinematics> arm,
    const AbcPose pose,
    const AbcType p_stiffness,
    const AbcType r_stiffness,
    const std::array<AbcType, 6> force,
    const AbcType t,
    const std::vector<AbcType> q,
    std::vector<AbcType> next_q)
  • Parameters:

    Parameter
    Type
    Description
    armInputA unique pointer to an ArmKinematics instance.
    poseInputCurrent end-effector pose.
    p_stiffnessInputTranslational stiffness.
    r_stiffnessInputRotational stiffness.
    forceInputSix-dimensional spatial force applied at the end-effector, ordered as [Mx, My, Mz, Fx, Fy, Fz].
    tInputIntegration time, which must be less than or equal to the duration of one control loop.
    qInputCurrent joint angles.
    next_qOutputJoint angles at the next time step.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    static std::unique_ptr<TorsoKinematics> create(RobotType type)
  • Parameter:

    Parameter
    Type
    Description
    typeInputRobot type. For details, please refer to RobotType.
  • Return Value:

    A std::unique_ptr<TorsoKinematics> on success, otherwise returns nullptr.

  • Method:

    AbcErrorCode forward_kinematics(const std::vector<AbcType>& joints, AbcTorsoPose4D& pose)
  • Parameter:

    Parameter
    Type
    Description
    jointsInputJoint angles. For details, please refer to AbcType.
    poseOutputPose computed by forward kinematics. For details, please refer to AbcTorsoPose4D.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode inverse_kinematics(
    const AbcTorsoPose4D& pose,
    const std::vector<AbcType>& ref_joints,
    std::vector<AbcType>& joints,
    int mode)
  • Parameters:

    Parameter
    Type
    Description
    poseInputThe target pose. For details, please refer to AbcTorsoPose4D.
    ref_jointsInputReference joint angles. For details, please refer to AbcType.
    jointsOutputJoint angles computed by inverse kinematics. For details, please refer to AbcType.
    modeInput- 0: Numerical solution, single-step mode. Suitable when the current pose is close to the target pose; recommended for continuous motion.
    - 1: Numerical solution, multi-step mode. Suitable for larger differences between current and target poses; requires more computation time.
    - 2: Analytical solution.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode forward_velocity(
    const std::vector<AbcType>& joint,
    const std::vector<AbcType>& joints_v,
    AbcPose& end_effector_pose,
    AbcPoseVelocity& end_effector_v)
  • Parameters:

    Parameter
    Type
    Description
    jointInputJoint angles. For details, please refer to AbcType.
    joints_vInputJoint velocities. For details, please refer to AbcType.
    end_effector_poseOutputEnd-effector pose. For details, please refer to AbcPose.
    end_effector_vOutputEnd-effector velocity. For details, please refer to AbcPoseVelocity.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode inverse_velocity(
    const std::vector<AbcType>& joint,
    const AbcPoseVelocity& end_effector_v,
    std::vector<AbcType>& joints_v)
  • Parameters:

    Parameter
    Type
    Description
    jointInputJoint angles. For details, please refer to AbcType.
    end_effector_vInputEnd-effector velocity. For details, please refer to AbcPoseVelocity.
    joints_vOutputJoint velocities. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates success. For other error codes, please refer to AbcErrorCode.

  • Method:

    AbcErrorCode check_range(const std::vector<AbcType>& j)
  • Parameter:

    Parameter
    Type
    Description
    jInputJoint angles. For details, please refer to AbcType.
  • Return Value:

    AbcErrorCode::SUCCESS indicates all joint values are within limits. For other error codes, please refer to AbcErrorCode.