This commit is contained in:
2929ss 2022-07-13 10:58:24 +08:00
parent b4472642bf
commit 0545d04876
8 changed files with 11 additions and 9 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

@ -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

@ -77,7 +77,7 @@ class Object_detect(Movement):
"yellow": [np.array([11, 115, 70]), np.array([40, 255, 245])],
"red": [np.array([0, 43, 46]), np.array([8, 255, 255])],
"green": [np.array([35, 43, 46]), np.array([77, 255, 255])],
"blue": [np.array([100, 43, 46]), np.array([124, 255, 255])],
# "blue": [np.array([100, 43, 46]), np.array([124, 255, 255])],
"cyan": [np.array([78, 43, 46]), np.array([99, 255, 255])],
}
# use to calculate coord between cube and mycobot

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