Ejemplo n.º 1
0
    def __init__(self):
        self.state = 0
        self.vel_topic = '/cmd_vel'
        self.scan_topic = '/depth'
        self.cmd_pub = Twist_float()

	#Initialize default variables
        self.angle_diff_prev = 0
        self.kp = 1.1
        self.kd = 0.00
	self.error_prev = 0.0
	self.turn_right = False
	self.rurn_left = False

	self.min_angle = 0.15
	self.max_angle = 0.7
	self.angle_range = self.max_angle - self.min_angle
	self.depth_max = 6.0
	self.depth_min = 0.0
	self.right_default = 2.5

	self.turn_flag = False

        #create publisher passing it the vel_topic_name and msg_type
        self.pub = rospy.Publisher(self.vel_topic, Twist_float, queue_size = 10)

        #create subscriber
        self.scan_sub = rospy.Subscriber(self.scan_topic, Depth_real, self.scan_callback)
 def on_enter(self, userdata):
     Logger.loginfo("Drive FWD STARTED!")
     #set robot speed here
     self.cmd_pub = Twist_float()
     self.cmd_pub.vel = self._speed
     self.cmd_pub.angle = 0.0
     self._start_time = rospy.Time.now()
Ejemplo n.º 3
0
 def on_enter(self, userdata):
     Logger.loginfo("Turn RIGHT STARTED!")
     #set robot speed here
     self.cmd_pub = Twist_float()
     self.cmd_pub.vel = self._t_speed
     self.cmd_pub.angle = self._turn_angle
     self._start_time = rospy.Time.now()
Ejemplo n.º 4
0
 def __init__(self, topic):
     self.topic = topic
     self.bridge = CvBridge()
     self.sub = rospy.Subscriber(topic, msg_Image, self.imageDepthCallback)
     self.pub = rospy.Publisher('/cmd_vel', Twist_float, queue_size=1)
     self.msg = Twist_float()
     self.rate = rospy.Rate(0.2)
     self.count = 0
Ejemplo n.º 5
0
    def __init__(self, topic):
        self.topic = topic
        self.bridge = CvBridge()
        self.sub = rospy.Subscriber(topic, msg_Image, self.imageDepthCallback)
        self.pub = rospy.Publisher('/cmd_vel', Twist_float, queue_size=1)
        self.msg = Twist_float()

        self.follow_corridor = my_follow_corridor.HandCodedLaneFollower()
    def __init__(self, sub_topic_name = '/cmd_vel'):
        # publisher
        self._drive_publisher = rospy.Publisher('/pololu/command', MotorCommand, queue_size=1)
        # subscriber
        self._sub_topic_name = sub_topic_name
        self._twist_subscriber = rospy.Subscriber( self._sub_topic_name, Twist_float, self.topic_callback)

        # get message
        self._drive_msg_motor = MotorCommand()
	self._drive_msg_steering = MotorCommand()
        self._twist_msg = Twist_float()
 def __init__(self, topic):
     self.waitInterval = 0
     self.topic = topic
     self.bridge = CvBridge()
     self.centerDepth = 3000
     self.turnOne = False
     self.turnTwo = False
     self.sub = rospy.Subscriber(topic, msg_Image, self.imageDepthCallback)
     self.pub = rospy.Publisher('/cmd_vel', Twist_float, queue_size=1)
     self.msg = Twist_float()
     self.thresh1 = 100
     self.thresh2 = 200
     self.state = 0
    def __init__(self):
        self.vel_topic = '/cmd_vel'
        self.scan_topic = '/scan'
        self.cmd_pub = Twist_float()
        self.angle_diff_prev = 0
        self.kp = 0.01
        self.kd = 0.01
        self.scale = 0
         
        #create publisher passing it the vel_topic_name and msg_type
        self.pub = rospy.Publisher(self.vel_topic, Twist_float, queue_size = 10)

        #create subscriber
        self.scan_sub = rospy.Subscriber(self.scan_topic, Depth, self.scan_callback)
    def __init__(self):
        self.vel_topic = '/cmd_vel'
        self.scan_topic = '/depth'
        self.cmd_pub = Twist_float()
        self.angle_diff_prev = 0
        self.kp = 0.9
        self.kd = 0.01
        self.scale = 1
        self.turn_right = False
        self.rurn_left = False
        self.min_angle = 0.15
        self.max_angle = 0.7

        #create publisher passing it the vel_topic_name and msg_type
        self.pub = rospy.Publisher(self.vel_topic, Twist_float, queue_size=10)

        #create subscriber
        self.scan_sub = rospy.Subscriber(self.scan_topic, Depth_real,
                                         self.scan_callback)
    def __init__(self):
        self._proportional_turning_constant = 0.01
        self._angle_diff_thresh = None
	self.depthPrev = 1500	
	self.center = 2500
	self.thresh = 0
	self.jerkThresh = 800
	self.jerkRight = False
	self.jerkLeft = False
        self.vel_topic = '/cmd_vel'
	self.scan_topic = '/scan'
	self.turn_right = False
	self.go_straight = False
	self.turn_left = False
	self.cmd_pub = Twist_float()
        #create publisher passing it the vel_topic_name and msg_type
        self.pub = rospy.Publisher(self.vel_topic, Twist_float, queue_size = 10)

        #create subscriber
        self.scan_sub = rospy.Subscriber(self.scan_topic, LaserScan, self.scan_callback)