From 98c41cb51b9f0adbe0900c732bbcdbf6661134d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=AB=8B=E5=86=9B?= Date: Tue, 29 Dec 2020 10:10:53 +0800 Subject: [PATCH] update(api): add new method. --- scripts/control_marker.py | 3 +++ scripts/pythonAPI/mycobot.py | 3 +++ scripts/test.py | 1 + 3 files changed, 7 insertions(+) diff --git a/scripts/control_marker.py b/scripts/control_marker.py index 77a03a3..6257b5d 100644 --- a/scripts/control_marker.py +++ b/scripts/control_marker.py @@ -173,6 +173,9 @@ def listener(): menu_handler.insert('First Entry', callback=processFeedback) menu_handler.insert('Second Entry', callback=processFeedback) + if not coords: + coords = [0,0,0,0,0,0] + rospy.loginfo('error [101]: can not get coord values') # initial position position = Point(coords[1] / -1000, coords[0] / 1000, coords[2] / 1000) # orientation = Quaternion(coords[4] / 100, coords[3] / 100, coords[5] / 100, 1) diff --git a/scripts/pythonAPI/mycobot.py b/scripts/pythonAPI/mycobot.py index 367ed71..9ee7a7a 100644 --- a/scripts/pythonAPI/mycobot.py +++ b/scripts/pythonAPI/mycobot.py @@ -50,6 +50,9 @@ class MyCobot(): def power_off(self): self._write('fe fe 02 11 fa') + def set_free_mode(self): + self._write('fefe0213fa') + def get_angles(self): '''Get all angle return a list diff --git a/scripts/test.py b/scripts/test.py index 2860838..d4e38bf 100644 --- a/scripts/test.py +++ b/scripts/test.py @@ -4,4 +4,5 @@ from pythonAPI.mycobot import MyCobot if __name__ == '__main__': mycobot = MyCobot() mycobot.set_color("ff0000") + print(mycobot.get_angles_of_radian())