Skip to content

Commit 2ae5088

Browse files
Zachary ZhangZachary Zhang
authored andcommitted
update: python api
1 parent 07e3e8c commit 2ae5088

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

API/Python/pymycobot/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import enum
22

33
class Angle(enum.Enum):
4+
45
J1 = '01'
56
J2 = '02'
67
J3 = '03'
@@ -10,11 +11,11 @@ class Angle(enum.Enum):
1011

1112

1213
class Coord(enum.Enum):
14+
1315
X = '01'
1416
Y = '02'
1517
Z = '03'
1618
Rx = '04'
1719
Ry = '05'
1820
Rz = '06'
1921

20-
#

API/Python/pymycobot/mycobot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def jog_angle(self, joint_id, direction, speed):
217217
speed = self._complement_zero(speed, digit=2)
218218
command += '{}{}{}fa'.format(joint_id, direction, speed)
219219
self._write(command)
220-
220+
221221
def jog_coord(self, coord, direction, speed):
222222
'''Coord control
223223
@@ -268,7 +268,7 @@ def is_moving(self):
268268

269269
def pause(self):
270270
self._write('fefe0226fa')
271-
271+
272272
def resume(self):
273273
self._write('fefe0228fa')
274274

@@ -280,7 +280,7 @@ def is_paused(self):
280280
data = self._read()
281281
flag = int(data.hex(), 16)
282282
return False if flag else True
283-
283+
284284
def is_in_position(self, coords):
285285
if len(coords) != 6:
286286
print('The lenght of coords is not right')
@@ -349,7 +349,7 @@ def _parse_data(self, data, name):
349349
def _hex_to_degree(self, _hex):
350350
_int = self._hex_to_int(_hex)
351351
return _int * 18 / 314
352-
352+
353353
def _hex_to_int(self, _hex):
354354
_int = int(_hex, 16)
355355
if _int > 0x8000:
@@ -377,7 +377,7 @@ def _coord_to_hex(self, coord):
377377
s = str(hex(int(coord)))[2:]
378378
s = self._complement_zero(s)
379379
return s
380-
380+
381381
def _complement_zero(self, s, digit=4):
382382
s_len = len(s)
383383
if s_len == digit:

API/Python/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'''
1212

1313
setuptools.setup(
14-
name="pymycobot", # Replace with your own username
14+
name="pymycobot",
1515
version="0.0.1",
1616
author="Zachary Zhang",
1717
author_email="[email protected]",
@@ -28,3 +28,4 @@
2828
install_requires=['pyserial'],
2929
python_requires='2.7, >=3.5',
3030
)
31+

0 commit comments

Comments
 (0)