irobot_create bumper [closed]

asked 2013-11-22 03:36:25 -0500

choi woo young gravatar image

Hello, i am going to use bumper with Turtlebot1

Although i ran the source as below, i couldn't run the callback function. Why?


#!/usr/bin/env python    
import roslib; roslib.load_manifest('enclosure_escape')    
import rospy   
from geometry_msgs.msg import Twist    
from create_node.msg import TurtlebotSensorState

bump = False

def callback(TurtlebotSensorState):    
   global bump   
   bump = TurtlebotSensorState.bumps_wheeldrops > 0       
def hello_create():    
   pub = rospy.Publisher('mobile_base/commands/velocity', Twist)    
   rospy.Subscriber('/create_node/sensor_state', TurtlebotSensorState, callback)    
   rospy.init_node('hello_create')    
   global bump    
   twist = Twist()

   while not rospy.is_shutdown():    
       if bump:   
           rospy.loginfo("bump")    
           twist.linear.x = 0; twist.linear.y = 0; twist.linear.z = 0   
           twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = 0    
           bump = False    
       else:
           rospy.loginfo("go")    
           twist.linear.x = 0.1; twist.linear.y = 0; twist.linear.z = 0    
           twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = 0.1    
       pub.publish(twist)    
       rospy.sleep(0.25)

if __name__ == '__main__':    
   try:    
       hello_create()    
   except rospy.ROSInterruptException: pass
edit retag flag offensive reopen merge delete

Closed for the following reason too subjective or argumentative by tfoote
close date 2014-10-13 20:12:27.615881

Comments

Not enough information. No error or description of how to reproduce.

tfoote gravatar image tfoote  ( 2014-10-13 20:12:19 -0500 )edit