Python:
Drag Teaching ConfigurationDragTeach
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:
rm_start_drag_teach(self, trajectory_record: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
trajectory_record | int | Trajectory record during the drag teaching, 0: no record, 1: trajectory record |
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_stop_drag_teach(self) -> int:
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_start_multi_drag_teach(self, mode: int, singular_wall: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
mode | int | Drag 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_wall | int | Available 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:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_start_multi_drag_teach_new(self, param: rm_multi_drag_teach_t) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
param | rm_multi_drag_teach_t | Multiple drag teaching parameters |
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_set_drag_teach_sensitivity(self, grade: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
grade | int | Sensitivity 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:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_get_drag_teach_sensitivity(self) -> int:
- Return value: tuple[int,int]: a tuple containing two elements.
- int: state codes executed by functions.
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- int: Sensitivity grade
Parameter | Type | Description |
---|---|---|
- | int | Sensitivity grades 0−100 in %, the smaller the number, the lower the sensitivity. The initial sensitivity is kept when it is 100. |
- Usage demo
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:
rm_drag_trajectory_origin(self, block: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
block | int | Blocking 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:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_run_drag_trajectory(self, timeout: int) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
timeout | int | Blocking 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
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_pause_drag_trajectory(self) -> int:
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_continue_drag_trajectory(self) -> int:
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_stop_drag_trajectory(self) -> int:
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_set_force_position(self, sensor: int, mode: int, direction: int, force: float) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
sensor | int | 0: 1-DoF force, 1: 6-DoF force. |
mode | int | 0: force control in the base frame, 1: force control in the tool frame. |
direction | int | Force 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. |
force | float | Magnitude of the force, in N. |
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_set_force_position_new(self, param: rm_force_position_t) -> int:
- Parameter description:
Parameter | Type | Description |
---|---|---|
param | rm_force_position_t | Force-position hybrid control parameters. |
Jump to rm_force_position_t for details of the structure
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_stop_force_position(self) -> int:
- Return value: State codes executed by functions:
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Usage demo
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:
rm_save_trajectory(self, file_path: str) -> tuple[int, int]:
- Parameter description:
Parameter | Type | Description |
---|---|---|
file_path | str | Path 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.
- int: state codes executed by functions.
Parameter | Type | Description |
---|---|---|
0 | int | Success. |
1 | int | The controller returns false, indicating that the parameters are sent incorrectly or the robotic arm state is wrong. |
-1 | int | The data transmission fails, indicating that a problem occurs during the communication. |
-2 | int | The data reception fails, indicating that a problem occurs during the communication, or the controller has a return timeout. |
-3 | int | The return value parse fails, indicating that the received data format is incorrect or incomplete. |
- Total number of trajectory points
Parameter | Type | Description |
---|---|---|
- | int | Total number of trajectory points |
- Usage demo
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()