def __init__(self):
        self.data = None
        self.SIDE = 0
        # x (steering)
        self.iHat = []
        self.left_right_list = []
        # y (speed)
        self.jHat = []
        self.starttime = time.time()
        # [speed, angle]

        self.greenFrames = []

        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 0

        self.pos = 0
        self.orientation = None

        self.img_pub = rospy.Publisher(self.IMAGE_TOPIC, Image, queue_size = 1)
        self.sub_scan = rospy.Subscriber(self.SCAN_TOPIC, LaserScan, callback=self.scan_callback)
        self.pub_drive = rospy.Publisher(self.DRIVE_TOPIC, AckermannDriveStamped, queue_size=1)
        self.pose_sub = rospy.Subscriber(self.POSE_TOPIC, PoseStamped, self.poseCallback)
        self.safety_pub = rospy.Publisher(self.SAFETY_TOPIC, Bool, queue_size = 1)
        self.ar_sub = rospy.Subscriber(self.AR_TOPIC, AlvarMarkers, self.arCallback)
        self.sub_joy = rospy.Subscriber('/vesc/joy', Joy, callback=self.joy_callback)

        # self.init_pose_pub = rospy.Publisher('/initialpose', PoseWithCovarianceStamped, queue_size=1)

        self.pressed = [time.time() for i in range(4)]
        self.camera_data = Zed_converter(False, save_image = False)
        self.bridge = CvBridge()
        self.img = None
        self.image_pub = rospy.Publisher("/zed/zed_node/output", Image, queue_size = 1)
Beispiel #2
0
    def __init__(self):
        #help me
        """initalize the node"""
        rospy.init_node("driveStop")
        self.pub = rospy.Publisher(DRIVE_TOPIC,
                                   AckermannDriveStamped,
                                   queue_size=1)
        self.image_pub = rospy.Publisher(IMAGE_TOPIC, Image, queue_size=2)
        self.scan_sub = rospy.Subscriber("scan", LaserScan,
                                         self.driveStop_car_callback)
        """ initialize the box dimensions"""
        self.flag_box = ((0, 0), (0, 0))
        self.flag_center = (0, 0)
        self.flag_size = 0
        """driving stuff"""
        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 100
        self.cmd.drive.steering_angle = 0
        """get the camera data from the class Zed_converter in Zed"""
        self.camera_data = Zed_converter(False, save_image=False)
        self.imagePush = None
        self.imageHSV = None

        self.bridge = CvBridge()
        self.min_value = 0
    def __init__(self):
        print("suffering")
        self.data = None
        self.cmd = AckermannDriveStamped()
        self.camera_data = Zed_converter(False, save_image = False)
        #write your publishers and subscribers here; they should be the same as the wall follower's   
        self.laser_sub = rospy.Subscriber(self.SCAN_TOPIC, LaserScan, self.scan_callback, queue_size=1)
        self.ar_sub = rospy.Subscriber(self.AR_TOPIC, AlvarMarkers, self.arCallback)
        self.sound_sub = rospy.Subscriber("state", String, self.sound)
        self.sound_pub = rospy.Publisher("state", String, queue_size=1)
        self.drive_pub = rospy.Publisher(self.DRIVE_TOPIC, AckermannDriveStamped, queue_size=1)
	self.button_sub= rospy.Subscriber(self.BUTTON_TOPIC, Joy, self.buttonCallback, queue_size=1)
        #cartesian points -- to be filled (tuples)
        self.state=0
        #[speed, angle]
        self.finalVector = [3, 0]
        #self.state = "9"
        self.x = 0
        self.y = 0
        self.z = 0
        self.euler = None
        self.roll = 0
        self.pitch = 0
        self.yaw = 0
        self.dir=1
        self.go=False
        self.targetx = 0
        self.targety = 0
        self.lastdir=0
	self.start_button_on=False
    def __init__(self):
        """initalize the node"""
        rospy.init_node("driveStop")
        self.pub = rospy.Publisher(DRIVE_TOPIC,
                                   AckermannDriveStamped,
                                   queue_size=1)
        self.image_pub = rospy.Publisher(IMAGE_TOPIC, Image, queue_size=2)
        rospy.Subscriber("scan", LaserScan, self.driveStop_car_callback)
        """ initialize the box dimensions"""
        self.red_bounds = [np.array([0, 44, 147]), np.array([20, 254, 255])]
        self.yel_bounds = [np.array([25, 100, 200]), np.array([50, 255, 255])]
        self.blu_bounds = [np.array([100, 50, 100]), np.array([150, 255, 255])]
        """driving stuff"""
        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 0
        self.cmd.drive.steering_angle = 0
        """get the camera data from the class Zed_converter in Zed"""
        self.camera_data = Zed_converter(False, save_image=False)
        self.imagePush = None

        self.bridge = CvBridge()
        self.min_value = 0

        self.cur_line = 'red'
        self.n_lines = 3
