Ask Your Question
0

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

Hello,

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
0

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

Comments

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
0

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
0

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

Your Answer

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

Add Answer

Question Tools

Stats

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

Seen: 813 times

Last updated: Dec 01 '11