ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS hokuyo_node LaserScan Subscriber msg data class python

asked 2013-03-11 17:20:22 -0500

Sentinal_Bias gravatar image

updated 2014-01-28 17:15:38 -0500

ngrennan gravatar image

Hi I am trying to subscribe to a laser scan of the hokuyo_node. I am a bit new to ROS, here is my code so far. I have read the python subscriber tutorials but they don't tell how to subscribe to topics that transmits a struts or collections of data.

#!/usr/bin/env python
import roslib; roslib.load_manifest('laser')
import rospy

import hokuyo_node
import sensor_msgs

def callback(data):
def laser_listener():
    rospy.init_node('laser_listener', anonymous=True)

if __name__ == '__main__':

I get the following error

Traceback (most recent call last):
  File "/home/spartan3123/fuerte_workspace/laser/scripts/", line 19, in <module>
  File "/home/spartan3123/fuerte_workspace/laser/scripts/", line 15, in laser_listener
AttributeError: 'module' object has no attribute 'msg'


here is a link to the rospy Subscriber API

and a link to the topic definition of a Laser_Scan for the hokuyo_node

btw does anyone have any sample code in python where you connect to a hokuyo_laser it would be helpful


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-11 19:50:57 -0500

fergs gravatar image

You need to use the whole .msg in the import

 import sensor_msgs.msg
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-03-11 17:20:22 -0500

Seen: 4,636 times

Last updated: Mar 11 '13