Beispiel #5
0
    def __init__(self):
        """initalize the node"""
        rospy.init_node("driveStop")
        self.pub = rospy.Publisher(DRIVE_TOPIC,
                                   AckermannDriveStamped,
                                   queue_size=1)
        self.laser_sub = rospy.Subscriber(self.SCAN_TOPIC, LaserScan,
                                          self.scan_callback)

        #""" initialize the box dimensions"""
        self.width = 0.0
        self.height = 0.0
        self.area = 0.0
        self.screen_cent = 672 / 2
        self.h_middle = 0
        self.cone = False
        self.left = False
        self.right = False

        #"""driving code"""
        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 0
        self.cmd.drive.steering_angle = 0

        #"""get the camera data from the class Zed_converter in Zed"""
        self.camera_data = Zed_converter(False, save_image=False)

        self.min_value = 0
    def __init__(self):
        rospy.init_node("finalRace")
        self.lidarData = None
        self.cmd = AckermannDriveStamped()
        self.AR = 0

        self.pleaseGo = False

        self.direction = None

        self.navigation = Navigation()
        self.drive_pub = rospy.Publisher(DRIVE_TOPIC,
                                         AckermannDriveStamped,
                                         queue_size=1)
        self.scan_sub = rospy.Subscriber(SCAN_TOPIC, LaserScan,
                                         self.driveCallback)
        self.ar_sub = rospy.Subscriber(AR_TOPIC, AlvarMarkers, self.arCallback)
        self.joy_sub = rospy.Subscriber(JOY_TOPIC, Joy, self.joy_callback)
        self.signList = []

        self.camera_data = Zed_converter(False, save_image=False)

        self.lastTag = 0

        self.tagsAndStates = (
            "self.navigation.potential_fields(2)",  #0
            "self.highway()",  #madefaster
            "self.navigation.potential_fields(1.5)",
            "self.navigation.wall_follower(1, 0.6, side = 1)",
            "self.beforeGraves()",
            "self.graves()",  #5 #should be proportional? switch back
            "self.navigation.potential_fields(2)",
            "self.highway()",
            "self.navigation.wall_follower(1.5, 1, side = -1)",
            "self.navigation.potential_fields(1)",
            "self.detectSign()",  #10
            "self.navigation.wall_follower(1.5, 1, side = -1)",
            "self.navigation.wall_follower(1.5, 1, side = -1)",
            "self.navigation.potential_fields(1.7)",
            "self.final()",
            "self.final()",  #15
            "self.final()",
            "self.final()")

        self.auto = False
        self.sign = 0
        self.time = None

        self.signState = 0
        self.line = None
Beispiel #7
0
	def __init__(self):
		"""initalize the node"""
		rospy.init_node("driveStop")
		self.pub = rospy.Publisher(DRIVE_TOPIC, AckermannDriveStamped, queue_size = 1)
		self.laser_sub = rospy.Subscriber(SCAN_TOPIC, LaserScan, self.driveStop_car_callback)
		#rospy.Subscriber("scan", LaserScan, self.driveStop_car_callback)
                #self.joy_scan = rospy.Subscriber(self.CONTROLLER_TOPIC, Joy, callback = self.joy_callback)
		""" initialize the box dimensions"""

                """driving code"""
		self.cmd = AckermannDriveStamped()
		self.cmd.drive.speed = 0
		self.cmd.drive.steering_angle = 0

		"""get the camera data from the class Zed_converter in Zed"""
		self.camera_data = Zed_converter(False, save_image = False)
		self.min_value=0
