ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

problems subscribing to turtlebot_node/sensor_state

asked 2011-11-18 09:38:27 -0500

saltzm gravatar image

updated 2014-01-28 17:10:49 -0500

ngrennan gravatar image


I am trying to subscribe to turtlebot_node/sensor_state so that I can tell when my Turtlebot has bumped into something and handle it accordingly. Whenever I try to run it, however, it gives me the error message:

 File "/opt/ros/electric/stacks/turtlebot_apps/turtlebot_teleop 
 /bin/turtlebot_teleop_key", line 35, in <module>
     from turtlebot_node.msg import TurtlebotSensorState
 ImportError: No module named turtlebot_node.msg

My import statements are as follows:

from os import system
import curses
import roslib; roslib.load_manifest('turtlebot_teleop')
import rospy
import random
from turtlebot_node.msg import TurtlebotSensorState
from geometry_msgs.msg import Twist

From other examples I can find online, it seems like this should work. turtlebot_node is definitely running correctly and I have no trouble getting it to move without implementing a bump correction algorithm. What do you think is wrong?

Thanks, Matthew

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-11-18 11:12:35 -0500

fergs gravatar image

How did you install the turtlebot_node package? If it is from source, you need to run "make" to generate the message headers.

edit flag offensive delete link more


I recommend using rosmake in your package. The build system has to generate the message processing code which is failing to import.
tfoote gravatar image tfoote  ( 2011-11-26 19:05:17 -0500 )edit

answered 2011-12-01 12:13:12 -0500

saltzm gravatar image

I installed turtlebot_node from source and I did run rosmake turtlebot_node, to no avail. Here's what the files look like inside turtlebot_node. And @tfoote, do you mean I need to put rosmake somewhere in my code?

turtlebot@ubuntu:/opt/ros/electric/stacks/turtlebot/turtlebot_node$ ls msg
BatteryState.msg  Drive.msg  RawTurtlebotSensorState.msg  RoombaSensorState.msg  TurtlebotSensorState.msg  Turtle.msg
edit flag offensive delete link more

answered 2011-12-01 13:13:37 -0500

saltzm gravatar image

I actually ended up creating a separate package and starting over and then it magically worked. Thanks for the help guys.

edit flag offensive delete link more

Question Tools


Asked: 2011-11-18 09:38:27 -0500

Seen: 909 times

Last updated: Dec 01 '11