def main(): msg = msg_lane() sign = msg_sign() angle = None lanepub=rospy.Publisher('/lane_msg', msg, queue_size=1) if sign.sign == "RIGHT SIGN": x1_ye = msg.x1_ye y1_ye = msg.y1_ye x2_ye = msg.x2_ye y2_ye = msg.y2_ye angle = np.arctan2((y1 - y2) , (x1 - x2)) * (180/np.pi) if sign.sign == "LEFT SIGN": x1_wh = msg.x1_wh y1_wh = msg.y1_wh x2_wh = msg.x2_wh y2_wh = msg.y2_wh angle = np.arctan2((y1 - y2) , (x1 - x2)) * (180/np.pi) if sign.sign == "DONT GO": if sign_1 == "RIGHT SIGN": angle = np.arctan2((y1 - y2) , (x1 - x2)) * (180/np.pi) msg.angle = angle if sign_1 == "LEFT SIGN": angle = np.arctan2((y1 - y2) , (x1 - x2)) * (180/np.pi)
def __init__(self): self.bridge = CvBridge() self.angle_msg = msg_lane() self.line = [] self.line_detect = False self.right_lane_mode = False self.left_lane_mode = False self.lane_mode = False self.angle = 0 self.vanishing_x = 0 self.vanishing_y = 0 self.pub_lane = rospy.Publisher('/lane_msg', msg_lane, queue_size=1) self.sub_sign = rospy.Subscriber('/sign_msg', msg_sign, self.signmsg)
def __init__(self): #self.velocity_publisher = rospy.Publisher("/cmd_vel", Twist, queue_size=1) self.img_pub = rospy.Publisher('/image_center', Image, queue_size=1) #self.modesub = rospy.Subscriber('/mode_msg',mode_msg, self.modemsg) #self.twistpub = rospy.Publisher('/mode_twist', twist, queue_size=10) self.lanepub = rospy.Publisher('/lane_msg', msg_lane, queue_size=1) self.lanemsg = msg_lane() self.lsd = cv2.createLineSegmentDetector(0) #self.vel_msg = twist() self.cap = None self.frame = None self.hsv = None
def __init__(self): self.x1_ye = None self.x2_ye = None self.y1_ye = None self.y2_ye = None self.x1_wh = None self.x2_wh = None self.y1_wh = None self.y2_wh = None self.angle = None self.lane_pub = rospy.Publisher("/lane_msg", msg_lane, queue_size=1) self.lane = msg_lane() self.sign_sub = rospy.Subscriber("/sign_msg", msg_sign, self.callback_sign) self.sign = None self.lane_sub = rospy.Subscriber("/lane_msg", msg_lane, self.callback_lane)
def __init__(self): self.bridge = CvBridge() self.angle_mag = msg_lane() self.line = [] self.line_md = [] self.ye_pose = [] self.wh_pose = [] self.wh_true = False self.ye_true = False self.lane_mode = False self.x1_ye = None self.x2_ye = None self.y1_ye = None self.y2_ye = None self.x1_wh = None self.x2_wh = None self.y1_wh = None self.y2_wh = None self.pub_lane = rospy.Publisher('/lane_msg', msg_lane, queue_size=1)
def __init__(self): self.lanepub = rospy.Publisher('/lane_msg', msg_lane, queue_size=1) self.signsub = rospy.Subscriber('/sign_msg',msg_sign, self.signmsg) self.lanemsg = msg_lane() self.sign = None self.img_sub = rospy.Subscriber('/image_raw_right', Image,self.img_msg)
key = '' termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings) return key if __name__ == "__main__": settings = termios.tcgetattr(sys.stdin) rospy.init_node('test_pub') pub = rospy.Publisher('/lane_msg', msg_lane, queue_size=10) pub_det = rospy.Publisher('/det_msg', msg_detect, queue_size=10) pub_start = rospy.Publisher('/start', start, queue_size=10) signpub = rospy.Publisher('/sign_msg_l', msg_sign_l, queue_size=10) lane = msg_lane() sign_msg_l = msg_sign_l() det = msg_detect() starting = start() try: while (1): key = getKey() if key == 'q': lane.yellow = True lane.white = True print("q") elif key == 'w': lane.yellow = False lane.white = False