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
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 141 142 143 144 145 146 147 148 149 150 151 152 |
|
__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
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 |
|
capture()
Captures an image from the robot camera.
Source code in mbodied/robots/xarm_robot.py
143 144 145 146 147 148 |
|
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
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
get_observation()
Captures an image for recording.
Source code in mbodied/robots/xarm_robot.py
150 151 152 |
|
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
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
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
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|