read data from serial port and publish over a topic that stores float32'
def publish():
rospy.init_node('modem',anonymous=True)
acous_node=rospy.Publisher('acoustic_data',Float32,queue_size=10)
r=rospy.Rate(10)
while not rospy.is_shutdown():
g.data=serial_node.read()
acous_node.publish(g)
localtime = time.asctime( time.localtime(time.time()) )
print "Local current time :", localtime
r.sleep()
this is what i tried but serial data is in str type,i want to convert to float32 type .how do i do? thanx
Not a ROS question but here is some info: http://www.cplusplus.com/reference/st...
I think you have more string conversion to get things working. Reading this answer will provide help with serial port. http://answers.ros.org/question/19539...