Xarm Robot
XarmRobot
Bases: Robot
Control the xArm robot arm with SDK.
Usage:
xarm = XarmRobot()
xarm.do(HandControl(...))
Attributes:
Name | Type | Description |
---|---|---|
ip |
The IP address of the xArm robot. |
|
arm |
The XArmAPI instance for controlling the robot. |
|
home_pos |
The home position of the robot arm. |
Source code in mbodied/robots/xarm_robot.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
__init__(ip='192.168.1.228', use_realsense=False)
Initializes the XarmRobot and sets up the robot arm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip |
str
|
The IP address of the xArm robot. |
'192.168.1.228'
|
use_realsense |
bool
|
Whether to use a RealSense camera for capturing images |
False
|
Source code in mbodied/robots/xarm_robot.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
capture()
Captures an image from the robot camera.
Source code in mbodied/robots/xarm_robot.py
131 132 133 134 135 136 |
|
do(motion)
Executes HandControl(s).
HandControl is in meters and radians.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
motion |
HandControl | list[HandControl]
|
The HandControl motion(s) to be executed. |
required |
Source code in mbodied/robots/xarm_robot.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
get_observation()
Captures an image for recording.
Source code in mbodied/robots/xarm_robot.py
138 139 140 |
|
get_state()
Gets the current pose (absolute HandControl) of the robot arm.
Returns:
Type | Description |
---|---|
HandControl
|
The current pose of the robot arm. |
Source code in mbodied/robots/xarm_robot.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
prepare_action(old_pose, new_pose)
Calculates the action between two poses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
old_pose |
HandControl
|
The old pose(state) of the hardware. |
required |
new_pose |
HandControl
|
The new pose(state) of the hardware. |
required |
Returns:
Type | Description |
---|---|
HandControl
|
The action to be taken between the old and new poses. |
Source code in mbodied/robots/xarm_robot.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|