datas.append(round(data.position[3] * 52.297, 2)) datas.append(round(data.position[4] * 52.297, 2)) datas.append(round(data.position[5] * 52.297, 2)) # move when postion change if cmp(self.postion, datas) != 0: self.postion = datas print "change postion to:", self.postion self.m.go_to_axis(self.postion[0], self.postion[1], self.postion[2], self.postion[3], self.postion[4], self.postion[5], 2000) if __name__ == '__main__': m = Mirobot(debug=True) m.connect('/dev/ttyUSB0') # set mirobot to init postion m.home_simultaneous() sleep(15) try: #mirobot control init mirobot_control_node(m) except rospy.ROSInterruptException: pass while True: rospy.spin() sleep(0.1)
from time import sleep from mirobot import Mirobot m = Mirobot(debug=True) m.connect('com3') sleep(3) m.home_simultaneous() sleep(10) m.disconnect()