Skip to content

Robotic Arm Teaching Command armTeachMove

Robotic arm teaching control commands include step and teaching control of joints, position, and orientation.

Joint step rm_set_joint_step()

  • Method prototype:
C
int rm_set_joint_step(rm_robot_handle * handle,int joint_num,float step,int v,int block)

Jump to rm_robot_handle for details of the structure

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
joint_numInputJoint numbers 1−7.
stepInputStep angle.
vInputVelocity ratio: 1−100, indicating the percentage of the planned velocity and acceleration to the maximum linear velocity and acceleration of the joint.
blockInputBlocking settings:
multi-thread mode: 0: non-blocking mode, immediately return after sending commands; 1: blocking mode, return after the robotic arm reaches the target position or the planning fails.
Single-thread mode: 0: non-blocking mode; other values: blocking mode, and timeout period setting according to the movement time, in s.

WARNING

For single-thread blocking mode, set the timeout period to return the trajectory after running within the timeout period.

  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

  • Usage demo
C
// By default, the current thread mode is multi-thread, blocking mode, and forward movement of joint 1 for 10° at a velocity of 50%
rm_set_joint_step(robot_handle, 1, 10, 50, 1);

Position step rm_set_pos_step()

In the current work frame, set the position step.

  • Method prototype:
C
int rm_set_pos_step(rm_robot_handle * handle,rm_pos_teach_type_e type,float step,int v,int block)

Jump to rm_robot_handle for details of the structureJump to [rm_pos_teach_type_e](../type/typeList#rm-pos-teach-type-e-position teaching direction) for details of types

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
typeInputTeaching type.
stepInputStep distance in m, with an accuracy of 0.001 mm.
vInputVelocity ratio: 1−100, indicating the percentage of the planned velocity and acceleration to the maximum linear velocity and acceleration of the joint.
blockInputBlocking settings:
multi-thread mode: 0: non-blocking mode, immediately return after sending commands; 1: blocking mode, return after the robotic arm reaches the target position or the planning fails.
Single-thread mode: 0: non-blocking mode; other values: blocking mode, and timeout period setting according to the movement time, in s.

WARNING

For single-thread blocking mode, set the timeout period to return the trajectory after running within the timeout period.

  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

WARNING

The reference frame is the current work frame by default, which can be modified to the tool frame by calling rm_set_teach_frame.

  • Usage demo
C
// By default, the current thread mode is multi-thread, blocking mode, and forward step of 0.05 m along the X-axis of the current work frame
rm_set_pos_step(robot_handle, RM_X_DIR_E, 0.05f, 50, 1);

Orientation step rm_set_ort_step()

In the current work frame, set the orientation step.

  • Method prototype:
C
int rm_set_ort_step(rm_robot_handle * handle,rm-ort-teach-type-e type,float step,int v,int block)

Jump to rm_robot_handle for details of the structureJump to [rm-ort-teach-type-e](../type/typeList#rm-ort-teach-type-e-orientation teaching direction) for details of types

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
typeInputTeaching type.
stepInputStep radian in rad, with an accuracy of 0.001 rad.
vInputVelocity ratio: 1−100, indicating the percentage of the planned velocity and acceleration to the maximum linear velocity and acceleration of the joint.
blockInputBlocking settings:
multi-thread mode: 0: non-blocking mode, immediately return after sending commands; 1: blocking mode, return after the robotic arm reaches the target position or the planning fails.
Single-thread mode: 0: non-blocking mode; other values: blocking mode, and timeout period setting according to the movement time, in s.

WARNING

For single-thread blocking mode, set the timeout period to return the trajectory after running within the timeout period.

  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

WARNING

The reference frame is the current work frame by default, which can be modified to the tool frame by calling rm_set_teach_frame.

  • Usage demo
C
// By default, the current thread mode is multi-thread, blocking mode, and backward rotation of 0.5 rad along the X-axis at a velocity of 20%
rm_set_ort_step(robot_handle, RM_RX_ROTATE_E, -0.5f, 20, 1);

Set teaching frame rm_set_teach_frame()

  • Method prototype:
C
int rm_set_teach_frame(rm_robot_handle * handle,int frame_type)

Jump to rm_robot_handle for details of the structureJump to [rm-ort-teach-type-e](../type/typeList#rm-ort-teach-type-e-orientation teaching direction) for details of types

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
frame_typeInput0: work frame, 1: tool frame.
  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

  • Usage demo
C
// Set the teaching frame as the tool frame
if (rm_set_teach_frame(robot_handle, 1) == 0) {  
    printf("Teach Frame set successfully\n");
} else {  
    printf("Failed to get teach frame\n");  
}

Get teaching frame rm_get_teach_frame()

  • Method prototype:
C
int rm_get_teach_frame(rm_robot_handle * handle,int frame_type)

Jump to rm_robot_handle for details of the structureJump to [rm-ort-teach-type-e](../type/typeList.md#rm-ort-teach-type-e-orientation teaching direction) for details of types

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
frame_typeInput0: work frame, 1: tool frame.
  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

  • Usage demo
C
// Get the current teaching frame 
int frame_type = -1;  
if (rm_get_teach_frame(&handle, &frame_type) == 0) {  
    printf("Current teach frame: %d\n", frame_type);
} else {  
    printf("Failed to get teach frame\n");  
}

Joint teaching rm_set_joint_teach()

  • Method prototype:
C
int rm_set_joint_teach(rm_robot_handle * handle,int joint_num,int direction,int v)

Jump to rm_robot_handle for details of the structure

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
joint_numInputTeaching joint numbers 1−7.
directionInputTeaching direction, 0: backward, 1: forward.
vInputVelocity ratio: 1−100, indicating the percentage of the planned velocity and acceleration to the maximum linear velocity and acceleration of the joint.
  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

  • Usage demo
C
//Joint 1 teaching forward at a velocity of 50%
rm_set_joint_teach(robot_handle, 1, 1, 50);

Cartesian spatial position teaching rm_set_pos_teach()

In the current work frame, set Cartesian spatial position teaching.

  • Method prototype:
C
int rm_set_pos_teach(rm_robot_handle * handle,rm_pos_teach_type_e type,int direction,int v)

Jump to rm_robot_handle and [rm_pos_teach_type_e](/robot/api/c/type/typeList#rm-pos-teach-type-e-position teaching direction) for details of the structure

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
typeInputTeaching type.
directionInputTeaching direction, 0: backward, 1: forward.
vInputVelocity ratio: 1−100, indicating the percentage of the planned velocity and acceleration to the maximum linear velocity and acceleration of the joint.
  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

WARNING

The reference frame is the current work frame by default, which can be modified to the tool frame by calling rm_set_teach_frame.

  • Usage demo
C
// Teaching forward along the X-axis of the current work frame at a velocity of 50%
rm_set_pos_teach(robot_handle, RM_X_DIR_E, 1, 50);

Cartesian spatial orientation teaching rm_set_ort_teach()

In the current work frame, set Cartesian spatial orientation teaching.

  • Method prototype:
C
int rm_set_ort_teach(rm_robot_handle * handle,rm-ort-teach-type-e type,int direction,int v)

Jump to rm_robot_handle for details of the structureJump to [rm-ort-teach-type-e](../type/typeList.md#rm-ort-teach-type-e-orientation teaching direction) for details of types

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
typeInputTeaching type.
directionInputTeaching direction, 0: backward, 1: forward.
vInputVelocity ratio: 1−100, indicating the percentage of the planned velocity and acceleration to the maximum linear velocity and acceleration of the joint.
  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

WARNING

The reference frame is the current work frame by default, which can be modified to the tool frame by calling rm_set_teach_frame.

  • Usage demo
C
// Orientation teaching in blocking mode to rotate backward along the X-axis at a velocity of 20%
rm_set_ort_teach(robot_handle, RM_RX_ROTATE_E, 0, 20);

Stop teaching rm_set_stop_teach()

  • Method prototype:
C
int rm_set_stop_teach(rm_robot_handle * handle)

Jump to rm_robot_handle for details of the structure

  • Parameter description:
ParameterTypeDescription
handleInputRobotic arm handle.
  • Return value:

0 represents success. For other error codes, please refer to the API2 Error Codes.

  • Usage demo
C
// Stop teaching
if (rm_set_stop_teach(robot_handle) == 0) {  
    printf("Teach stop successfully\n");
} else {  
    printf("Failed to stop teach\n");  
}