@小鱼 老哥我重新装了一遍环境就好了,谢谢
重要提示
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
3053653379 发布的最新帖子
-
ROS关于编写节点时无法同时订阅和发布
我在编写ROS节点的时候发现冲突,不能同时订阅和发布了,但屏蔽pub之后能完美打印2了,这是为什么?
这时我的节点文件
def callback(msg):
pad_id = msg.data
if pad_id == 2:
rospy.loginfo('2')
pub.publish('two')if name == "main":
rospy.init_node('pad_to_led', anonymous=False)
sub = rospy.Subscriber('mission_pad_id', UInt8, callback)
pub = rospy.Publisher('mled', String, queue_size=10)
rospy.spin()
然后这是报错
Exception in thread Thread-9:
Traceback (most recent call last):
File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_UInt8.py", line 54, in serialize
buff.write(_get_struct_B().pack(_x))
struct.error: ubyte format requires 0 <= number <= 255During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 882, in publish
self.impl.publish(data)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 1066, in publish
serialize_message(b, self.seq, message)
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/msg.py", line 152, in serialize_message
msg.serialize(b)
File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_UInt8.py", line 55, in serialize
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self)))))
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 393, in _check_types
check_type(n, t, getattr(self, n))
File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 267, in check_type
raise SerializationError('field %s must be unsigned integer type' % field_name)
genpy.message.SerializationError: field data must be unsigned integer typeDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/timer.py", line 237, in run
self._callback(TimerEvent(last_expected, last_real, current_expected, current_real, last_duration))
File "rmtt_core.py", line 317, in rmtt_core_dev.scripts.rmtt_core.RoboMasterTelloTalent._drone_info_handler
File "rmtt_core.py", line 395, in rmtt_core_dev.scripts.rmtt_core.RoboMasterTelloTalent._drone_info_publisher
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 886, in publish
raise ROSSerializationException(str(e))
rospy.exceptions.ROSSerializationException: field data must be unsigned integer type
查找了一群资料也不知道为什么,求大神帮助 -
RE: ros运行roslauch时候的错误
@小鱼 语法好像也没有问题呀,这是代码
<param name="robot_description" command="$(find xacro)/xacro -i '$(find tianbot_mini)/urdf/tianbot_mini_run.urdf.xacro' prefix:=$(arg robot_name)" />
我查了很多资料除了那个--inorder改成-i其他好像没问题啊 -
ros运行roslauch时候的错误
大佬们,这到底什么原因阿
xacro: in-order processing became default in ROS Melodic. You can drop the option.
substitution args not supported: No module named 'rospkg'
when evaluating expression 'prefix == '/' or prefix == '' or prefix == ' ''
when processing file: /home/thebell/tian_mini_ws/src/tianbot_mini/urdf/tianbot_mini_run.urdf.xacro
RLException: while processing /home/thebell/tian_mini_ws/src/tianbot_mini/launch/includes/model.launch.xml:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/opt/ros/noetic/lib/xacro/xacro', '--inorder', '/home/thebell/tian_mini_ws/src/tianbot_mini/urdf/tianbot_mini_run.urdf.xacro', 'prefix:=tianbot_mini']] returned with code [2].Param xml is <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find tianbot_mini)/urdf/tianbot_mini_run.urdf.xacro' prefix:=$(arg robot_name)"/>
The traceback for the exception was written to the log file