This commit is contained in:
wangWking 2022-07-14 15:08:52 +08:00
commit 64461d841e
11 changed files with 27 additions and 21 deletions

View file

@ -1,4 +1,4 @@
<launch>
3<launch>
<!-- Select connecting device and serial port ,选择连接设备及串口-->
<arg name="port" default="/dev/ttyAMA0" />
<arg name="baud" default="1000000" />

View file

@ -70,7 +70,7 @@ class MycobotTopics(object):
rospy.init_node("mycobot_topics")
rospy.loginfo("start ...")
port = rospy.get_param("~port", "/dev/ttyUSB0")
port = rospy.get_param("~port", os.popen("ls /dev/ttyUSB*").readline()[:-1])
baud = rospy.get_param("~baud", 115200)
rospy.loginfo("%s,%s" % (port, baud))
self.mc = MyCobot(port, baud)

View file

@ -74,7 +74,7 @@ class MycobotTopics(object):
rospy.init_node("mycobot_topics_pi")
rospy.loginfo("start ...")
# problem
port = rospy.get_param("~port", "/dev/ttyAMA0")
port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1])
baud = rospy.get_param("~baud", 1000000)
rospy.loginfo("%s,%s" % (port, baud))
# self.mc = MyCobotSocket(port, baud) # port

View file

@ -162,7 +162,7 @@ class Object_detect(Movement):
self.mc.send_coords([x, y, 140, 179.12, -0.18, 179.46], 30, 0)
time.sleep(3)
self.mc.send_coords([x, y, 92, 179.12, -0.18, 179.46], 30, 0) # -178.77, -2.69, 40.15
self.mc.send_coords([x, y, 110, 179.12, -0.18, 179.46], 30, 0) # -178.77, -2.69, 40.15
time.sleep(3)
# open pump

View file

@ -6,13 +6,12 @@ from pymycobot.genre import Angle
from pymycobot import PI_PORT, PI_BAUD # 当使用树莓派版本的mycobot时可以引用这两个变量进行MyCobot初始化
import time,os
# mc = MyPalletizer(os.popen("ls /dev/ttyUSB*").readline()[:-1], 115200)
mc = MyCobot("/dev/ttyAMA0", 1000000)
# mc = MyPalletizer("/dev/ttyAMA0", 1000000)
mc = MyCobot(os.popen("ls /dev/ttyUSB*").readline()[:-1], 115200)
# mc = MyCobot("/dev/ttyAMA0", 1000000)
mc.send_angles([0,0,0,0,90,0],30) # coords:[95.6, 0.5, 166.4, 179.12, -0.18, 179.46]
# mc.send_angles([-3.25, 17.22, -32.51, 2.37, 92.54, -36.21],30)
mc.send_angles([0,0,0,0,90,0],20) # coords:[95.6, 0.5, 166.4, 179.12, -0.18, 179.46]
# # mc.send_angles([-3.25, 17.22, -32.51, 2.37, 92.54, -36.21],30)
time.sleep(4)
@ -41,7 +40,10 @@ time.sleep(4)
# print("\n")
# mc.release_all_servos()
# mc.release_servo(3)
# mc.set_servo_calibration(1)
# mc.set_servo_calibration(2)
# mc.set_servo_calibration(3)
# mc.set_servo_calibration(4)
# mc.set_servo_calibration(4)
# mc.set_servo_calibration(5)
# mc.set_servo_calibration(6)

View file

@ -14,13 +14,13 @@
</node>
<!-- mycobot-topics -->
<include file="$(find mycobot_communication)/launch/communication_topic.launch">
<include file="$(find mycobot_communication)/launch/communication_topic_pi.launch">
<arg name="port" value="$(arg port)" />
<arg name="baud" value="$(arg baud)" />
</include>
<!-- listen and pub the real angles -->
<node name="real_listener" pkg="mycobot_280" type="listen_real_of_topic.py" />
<node name="real_listener" pkg="mycobot_280_pi" type="listen_real_of_topic.py" />
<!-- Show in Rviz -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

View file

@ -60,7 +60,7 @@ class Object_detect(Movement):
if "dev" in self.robot_m5:
self.Pin = [2, 5]
elif "dev" in self.robot_wio:
self.Pin = [20, 21]
self.Pin = [2, 5]
for i in self.move_coords:
i[2] -= 20
elif "dev" in self.robot_raspi or "dev" in self.robot_jes:

View file

@ -4,13 +4,15 @@ from pymycobot.genre import Angle
from pymycobot import PI_PORT, PI_BAUD # 当使用树莓派版本的mycobot时可以引用这两个变量进行MyCobot初始化
import time
mc = MyCobot("/dev/ttyACM0", 115200)
# mc = MyCobot("/dev/ttyUSB0", 115200)
# mc = MyCobot("/dev/ttyACM0", 115200)
mc = MyCobot("/dev/ttyUSB0", 115200)
# mc = MyCobot("/dev/ttyAMA0", 1000000)
# mc.send_angles([0,0,0,0,90,0], 20)
# mc.send_angles([0,0,0,0,0,0], 25)
# print(mc.get_angles())
mc.send_angles([-7.11, -6.94, -55.01, -24.16, 0.0, -15], 30)
time.sleep(4)
# print(mc.get_angles())
# mc.send_coords([120.8, -134.4, 258.0, -172.72, -5.31, -109.09], 30, 1) # red bucket
# time.sleep(4)
@ -28,8 +30,8 @@ time.sleep(4)
# mc.send_angles([1.4, 0, -53.61, -33.39, -3.51, -20.3],20)
# time.sleep(3)
mc.send_coords([145.3, -11.2, 126.6, 179.87, -3.78, -62.75], 30, 1)
time.sleep(6)
# mc.send_coords([145.3, -11.2, 126.6, 179.87, -3.78, -62.75], 30, 1)
# time.sleep(6)
# mc.release_all_servos()

View file

@ -70,7 +70,9 @@ class MycobotTopics(object):
rospy.init_node("mycobot_topics")
rospy.loginfo("start ...")
port = rospy.get_param("~port", "/dev/ttyUSB0")
port = rospy.get_param("~port", os.popen("ls /dev/ttyUSB*").readline()[:-1])
if not port:
port = rospy.get_param("~port", os.popen("ls /dev/ttyACM*").readline()[:-1])
baud = rospy.get_param("~baud", 115200)
rospy.loginfo("%s,%s" % (port, baud))
self.mc = MyCobot(port, baud)

View file

@ -74,7 +74,7 @@ class MycobotTopics(object):
rospy.init_node("mycobot_topics_pi")
rospy.loginfo("start ...")
# problem
port = rospy.get_param("~port", "/dev/ttyAMA0")
port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1]")
baud = rospy.get_param("~baud", 1000000)
rospy.loginfo("%s,%s" % (port, baud))
self.mc = MyCobotSocket(port, baud) # port

View file

@ -69,7 +69,7 @@ class MypalTopics(object):
rospy.init_node("mypal_topics_pi")
rospy.loginfo("start ...")
# problem
port = rospy.get_param("~port", "/dev/ttyAMA0")
port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1])
baud = rospy.get_param("~baud", 1000000)
rospy.loginfo("%s,%s" % (port, baud))
# self.mc = MyCobotSocket(port, baud) # port