Skip to content

Drag Teaching Configuration DragTeach

It is used for the drag teaching configuration. During the drag teaching, the RealMan robotic arm records the drag trajectory and replays the trajectory according to the user's commands. The following is a detailed description of the member functions of the drag teaching configuration DragTeach, including the method prototype, parameter description, return value, and usage demo.

Start the drag teaching rm_start_drag_teach()

  • Method prototype:
python
rm_start_drag_teach(self, trajectory_record: int) -> int:
  • Parameter description:
ParameterTypeDescription
trajectory_recordintTrajectory record during the drag teaching, 0: no record, 1: trajectory record
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_start_drag_teach(1))

arm.rm_delete_robot_arm()

Stop the drag teaching rm_stop_drag_teach()

  • Method prototype:
python
rm_stop_drag_teach(self) -> int:
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_stop_drag_teach())

arm.rm_delete_robot_arm()

Start the multiple drag teaching rm_start_multi_drag_teach()

  • Method prototype:
python
rm_start_multi_drag_teach(self, mode: int, singular_wall: int) -> int:
  • Parameter description:
ParameterTypeDescription
modeintDrag teaching mode
0: current loop mode,
1: position-only drag in the 6-DoF force mode,
2: orientation-only drag in the 6-DoF force mode,
3: position-orientation drag in the 6-DoF force mode.
singular_wallintAvailable only for the drag teaching in the 6-DoF force mode to enable or disable the drag singular wall,
0: disable drag singular wall,
1: enable drag singular wall.
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

# Set the current loop drag teaching
print(arm.rm_start_multi_drag_teach(0, 0))

arm.rm_delete_robot_arm()

Start the multiple drag teaching (new parameters) rm_start_multi_drag_teach_new()

  • Method prototype:
python
rm_start_multi_drag_teach_new(self, param: rm_multi_drag_teach_t) -> int:
  • Parameter description:
ParameterTypeDescription
paramrm_multi_drag_teach_tMultiple drag teaching parameters
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

param = rm_multi_drag_teach_t((0, 1, 1, 0, 1, 0), 0, 1)
result1 = arm.rm_start_multi_drag_teach_new(param)
time.sleep(2)
result2 = arm.rm_set_stop_teach()

arm.rm_delete_robot_arm()

Set the drag teaching sensitivity of the current loop rm_set_drag_teach_sensitivity()

  • Method prototype:
python
rm_set_drag_teach_sensitivity(self, grade: int) -> int:
  • Parameter description:
ParameterTypeDescription
gradeintSensitivity grades 0−100 in %, the smaller the number, the lower the sensitivity. The initial sensitivity is kept when it is 100.
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_set_drag_teach_sensitivity(50))

arm.rm_delete_robot_arm()

Get the drag teaching sensitivity of the current loop rm_get_drag_teach_sensitivity()

  • Method prototype:
python
rm_get_drag_teach_sensitivity(self) -> int:
  • Return value: tuple[int,int]: a tuple containing two elements.
  1. int: state codes executed by functions.
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  1. int: Sensitivity grade
ParameterTypeDescription
-intSensitivity grades 0−100 in %, the smaller the number, the lower the sensitivity. The initial sensitivity is kept when it is 100.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_get_drag_teach_sensitivity())

arm.rm_delete_robot_arm()

Move to the trajectory origin rm_drag_trajectory_origin()

Before the trajectory replay, it is required to move the robotic arm to the trajectory origin. If the setting is correct, the robotic arm will move to the trajectory origin at a speed of 20

  • Method prototype:
python
rm_drag_trajectory_origin(self, block: int) -> int:
  • Parameter description:
ParameterTypeDescription
blockintBlocking 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, in s.
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

# Move to the trajectory origin in the blocking mode
print(arm.rm_drag_trajectory_origin(1))

arm.rm_delete_robot_arm()

Start the drag teaching replay rm_run_drag_trajectory()

It is available only after the drag teaching is complete, and the robotic arm is located at the trajectory origin. The rm_drag_trajectory_origin interface can be called to move the robotic arm to the trajectory origin.

  • Method prototype:
python
rm_run_drag_trajectory(self, timeout: int) -> int:
  • Parameter description:
ParameterTypeDescription
timeoutintBlocking 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, in s.
  • Return value: State codes executed by functions
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_run_drag_trajectory(1))

arm.rm_delete_robot_arm()

Pause the trajectory replay rm_pause_drag_trajectory()

  • Method prototype:
