This is python API for ElephantRobotics product
We support Python2, Python3.5 or later.
MyCobot 280 API说明 | MyCobot 280 API Description
MyCobot 320 API说明 | MyCobot 320 API Description
MechArm 270 API说明 | MechArm 270 API Description
MyPalletizer 260 API说明 | MyPalletizer 260 API Description
myAGV API说明 | myAGV API Description
myArm_M&C API说明 | myArm_M&C API Description
Catalogue:
- pymycobot
- MyBuddy
- base_to_single_coords(base_coords, arm)
- collision(left_angles, right_angles)
- collision_switch(state)
- focus_servo(id, servo_id)
- get_acceleration(id)
- get_angle(id, joint_id)
- get_angles(id)
- get_base_coord(id)
- get_base_coords(*args: int)
- get_coord(id, joint_id)
- get_coords(id)
- get_digital_input(id, pin_no)
- get_encoder(id, joint_id)
- get_encoders(id)
- get_end_type(id)
- get_gripper_value(id)
- get_joint_current(id, joint_id)
- get_joint_max_angle(id, joint_id)
- get_joint_min_angle(id, joint_id)
- get_movement_type(id)
- get_plan_acceleration(id=0)
- get_plan_speed(id=0)
- get_reference_frame(id)
- get_robot_id(id)
- get_robot_version(id)
- get_servo_currents(id)
- get_servo_data(id, servo_no, data_id)
- get_servo_status(id)
- get_servo_spees(id)
- get_servo_temps(id)
- get_servo_voltages(id)
- get_speed(id)
- get_system_version(id)
- get_tool_reference(id)
- get_world_reference(id)
- is_all_servo_enable(id)
- is_collision_on()
- is_controller_connected(id=0)
- is_free_mode(id)
- is_gripper_moving(id)
- is_in_position(id, data, mode)
- is_moving(id)
- is_paused(id)
- is_power_on(id=0)
- is_servo_enable(id, servo_id)
- jog_absolute(id, joint_id, angle, speed)
- jog_angle(id, joint_id, direction, speed)
- jog_coord(id, coord_id, direction, speed)
- jog_inc_coord(axis, increment, speed)
- jog_increment(id, joint_id, increment, speed)
- jog_stop(id)
- joint_brake(id, joint_id)
- pause(id)
- power_off(id=0)
- power_on(id=0)
- read_next_error(id=0)
- release_all_servos(id=0)
- release_servo(id, servo_id)
- resume(id)
- send_angle(id, joint, angle, speed)
- send_angles(id, degrees, speed)
- send_coord(id, coord, data, speed)
- send_coords(id, coords, speed, mode)
- set_acceleration(id, acc)
- set_color(id, r=0, g=0, b=0)
- set_digital_output(id, pin_no, pin_signal)
- set_encoder(id, joint_id, encoder, speed)
- set_encoders(id, encoders, speed)
- set_end_type(id, end)
- set_encoders_drag(id, encoders, speeds)
- set_free_mode(id, value)
- set_fresh_mode(id, mode)
- set_gripper_calibration(id)
- set_gripper_state(id, flag)
- set_gripper_value(id, value, speed)
- set_joint_current(id, joint_id, current)
- set_joint_max(id, joint_id, angle)
- set_joint_min(id, joint_id, angle)
- set_movement_type(id, move_type)
- set_pin_mode(id, pin_no, pin_mode)
- set_plan_acceleration(id, acceleration)
- set_plan_speed(id, speed)
- set_pwm_output()
- set_reference_frame(id, rftype)
- set_robot_id(id, new_id)
- set_servo_calibration(id, servo_no)
- set_servo_data(id, servo_no, data_id, value)
- set_speed(id, speed)
- set_tool_reference(id, coords)
- set_world_reference(id, coords)
- stop(id)
- write_base_coord(id, axis, coord, speed)
- write_base_coords(id, coords, speed)
- get_radians(id)
- send_radians(id, radians, speed)
- set_gpio_input(pin)
- set_gpio_mode(pin_no, mode)
- set_gpio_output(pin, v)
- set_gpio_pwm(pin, baud, dc)
- MyBuddyEmoticon
Convert base coordinates to coordinates
-
Parameters
-
coords – a list of base coords value len 6
-
arm – 0 - left. 1 - right
-
-
Returns
coords
Collision detection main program
-
Parameters
-
left_angles – left arm angle len 6.
-
right_angles – right arm angle len 6.
-
-
Returns
int
Collision Detection Switch
-
Parameters
state (int) – 0 - close 1 - open (Off by default)
Power on designated servo
-
Parameters
-
id – 1/2/3 (L/R/W)
-
servo_id – 1 - 6
-
Read acceleration during all moves
-
Parameters
id – 1/2/3 (L/R/W)
Get the angle of a single joint
-
Parameters
-
id (int) – 1/2/3 (L/R/W).
-
joint_id (int) – 1 - 7 (7 is gripper)
-
Get the degree of all joints.
-
Parameters
id – 1/2 (L/R)
-
Returns
A float list of all degree.
-
Return type
list
Get the base coordinates of the single arm
-
Parameters
id – 1/2 (L/R)
Convert coordinates to base coordinates. Pass in parameters or no parameters
-
Parameters
-
coords – a list of coords value(List[float]), length 6 [x(mm), y, z, rx(angle), ry, rz]
-
arm – 0 - left. 1 - right
-
-
Returns
Base coords
Read a single coordinate parameter
-
Parameters
-
id (int) – 1/2/3 (L/R/W).
-
joint_id (int) – 1 - 7 (7 is gripper)
-
Get the coordinates of the robotic arm
-
Parameters
id – 1/2 (L/R).
singal value
-
Parameters
-
id – 1/2 (L/R)
-
pin_no (int) – 1 - 5
-
Obtain the specified joint potential value.
-
Parameters
-
id – 1/2/3 (L/R/W).
-
joint_id – (int) 1 ~ 6
-
-
Returns
0 ~ 4096
Get the six joints of the manipulator
-
Parameters
id – 1/2 (L/R).
-
Returns
The list of encoders
Get end coordinate system
-
Parameters
id – 0/1/2 (ALL/L/R)
-
Returns
0 - flange 1 - tool
Get the value of gripper.
-
Parameters
id – 1/2 (L/R)
-
Returns
gripper value (int)
Get Collision Current
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
joint_id – 1 - 6
-
Gets the maximum movement angle of the specified joint
-
Parameters
-
id – 1/2/3 (L/R/W)
-
joint_id – (int) 1 - 6
-
-
Returns
angle value(float)
Gets the minimum movement angle of the specified joint
-
Parameters
-
id – 1/2/3 (L/R/W)
-
joint_id – (int) 1 - 6
-
-
Returns
angle value(float)
Get movement type
-
Parameters
id – 0/1/2 (ALL/L/R)
-
Returns
1 - movel 0 - moveJ
Get planning acceleration
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
-
Returns
[movel planning acceleration, movej planning acceleration].
Get planning speed
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
-
Returns
[movel planning speed, movej planning speed].
Get the base coordinate system
-
Parameters
id – 0/1/2 (ALL/L/R)
-
Returns
0 - base 1 - tool.
Detect this robot id
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Get cobot version
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Get joint current
-
Parameters
id – 1/2/3 (L/R/W)
-
Returns
value mA
Read the data parameter of the specified address of the steering gear.
-
Parameters
-
id – 1/2/3 (L/R/W)
-
servo_no – Serial number of articulated steering gear, 1 - 6.
-
data_id – Data address.
-
-
Returns
values (0 - 4096) 0 - disable 1 - enable -1 - error
Get joint status
-
Parameters
id – 1/2/3 (L/R/W)
-
Returns
[voltage, sensor, temperature, current, angle, overload], a value of 0 means no error
Get joint speed
-
Parameters
id – 1/2/ (L/R)
-
Returns
list len 6
Get joint temperature
-
Parameters
id – 1/2/3 (L/R/W)
Get joint voltages
-
Parameters
id – 1/2/3 (L/R/W)
-
Returns
volts < 24 V
Get speed
-
Parameters
id – 1/2/3 (L/R/W).
-
Returns
speed
-
Return type
int
Get cobot version
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Get tool coordinate system
-
Parameters
id – 0/1/2 (ALL/L/R)
Get the world coordinate system
-
Parameters
id – 0/1/2 (ALL/L/R)
Determine whether the specified steering gear is connected
-
Parameters
id – 1/2/3 (L/R/W)
-
Returns
0 - disable 1 - enable -1 - error
Get collision detection status
Wether connected with Atom.
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Check if it is free mode
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
-
Returns
0/1
Judge whether the gripper is moving or not
-
Parameters
id – 1/2 (L/R)
-
Returns
0 - not moving 1 - is moving -1 - error data
Judge whether in the position.
-
Parameters
-
id – 0/1/2/3 (ALL/L/R/W).
-
data – A data list, angles or coords. If id is 1/2. data length is 6. If id is 0. data len 13. if id is 3. data len 1
-
mode – 1 - coords, 0 - angles
-
-
Returns
1 - True 0 - False -1 - Error
Detect if the robot is moving
-
Parameters
id – 0/1/2/3 (ALL/L/R/W).
-
Returns
0 - not moving 1 - is moving -1 - error data
Judge whether the manipulator pauses or not.
-
Parameters
id – 0/1/2/3 (ALL/L/R/W).
-
Returns
1 - paused 0 - not paused -1 - error
Adjust robot arm status
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
-
Returns
1 - power on 0 - power off -1 - error data
Determine whether all steering gears are connected
-
Parameters
-
id – 1/2/3 (L/R/W)
-
servo_id – (int) 1 ~ 6
-
-
Returns
0 - disable 1 - enable -1 - error
Absolute joint control
-
Parameters
-
id – 1/2/3 (L/R/W).
-
joint_id – int 1-6.
-
angle – int
-
speed – int (0 - 100)
-
Jog control angle.
-
Parameters
-
id – 1/2/3 (L/R/W).
-
joint_id – int 1-6.
-
direction – 0 - decrease, 1 - increase
-
speed – int (0 - 100)
-
Jog control coord.
-
Parameters
-
id – 1/2/3 (L/R/W).
-
coord_id – int 1-6 (x/y/z/rx/ry/rz).
-
direction – 0 - decrease, 1 - increase
-
speed – int (0 - 100)
-
Double-arm coordinated coordinate stepping
-
Parameters
-
axis – 1 - 6 (x/y/z/rx/ry/rz)
-
increment –
-
speed – 1 - 100
-
step mode
-
Parameters
-
id – 1/2/3 (L/R/W).
-
joint_id – int 1-6.
-
increment –
-
speed – int (1 - 100)
-
Stop jog moving
-
Parameters
id – 1/2/3 (L/R/W).
Make it stop when the joint is in motion, and the buffer distance is positively related to the existing speed
-
Parameters
-
id – 1/2/3 (L/R/W)
-
joint_id – 1 - 6
-
Pause movement
-
Parameters
id – 0/1/2/3 (ALL/L/R/W).
Close communication with Atom.
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Open communication with Atom.
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Robot Error Detection
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Robot turns off torque output
-
Parameters
id – 0/1/2/3 (ALL/L/R/W)
Power off designated servo
-
Parameters
-
id – 1/2/3 (L/R/W)
-
servo_id – 1 - 6.
-
Recovery movement
-
Parameters
id – 0/1/2/3 (ALL/L/R/W).
Send one degree of joint to robot arm.
-
Parameters
-
id – 1/2/3 (L/R/W)
-
joint – 1 ~ 6
-
angle – int
-
speed – 1 ~ 100
-
Send all angles to the robotic arm
-
Parameters
-
id – 1/2 (L/R).
-
degrees – [angle_list] len 6
-
speed – 1 - 100
-
Send a single coordinate to the robotic arm
-
Parameters
-
id – 1/2/3 (L/R/W).
-
coord – 1 ~ 6 (x/y/z/rx/ry/rz)
-
data – Coordinate value
-
speed – 0 ~ 100
-
Send all coords to robot arm.
-
Parameters
-
id – 1/2 (L/R).
-
coords – a list of coords value(List[float]), length 6, [x(mm), y, z, rx(angle), ry, rz]
-
speed – (int) 0 ~ 100
-
mode – (int) 0 - moveJ, 1 - moveL, 2 - moveC
-
Read acceleration during all moves
-
Parameters
-
id – 1/2/3 (L/R/W)
-
acc – 1 - 100
-
Set the light color on the top of the robot arm.
-
Parameters
-
id – 1/2 (L/R)
-
r (int) – 0 ~ 255
-
g (int) – 0 ~ 255
-
b (int) – 0 ~ 255
-
Set atom IO output level
-
Parameters
-
id – 1/2 (L/R)
-
pin_no (int) – 1 - 5
-
pin_signal (int) – 0 / 1
-
Set a single joint rotation to the specified potential value.
-
Parameters
-
id – 1/2/3 (L/R/W).
-
joint_id – 1 - 6.
-
encoder – The value of the set encoder.
-
Set the six joints of the manipulator to execute synchronously to the specified position.
-
Parameters
-
id – 1/2 (L/R).
-
encoders – A encoder list, length 6.
-
speed – speed 1 ~ 100
-
Set end coordinate system
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
end – 0 - flange, 1 - tool
-
Send all encoders and speeds
-
Parameters
- encoders - (
list
) : encoders list. - speeds - Obtained by the get_servo_speeds() method
- encoders - (
set free mode
-
Parameters
-
id – 0/1/2/3 (ALL/L/R/W)
-
value – 0 - close 1 - open
-
Set command refresh mode
-
Parameters
-
id – 1/2 (L/R).
-
mode – int 1 - Always execute the latest command first. 0 - Execute instructions sequentially in the form of a queue.
-
Set the current position to zero, set current position value is 2048.
-
Parameters
id – 1/2 (L/R)
Set gripper switch state
-
Parameters
-
id – 1/2 (L/R)
-
flag (int) – 0 - close, 1 - open
-
Set gripper value
-
Parameters
-
id – 1/2 (L/R)
-
value (int) – 0 ~ 100
-
speed (int) – 0 ~ 100
-
Set Collision Current
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
joint_id – 1 - 6
-
current – current value
-
Set the joint maximum angle
-
Parameters
-
id – 1/2/3 (L/R/W)
-
joint_id – int 1-6.
-
angle – 0 ~ 180
-
Set the joint minimum angle
-
Parameters
-
id – 1/2/3 (L/R/W)
-
joint_id – int 1-6.
-
angle – 0 ~ 180
-
Set movement type
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
move_type – 1 - movel, 0 - moveJ
-
Set the state mode of the specified pin in atom.
-
Parameters
-
id – 1/2 (L/R)
-
pin_no (int) – pin number (1 - 5).
-
pin_mode (int) – 0 - input, 1 - output
-
Set planning acceleration
-
Parameters
-
id – 0/1/2/3 (ALL/L/R/W)
-
acceleration (int) – (0 ~ 100).
-
Set planning speed
-
Parameters
-
id – 0/1/2/3 (ALL/L/R/W)
-
speed (int) – (0 ~ 100).
-
Set PWM output
Set the base coordinate system
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
rftype – 0 - base 1 - tool.
-
Set this robot id
-
Parameters
-
id – 0/1/2/3 (ALL/L/R/W)
-
new_id – 1 - 253
-
The current position of the calibration joint actuator is the angle zero point,
and the corresponding potential value is 2048.
-
Parameters
-
id – 1/2/3 (L/R/W)
-
servo_no – Serial number of articulated steering gear, 1 - 6.
-
Set the data parameters of the specified address of the steering gear
-
Parameters
-
id – 1/2/3 (L/R/W)
-
servo_no – Serial number of articulated steering gear, 1 - 6.
-
data_id – Data address.
-
value – 0 - 4096
-
Set speed value
-
Parameters
-
id – 1/2/3 (L/R/W)
-
speed (int) – 0 - 100
-
Set tool coordinate system
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
coords – a list of coords value(List[float]), length 6. [x(mm), y, z, rx(angle), ry, rz]
-
Set the world coordinate system
-
Parameters
-
id – 0/1/2 (ALL/L/R)
-
coords – a list of coords value(List[float]), length 6 [x(mm), y, z, rx(angle), ry, rz]
-
Stop moving
-
Parameters
id – 0/1/2/3 (ALL/L/R/W).
Base single coordinate movement
-
Parameters
-
id – 1/2 (L/R)
-
axis – 1 - 6 (x/y/z/rx/ry/rz)
-
coord – Coordinate value
-
speed – 1 - 100
-
base coordinate move
-
Parameters
-
id – 1/2 (L/R)
-
coords – coords: a list of coords value(List[float]), length 6, [x(mm), y, z, rx(angle), ry, rz]
-
speed – 1 - 100
-
Get the radians of all joints
-
Parameters
id – 1/2 (L/R)
-
Returns
A list of float radians [radian1, …]
-
Return type
list
Send the radians of all joints to robot arm
-
Parameters
-
id – 1/2 (L/R).
-
radians – a list of radian values( List[float]), length 6
-
speed – (int )1 ~ 100
-
Set GPIO input value.
-
Parameters
pin – (int)pin number.
Init GPIO module, and set BCM mode.
-
Parameters
-
pin_no – (int)pin number.
-
mode – 0 - input 1 - output
-
Set GPIO output value.
-
Parameters
-
pin – (int)pin number.
-
v – (int) 0 / 1
-
Set GPIO PWM value.
-
Parameters
-
pin – (int)pin number.
-
baud – (int) 10 - 1000000
-
dc – (int) 0 - 100
-
API for playing emoticons
- Parameters
-
file_path -
[[path, time],...]
The absolute path of facial expression video and the length of time to play.Time in seconds. -
window_size -
(Length, width)
Size of the playback window (default is full screen). -
loop - Loop playback or not (only once by default).
-
from pymycobot import MyBuddyEmoticon
import time
# playlist
file_path = [
['/home/er/emo/look_happy.mp4', 10],
]
# Initialize the object and set it to loop playback
em = MyBuddyEmoticon(file_path, loop = True)
# Start playing
em.start()
# Pause playback after 3 seconds
# time.sleep(3)
# em.pause()
# Continue playing
# em.run()
# The main thread waits for the completion of playback
em.join()
Add Playback File
-
Parameters
path_time – [path, time] The video address to be added and the running time
Delete the element with the specified subscript in the playlist list
-
Parameters
index – The subscript of the element in the playlist to be deleted
Get Playfile List
-
Returns
list
Wait for the thread playing the video to finish
Pause playback
Continue playing
Start playing
More demo can go to here.