update serial name

This commit is contained in:
wangWking 2023-08-29 11:05:20 +08:00
parent a3f45ad52c
commit cc1b3f36ee
11 changed files with 15 additions and 13 deletions

View file

@ -1,6 +1,6 @@
<launch> <launch>
<!-- Select connecting device and serial port ,选择连接设备及串口--> <!-- Select connecting device and serial port ,选择连接设备及串口-->
<arg name="port" default="/dev/ttyAMA0" /> <arg name="port" default="/dev/ttyAMA1" />
<arg name="baud" default="115200" /> <arg name="baud" default="115200" />
<arg name="model" default="$(find mycobot_description)/urdf/cobotx_a450/cobotx_a450.urdf"/> <arg name="model" default="$(find mycobot_description)/urdf/cobotx_a450/cobotx_a450.urdf"/>

View file

@ -1,6 +1,6 @@
<launch> <launch>
<!-- Select connecting device and serial port ,选择连接设备及串口--> <!-- Select connecting device and serial port ,选择连接设备及串口-->
<arg name="port" default="/dev/ttyAMA0" /> <arg name="port" default="/dev/ttyAMA1" />
<arg name="baud" default="115200" /> <arg name="baud" default="115200" />
<arg name="model" default="$(find mycobot_description)/urdf/cobotx_a450/cobotx_a450.urdf"/> <arg name="model" default="$(find mycobot_description)/urdf/cobotx_a450/cobotx_a450.urdf"/>

View file

@ -13,7 +13,7 @@ def talker():
rospy.init_node("display", anonymous=True) rospy.init_node("display", anonymous=True)
print("Try connect real CobotX...") print("Try connect real CobotX...")
port = rospy.get_param("~port", "/dev/ttyAMA0") port = rospy.get_param("~port", "/dev/ttyAMA1")
baud = rospy.get_param("~baud", 115200) baud = rospy.get_param("~baud", 115200)
print("port: {}, baud: {}\n".format(port, baud)) print("port: {}, baud: {}\n".format(port, baud))
try: try:

View file

@ -5,7 +5,7 @@ This file obtains the joint angle of the manipulator in ROS,
and then sends it directly to the real manipulator using `pymycobot` API. and then sends it directly to the real manipulator using `pymycobot` API.
This file is [slider_control.launch] related script. This file is [slider_control.launch] related script.
Passable parameters: Passable parameters:
port: serial prot string. Defaults is '/dev/ttyUSB0' port: serial prot string. Defaults is '/dev/ttyAMA1'
baud: serial prot baudrate. Defaults is 115200. baud: serial prot baudrate. Defaults is 115200.
""" """
import math import math
@ -36,7 +36,7 @@ def listener():
rospy.init_node("control_slider", anonymous=True) rospy.init_node("control_slider", anonymous=True)
rospy.Subscriber("joint_states", JointState, callback) rospy.Subscriber("joint_states", JointState, callback)
port = rospy.get_param("~port", "/dev/ttyAMA0") port = rospy.get_param("~port", "/dev/ttyAMA1")
baud = rospy.get_param("~baud", 115200) baud = rospy.get_param("~baud", 115200)
print(port, baud) print(port, baud)
mc = CobotX(port, baud) mc = CobotX(port, baud)

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
from __future__ import print_function from __future__ import print_function
from cobotx_a450_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus from cobotx_a450_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy import rospy

View file

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

View file

@ -1,6 +1,6 @@
<launch> <launch>
<!-- Select connecting device and serial port ,选择连接设备及串口--> <!-- Select connecting device and serial port ,选择连接设备及串口-->
<arg name="port" default="/dev/ttyAMA0" /> <arg name="port" default="/dev/ttyAMA1" />
<arg name="baud" default="115200" /> <arg name="baud" default="115200" />
<!-- Open communication service开启通讯服务 --> <!-- Open communication service开启通讯服务 -->

View file

@ -1,6 +1,6 @@
<launch> <launch>
<!-- Select connecting device and serial port ,选择连接设备及串口--> <!-- Select connecting device and serial port ,选择连接设备及串口-->
<arg name="port" default="/dev/ttyAMA0" /> <arg name="port" default="/dev/ttyAMA1" />
<arg name="baud" default="115200" /> <arg name="baud" default="115200" />
<!-- Open communication service --><!-- 开启通讯服务 --> <!-- Open communication service --><!-- 开启通讯服务 -->

View file

@ -70,7 +70,8 @@ class CobotXTopics(object):
rospy.init_node("cobotx_topics") rospy.init_node("cobotx_topics")
rospy.loginfo("start ...") rospy.loginfo("start ...")
port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1]) # port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1])
port = rospy.get_param("~port", "/dev/ttyAMA1")
if not port: if not port:
port = rospy.get_param("~port", os.popen("ls /dev/ttyACM*").readline()[:-1]) port = rospy.get_param("~port", os.popen("ls /dev/ttyACM*").readline()[:-1])
baud = rospy.get_param("~baud", 115200) baud = rospy.get_param("~baud", 115200)

View file

@ -73,7 +73,8 @@ class CobotXTopics(object):
rospy.init_node("cobotx_topics_pi") rospy.init_node("cobotx_topics_pi")
rospy.loginfo("start ...") rospy.loginfo("start ...")
# problem # problem
port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1]) # port = rospy.get_param("~port", os.popen("ls /dev/ttyAMA*").readline()[:-1])
port = rospy.get_param("~port", "/dev/ttyAMA1")
baud = rospy.get_param("~baud", 115200) baud = rospy.get_param("~baud", 115200)
rospy.loginfo("%s,%s" % (port, baud)) rospy.loginfo("%s,%s" % (port, baud))
self.mc = CobotX(port, baud) self.mc = CobotX(port, baud)

View file

@ -6,7 +6,7 @@ This file obtains the joint angle of the manipulator in ROS,
and then sends it directly to the real manipulator using `pymycobot` API. and then sends it directly to the real manipulator using `pymycobot` API.
This file is [slider_control.launch] related script. This file is [slider_control.launch] related script.
Passable parameters: Passable parameters:
port: serial prot string. Defaults is '/dev/ttyAMA0' port: serial prot string. Defaults is '/dev/ttyAMA1'
baud: serial prot baudrate. Defaults is 115200. baud: serial prot baudrate. Defaults is 115200.
""" """
import math import math
@ -37,7 +37,7 @@ def listener():
rospy.init_node("control_slider", anonymous=True) rospy.init_node("control_slider", anonymous=True)
rospy.Subscriber("joint_states", JointState, callback) rospy.Subscriber("joint_states", JointState, callback)
port = rospy.get_param("~port", "/dev/ttyAMA0") port = rospy.get_param("~port", "/dev/ttyAMA1")
baud = rospy.get_param("~baud", 115200) baud = rospy.get_param("~baud", 115200)
print(port, baud) print(port, baud)
mc = CobotX(port, baud) mc = CobotX(port, baud)