python
rm_pause_drag_trajectory(self) -> int:
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_pause_drag_trajectory())

arm.rm_delete_robot_arm()

Continue the trajectory replay rm_continue_drag_trajectory()

Control the continuation of the robotic arm after a pause during the trajectory replay.

  • Method prototype:
python
rm_continue_drag_trajectory(self) -> int:
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_continue_drag_trajectory())

arm.rm_delete_robot_arm()

Stop the trajectory replay rm_stop_drag_trajectory()

Control the stop of the robotic arm during the trajectory replay.

  • Method prototype:
python
rm_stop_drag_trajectory(self) -> int:
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_stop_drag_trajectory())

arm.rm_delete_robot_arm()

Set the force-position hybrid control rm_set_force_position()

In Cartesian space trajectory planning, this function is available to ensure that the contact force of the end effector is constant when the force is not in the same direction as the robotic arm movement. Turn on the force-position hybrid control, perform the Cartesian space movement, and wait for 2s to issue the next movement command after receiving the feedback of the movement completion.

  • Method prototype:
python
rm_set_force_position(self, sensor: int, mode: int, direction: int, force: float) -> int:
  • Parameter description:
ParameterTypeDescription
sensorint0: 1-DoF force, 1: 6-DoF force.
modeint0: force control in the base frame, 1: force control in the tool frame.
directionintForce control direction, 0: along the X-axis, 1: along the Y-axis, 2: along the Z-axis, 3: along the RX orientation, 4: along the RY orientation, 5: along the RZ orientation.
forcefloatMagnitude of the force, in N.
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_set_force_position(1, 0, 2, 5))

arm.rm_delete_robot_arm()

Set the force-position hybrid control (new parameters) rm_set_force_position_new()

In Cartesian space trajectory planning, this function is available to ensure that the contact force of the end effector is constant when the force is not in the same direction as the robotic arm movement. Turn on the force-position hybrid control, perform the Cartesian space movement, and wait for 2s to issue the next movement command after receiving the feedback of the movement completion.

  • Method prototype:
python
rm_set_force_position_new(self, param: rm_force_position_t) -> int:
  • Parameter description:
ParameterTypeDescription
paramrm_force_position_tForce-position hybrid control parameters.

Jump to rm_force_position_t for details of the structure

  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

arm.rm_movej_p([0.2, 0, 0.3, 3.142, 0, 0], 20, 0, 0, 1)
param = rm_force_position_t(1, 0, (3, 3, 4, 3, 3, 3), (0, 0, 1, 0, 0, 0), (0.1, 0.1, 0.1, 10, 10, 10))
for i in range(3):
    result1 = arm.rm_movel([0.2, 0, 0.3, 3.142, 0, 0], 20, 0, 0, 1)
    result2 = arm.rm_set_force_position_new(param)
    result3 = arm.rm_movel([0.3, 0, 0.3, 3.142, 0, 0], 20, 0, 0, 1)

arm.rm_stop_force_position()
arm.rm_delete_robot_arm()

Stop the force-position hybrid control rm_stop_force_position()

  • Method prototype:
python
rm_stop_force_position(self) -> int:
  • Return value: State codes executed by functions:
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_stop_force_position())

arm.rm_delete_robot_arm()

Save the drag teaching trajectory rm_save_trajectory()

  • Method prototype:
python
rm_save_trajectory(self, file_path: str) -> tuple[int, int]:
  • Parameter description:
ParameterTypeDescription
file_pathstrPath and name of the file to save the trajectory, e.g., c:/rm_test.txt
  • Return value: tuple[int,int]: a tuple containing two elements.
  1. int: state codes executed by functions.
ParameterTypeDescription
0intSuccess.
1intThe controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong.
-1intThe data transmission fails, indicating that a problem occurs during the communication.
-2intThe data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout.
-3intThe return value parse fails, indicating that the received data format is incorrect or incomplete.
  1. Total number of trajectory points
ParameterTypeDescription
-intTotal number of trajectory points
  • Usage demo
python
from Robotic_Arm.rm_robot_interface import *

# Instantiate the RoboticArm class
arm = RoboticArm(rm_thread_mode_e.RM_TRIPLE_MODE_E)

# Create the robotic arm connection and print the connection ID
handle = arm.rm_create_robot_arm("192.168.1.18", 8080)
print(handle.id)

print(arm.rm_save_trajectory("H:/Desktop/example.txt"))

arm.rm_delete_robot_arm()