我能够显示来自两个主题的数据,但我无法在 ROS(用 Python 代码编写)中实时使用和计算来自这两个主题的数据。
您是否有任何想法来存储这些数据并实时计算?
谢谢 ;)
#!/usr/bin/env python
import rospy
import string
from std_msgs.msg import String
from std_msgs.msg import Float64MultiArray
from std_msgs.msg import Float64
import numpy as np
class ListenerVilma:
def __init__(self):
self.orientation = rospy.Subscriber('/orientation', Float64MultiArray , self.orientation_callback)
self.velocidade = rospy.Subscriber('/velocidade', Float64MultiArray, self.velocidade_callback)
def orientation_callback(self, orientation):
print orientation
def velocidade_callback(self, velocidade):
print velocidade
if __name__ == '__main__':
rospy.init_node('listener', anonymous=True)
myVilma = ListenerVilma()
rospy.spin()