mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-05 19:47:04 +00:00
fix
This commit is contained in:
parent
d3f50a768b
commit
3aa412babd
1 changed files with 5 additions and 6 deletions
|
|
@ -17,21 +17,20 @@ from pymycobot.mycobot import MyCobot
|
|||
|
||||
mc = None
|
||||
|
||||
|
||||
def callback(data):
|
||||
# rospy.loginfo(rospy.get_caller_id() + "%s", data.position)
|
||||
# print('data_position======================>',data.position)
|
||||
|
||||
data_list = []
|
||||
for index, value in enumerate(data.position):
|
||||
data_list.append(value)
|
||||
|
||||
mc.send_radians(data_list, 80)
|
||||
# print('data_list=====================>',data_list)
|
||||
|
||||
# time.sleep(0.5)
|
||||
|
||||
|
||||
def listener():
|
||||
global mc
|
||||
|
||||
rospy.init_node("control_slider", anonymous=True)
|
||||
|
||||
rospy.Subscriber("joint_states", JointState, callback)
|
||||
|
|
@ -39,11 +38,11 @@ def listener():
|
|||
baud = rospy.get_param("~baud", 115200)
|
||||
print(port, baud)
|
||||
mc = MyCobot(port, baud)
|
||||
|
||||
|
||||
# spin() simply keeps python from exiting until this node is stopped
|
||||
print("spin ...")
|
||||
rospy.spin()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
listener()
|
||||
listener()
|
||||
Loading…
Add table
Reference in a new issue