Beispiel #8
0
    def __init__(self):
        rospy.init_node("finalRace")
        self.lidarData = None
        self.cmd = AckermannDriveStamped()

        self.drive_pub = rospy.Publisher(DRIVE_TOPIC, AckermannDriveStamped, queue_size=1)
        self.scan_sub = rospy.Subscriber(SCAN_TOPIC, LaserScan, self.driveCallback)

        self.navigation = Navigation()
        #self.sound_pub = rospy.Publisher("state", String, queue_size=1)

        #self.camera_data = Zed_converter(False, save_image=False)

        #self.currentPosition = (x,y)

        self.pleaseGo = True

        self.camera_data = Zed_converter(False, save_image=False)
Beispiel #9
0
	def __init__(self):
		"""initalize the node"""
		rospy.init_node("driveStop")
		self.pub = rospy.Publisher(DRIVE_TOPIC, AckermannDriveStamped, queue_size = 1)
		rospy.Subscriber("scan", LaserScan, self.driveStop_car_callback)

		""" initialize the box dimensions"""
        
                """driving code"""
		self.cmd = AckermannDriveStamped()
		self.cmd.drive.speed = 1
		self.cmd.drive.steering_angle = 0
	
		"""get the camera data from the class Zed_converter in Zed"""
		self.camera_data = Zed_converter(False, save_image = False)

                # Init Vars
		self.min_value=0
                self.left = 0
                self.right = 0
    def __init__(self):
        """initalize the node"""
        rospy.init_node("driveStop")
        self.pub = rospy.Publisher(DRIVE_TOPIC,
                                   AckermannDriveStamped,
                                   queue_size=1)
        rospy.Subscriber("scan", LaserScan, self.driveStop_car_callback)

        self.joy_sub = rospy.Subscriber("vesc/joy", Joy, self.joy_callback)

        self.img_pub = rospy.Subscriber
        """ initialize the box dimensions"""
        """driving code"""
        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 0
        self.cmd.drive.steering_angle = 0
        """get the camera data from the class Zed_converter in Zed"""

        self.bridge = CvBridge()

        self.camera_data = Zed_converter(False, save_image=False)

        self.min_value = 0

        self.img_pub = rospy.Publisher('/zed/zed_node/boxes', Image)
        self.msg = Image

        self.factor = 0
        self.cone_width = 0

        self.input_data = []
        self.label_data = []

        self.map = None
        self.l_data = None

        self.lower_ind = 180
        self.upper_ind = 900

        self.joy_data = None
Beispiel #11
0
    def __init__(self):
        """initalize the node"""

        rospy.init_node("driveStop")
        self.pub = rospy.Publisher(DRIVE_TOPIC,
                                   AckermannDriveStamped,
                                   queue_size=1)
        self.zed_pub = rospy.Publisher(IMAGE_TOPIC, Image, queue_size=1)
        self.bridge = CvBridge()
        self.imageWithBoxes = None
        rospy.Subscriber("scan", LaserScan, self.driveStop_car_callback)
        """ initialize the box dimensions"""
        #self.box_size = color_segmentation.cd_color_segmentation()
        xSize = 0
        ySize = 0
        """driving code"""
        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 2
        self.cmd.drive.steering_angle = 0
        """get the camera data from the class Zed_converter in Zed"""
        self.camera_data = Zed_converter(False, save_image=False)

        self.min_value = 0
Beispiel #12
0
    def __init__(self):
        """initalize the node"""
        self.pub = rospy.Publisher(DRIVE_TOPIC,
                                   AckermannDriveStamped,
                                   queue_size=1)
        self.sub = rospy.Subscriber("scan", LaserScan,
                                    self.driveStop_car_callback)
        ##initialize the box dimensions
        ##driving code

        self.cmd = AckermannDriveStamped()
        self.cmd.drive.speed = 0
        self.cmd.drive.steering_angle = 0
        self.x_mid = None
        self.y_bound = None
        self.no_drive = False
        self.phase = 0
        self.results = [
            None, None
        ]  ##first pos is deviation of x box middle from center of image
        ##second pos is how close y box pos is bottom
        """get the camera data from the class Zed_converter in Zed"""
        self.camera_data = Zed_converter(False, save_image=False)