mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-05 19:47:04 +00:00
refactor: modify for new api, fix control_marker.py bug
This commit is contained in:
parent
411a2a4c65
commit
69862d4196
3 changed files with 22 additions and 15 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python2
|
||||
# from std_msgs.msg import String
|
||||
import time
|
||||
import time, subprocess
|
||||
|
||||
import rospy
|
||||
from interactive_markers.interactive_marker_server import *
|
||||
|
|
@ -210,21 +210,24 @@ def listener():
|
|||
joint_state_send.header.stamp = rospy.Time.now()
|
||||
|
||||
angles = mycobot.get_angles_of_radian()
|
||||
data_list = []
|
||||
for index, value in enumerate(angles):
|
||||
if index != 2:
|
||||
value *= -1
|
||||
data_list.append(value)
|
||||
rospy.loginfo(angles)
|
||||
if angles:
|
||||
data_list = []
|
||||
for index, value in enumerate(angles):
|
||||
if index != 2:
|
||||
value *= -1
|
||||
data_list.append(value)
|
||||
|
||||
rospy.loginfo(data_list)
|
||||
|
||||
joint_state_send.position = data_list
|
||||
|
||||
joint_state_send.position = data_list
|
||||
|
||||
pub.publish(joint_state_send)
|
||||
pub.publish(joint_state_send)
|
||||
|
||||
rate.sleep()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mycobot = MyCobot()
|
||||
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
|
||||
shell=True)
|
||||
mycobot = MyCobot(port)
|
||||
listener()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python2
|
||||
# from std_msgs.msg import String
|
||||
import time
|
||||
import time, subprocess
|
||||
|
||||
import rospy
|
||||
from sensor_msgs.msg import JointState
|
||||
|
|
@ -29,5 +29,7 @@ def listener():
|
|||
rospy.spin()
|
||||
|
||||
if __name__ == '__main__':
|
||||
mc = MyCobot()
|
||||
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
|
||||
shell=True)
|
||||
mc = MyCobot(port)
|
||||
listener()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python2
|
||||
# license removed for brevity
|
||||
import time
|
||||
import time, subprocess
|
||||
|
||||
import rospy
|
||||
from sensor_msgs.msg import JointState
|
||||
|
|
@ -77,7 +77,9 @@ def talker():
|
|||
rate.sleep()
|
||||
|
||||
if __name__ == '__main__':
|
||||
mycobot = MyCobot()
|
||||
port = subprocess.check_output(['echo -n /dev/ttyUSB*'],
|
||||
shell=True)
|
||||
mycobot = MyCobot(port)
|
||||
try:
|
||||
talker()
|
||||
except rospy.ROSInterruptException:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue