Python API for serial communication of MyCobot.
Project description
pymycobot
This is python API for mycobot.
We support Python2, Python3.5 or later.
Class:
MyCobot
Overall status
power_on()
-
Description
Robot arm power up.
power_off()
-
Description
Robot arm power down.
is_power_on()
-
Description
Adjust robot arm wether power on.
-
Returns
- 1: power on
- 0: power off
- -1: error
set_free_mode()
-
Description
Robot arm into free moving mode.
MDI mode and operation
get_angles()
-
Description
Get the degree of all joints.
-
Returns
list
: A float list of degree.
send_angle()
-
Description
Send one degree of joint to robot arm.
-
Parameters
id: Joint id(common.Angle)
degree: degree value(float)
speed: (int)
-
Example
from pymycobot.mycobot import MyCobot from pymycobot.common import Angle mycobot = MyCobot('/dev/ttyUSB0') mycobot.send_angle(Angle.J2.value, 10, 50)
send_angles()
-
Description
Send the degrees of all joints to robot arm.
-
Parameters
degrees: a list of degree value(List[float])
speed: (int)
-
Example
from pymycobot.mycobot import MyCobot from pymycobot.common import Angle mycobot = MyCobot('/dev/ttyUSB0') mycobot.send_angles([0,0,0,0,0,0], 80)
get_radians()
-
Description
Get the radians of all joints.
-
Returns
list
: A float list of radian.
send_radians()
-
Description
Send the radians of all joint to robot arm.
-
Parameters
degrees: a list of radian value(List[float])
speed: (int)
-
Example
from pymycobot.mycobot import MyCobot from pymycobot.common import Angle mycobot = MyCobot('/dev/ttyUSB0') mycobot.send_angles_by_radian([1,1,1,1,1,1], 70)
get_coords()
-
Description
Get the Coords from robot arm.
-
Returns
list
: A float list of coord.
send_coord()
-
Description
Send one coord to robot arm.
-
Parameters
id: coord name(common.Coord)
coord: coord value(float)
speed: (int)
-
Example
from pymycobot.mycobot import MyCobot from pymycobot.common import Coord mycobot = MyCobot('/dev/ttyUSB0') mycobot.send_coord(Coord.X.value, -40, 70)
send_coords()
-
Description
Send all coords to robot arm.
-
Parameters
coords: a list of coords value(List[float])
speed: (int)
-
Example
from pymycobot.mycobot import MyCobot from pymycobot.common import Coord mycobot = MyCobot('/dev/ttyUSB0') mycobot.send_coords([160, 160, 160, 0, 0, 0], 70, 0)
pause()
-
Description
Pause movement.
resume()
-
Description
Recovery movement.
stop()
-
Description
Stop moving.
is_paused()
-
Description
Judge whether the manipulator pauses or not.
-
Returns
bool:
1
- paused0
- not paused-1
- error
is_in_position()
-
Description
Judge whether in the position.
-
Returns
bool:
1
- true0
- false-1
- error
is_moving()
-
Description
Judge whether the manipulator is moving or not.
-
Returns
bool:
True
- moving,False
- not moving.
JOG mode and operation
jog_angle()
-
Description
Jog control angle
-
Parameters
joint id: (
int
) 1 ~ 6
jog_coord()
-
Description
Jog control coord.
-
Parameters
coord id: (
int
) 1 ~ 6
jog_stop()
-
Description
Stop jog move.
Running status and Settings
get_speed()
-
Description
Get speed.
-
Returns
speed: (int)
set_speed()
-
Description
Set speed.
-
Parameters
speed: (
int
) 0 ~ 100
get_joint_min_angle()
-
Description
Gets the minimum movement angle of the specified joint
-
Parameters
joint id: (
int
) -
Returns
angle: (int)
get_joint_max_angle()
-
Description
Gets the maximum movement angle of the specified joint
-
Parameters
joint id: (
int
) -
Returns
angle: (int)
Servo control
is_servo_enable()
-
Description
Determine whether all steering gears are connected
-
Parameters
servo id: (
int
) -
Returns
speed: (int)
0
: disable1
: enbale-1
: error
is_all_servo_enable()
-
Description
Determine whether the specified steering gear is connected
-
Returns
flag: (int)
0
: disable1
: enbale-1
: error
Atom IO
set_led_color()
-
Description
Set the color of the light on the top of the robot arm.
-
Parameters
rgb: (
string
) like: "FF0000"
set_claw()
-
Description
Set the color of the light on the top of the robot arm.
-
Parameters
flag: (
int
) 0 - open, 1 - close
Angle
Description
Instance class of joint. It's recommended to use this class to select joint.
Coord
Description
Instance class of coord. It's recommended to use this class to select coord.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pymycobot-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc64f9f91c6450dc9aefc92cf4965301e2115c4d10912a93055457b576f2a5a3 |
|
MD5 | 7fb3822e6d19bfe31d54fed3e687e45c |
|
BLAKE2b-256 | ed2400a53b6d8157558a1612eff64d2f4cd092ae587180034ed641c1f8321fd5 |