1. Trang chủ
  2. » Luận Văn - Báo Cáo

Hộ thống định tuyến và giám sát đối tượng dịch chuyển trong phạm vi rộng

148 9 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Bia.pdf

  • Luan van cao hoc.pdf

  • Ly_lich_khoa_hoc.pdf

Nội dung

ðại Học Quốc Gia Tp Hồ Chí Minh TRƯỜNG ðẠI HỌC BÁCH KHOA PHÙNG THẾ VŨ HỆ THỐNG ðỊNH TUYẾN VÀ GIÁM SÁT ðỐI TƯỢNG DỊCH CHUYỂN TRONG PHẠM VI RỘNG Chuyên ngành : KỸ THUẬT ðIỆN TỬ LUẬN VĂN THẠC SĨ TP HỒ CHÍ MINH, tháng 07 năm 2009 CƠNG TRÌNH ðƯỢC HỒN THÀNH TẠI TRƯỜNG ðẠI HỌC BÁCH KHOA ðẠI HỌC QUỐC GIA TP HỒ CHÍ MINH Cán hướng dẫn khoa học : PGS.TS Lê Tiến Thường Ký tên : Cán chấm nhận xét : TS ðẶNG THÀNH TÍN Ký tên : Cán chấm nhận xét : TS LƯU THANH TRÀ Ký tên : Luận văn thạc sĩ ñược bảo vệ HỘI ðỒNG CHẤM BẢO VỆ LUẬN VĂN THẠC SĨ TRƯỜNG ðẠI HỌC BÁCH KHOA, ngày 15 tháng 07 năm 2009 TRƯỜNG ðẠI HỌC BÁCH KHOA PHÒNG ðÀO TẠO SðH CỘNG HÒA Xà HỘI CHỦ NGHĨA VIỆT NAM ðỘC LẬP – TỰ DO – HẠNH PHÚC Tp HCM, ngày 01 tháng 07 năm 2009 NHIỆM VỤ LUẬN VĂN THẠC SĨ Họ tên học viên: Phùng Thế Vũ Phái: Nam Ngày, tháng, năm sinh: 01-08-1983 Nơi sinh: Khánh Hoà Chuyên ngành: Kỹ Thuật ðiện Tử MSHV: 01407367 I- TÊN ðỀ TÀI: HỆ THỐNG ðỊNH TUYẾN VÀ GIÁM SÁT ðỐI TƯỢNG DỊCH CHUYỂN TRONG PHẠM VI RỘNG II- NHIỆM VỤ VÀ NỘI DUNG: - Tìm hiểu lý thuyết cơng nghệ định vị tồn cầu GPS mạng thơng tin di ñộng GSM - ðưa phương pháp ñịnh tuyến giám sát ñối tượng dịch chuyển phạm vi rộng - Xây dựng hệ thống phần cứng phần mềm - Chạy thực nghiệm hệ thống ñánh giá kết ñạt ñược III- NGÀY GIAO NHIỆM VỤ: 02-02-2009 IV- NGÀY HOÀN THÀNH NHIỆM VỤ: 03-07-2009 V- CÁN BỘ HƯỚNG DẪN : PGS.TS Lê Tiến Thường CÁN BỘ HƯỚNG DẪN (Học hàm, học vị, họ tên chữ ký) CN BỘ MÔN QL CHUYÊN NGÀNH LỜI CẢM ƠN ðầu tiên, xin chân thành gởi lời cảm ơn ñến người Thầy tận tâm PGS.TS.Lê Tiến Thường ñã giúp ñỡ tận tình trình thực luận văn Cách hướng dẫn hỗ trợ thầy tạo nhiều động lực cho em việc hồn thành tốt luận văn Em xin cảm ơn Thầy Cơ trường ðại Học Bách Khoa truyền đạt hướng dẫn cho em vấn ñề lý thuyết kỹ thuật ứng dụng thực tế ngành vơ tuyến điện tử em theo học ðồng thời, em xin cảm ơn bạn bè, anh em lớp ñã tư vấn hỗ trợ lúc thực ñề tài Xin cảm ơn gia đình người thân ln giúp đỡ ủng hộ trình học tập sống Một lần nữa, xin cảm ơn tất người ñã giúp đỡ em q trình học tập, tìm hiểu vấn ñề kỹ thuật sống TP HCM, ngày 01 tháng 07 năm 2009 Trân Trọng Phùng Thế Vũ LỜI MỞ ðẦU Sự phát triển vượt bậc cơng nghệ định vị tồn cầu GPS vài năm trở lại tảng thúc ñẩy phát triển nhiều ứng dụng ñịnh vị dẫn ñường hệ thống ñường băng máy bay giúp cho máy bay hạ cánh an tồn, hệ thống dẫn ñường biển giúp tàu vượt ñại dương mà khơng bị lạc, hệ thống tự động máy bay không người lái… cách sử dụng kết hợp cơng nghệ định vị tồn cầu GPS mạng thơng tin di động GSM xây dựng nên hệ thống hồn chỉnh định tuyến giám sát nhằm cung cấp nhu cầu mặt thông tin địa lí dẫn đường tự động Mơ hình hệ thống định tuyến giám sát lĩnh vực Robotics, robot tự ñiều chỉnh hướng ñi dựa vào hỗ trợ hệ thống ñịnh vị GPS, ứng dụng giám sát phương tiện vận chuyển Luận văn xây dựng mơ hình ứng dụng thực tế hệ thống ñịnh tuyến giám sát ñối tượng dịch chuyển phạm vi rộng Hệ thống có khả định tuyến giám sát dịch chuyển phương tiện, người robots… mơi trường ngồi trời dựa vào hệ thống định vị tồn cầu GPS mạng thơng tin di ñộng GSM Một thiết bị theo dõi hỗ trợ công nghệ GPS-eMD3620 công ty AT&S công nghệ GSM-GM862 cơng ty Telít, điều khiển vi xử lí trung tâm LM3S2965 dựa lõi ARM Cortex M3 32bit hệ mới, ñồng thời sử dụng cảm biến la bàn YAS529 công ty Yamaha cảm biến gia tốc KXSC7-2050 cơng ty Koinix để xác ñịnh hướng di chuyển ñối tượng dịch chuyển Hệ thống hoạt ñộng cách thu thập tin định vị từ máy thu GPS, sau gửi trung tâm giám sát dịch vụ gửi tin nhắn SMS GPRS Trung tâm giám sát ñược trang bị kít phát triển hỗ trợ cơng nghệ GSM-WMP100 cơng ty WaveCom, kết hợp với đồ số Google Map, để hiển thị xác vị trí ñối tượng dịch chuyển ñồ Luận văn trước tiên giới thiệu hướng nghiên cứu thực hiện, tảng kỹ thuật Tiếp theo đó, mơ hình hệ thống triển khai thực tế trình bày với thiết bị phần cứng sử dụng mơ hình Cuối chạy thực nghiệm ñánh giá khả hệ thống Từ khoá: ARM Cortex M3, GPS, GSM, Google Map, Wavecom-WMP100, YAS529, KXSC7-2050 Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường Mục Lục Mục Lục Danh sách hình Chương GIỚI THIỆU ðỀ TÀI 1.1 Hướng nghiên cứu 1.2 Khó khăn thách thức 1.3 Mục tiêu ñề tài 1.4 Nội dung phạm vi nghiên cứu Chương 11 LÝ THUYẾT VỀ GPS VÀ GSM 11 2.1 Hệ thống định vị tồn cầu GPS 11 2.1.1 Mơ hình hệ thống định vị tồn cầu GPS 12 2.1.1.1 Mảng người sử dụng 13 2.1.1.2 Mảng không gian 13 2.1.1.3 Mảng ñiều khiển 15 2.1.2 Các hệ vệ tinh hệ thống GPS 16 2.1.2.1 Thế hệ vệ tinh thứ 16 2.1.2.2 Thế hệ vệ tinh thứ hai 16 2.1.2.3 Thế hệ vệ tinh 16 2.1.2.4 Thế hệ vệ tinh Block IIR 17 2.1.3 Cách tính tọa độ thu dựa theo hình học 28 2.2 Mạng thơng tin di động GSM 32 2.2.1 Vài nét lịch sử mạng GSM 32 2.2.2 Các tiêu kỹ thuật mạng GSM 34 2.2.3 Cấu trúc hệ thống GSM 35 2.2.4 Các dịch vụ GSM 36 2.2.4.1 Dịch vụ thoại 36 2.2.4.2 Dịch vụ số liệu 36 2.2.4.3 Dịch vụ nhắn tin ngắn SMS 37 2.2.4.4 Dịch vụ WAP 37 2.2.4.5 Các dịch vụ GSM 2,5G 37 Chương 39 PHƯƠNG PHÁP ðỊNH TUYẾN VÀ GIÁM SÁT 39 3.1 Mơ hình hệ thống định tuyến giám sát 39 3.2 Phân tích định dạng mã hố liệu GPS 40 3.2.1 Một số thơng điệp chuẩn NMEA 41 3.2.1.1 GGA 41 3.2.1.2 GLL 42 Trang HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường 3.2.1.3 RMC 42 3.2.2 Mã hoá liệu GPS gói tin SMS 43 3.2.3 Giao thức truyền lệnh từ trung tâm giám sát xuống ñối tượng dịch chuyển 47 3.3 Phương pháp tính hướng khoảng cách hai vị trí GPS 48 3.3.1 Phương pháp tính khoảng cách ngắn 51 3.3.2 Phương pháp tính khoảng cách trung bình 52 3.3.3 Phương pháp tính khoảng cách xa 56 3.4 Phân tích tiến trình hoạt động thành phần 58 3.4.1 Trung tâm giám sát 58 3.4.2 ðối tượng dịch chuyển: 60 Chương 64 XÂY DỰNG HỆ THỐNG PHẦN CỨNG & PHẦN MỀM 64 4.1 Mơ tả đặc điểm kỹ thuật phần cứng 64 4.1.1 Module GPS-eMD3620 64 4.1.2 Kít phát triển GSM-WMP100 67 4.1.3 Bo mạch ñiều khiển gắn ñối tượng dịch chuyển 69 4.1.3.1 LM3S2965 70 4.1.3.2 GSM-GM862 74 4.1.3.2 Cảm biến la bàn YAS529 74 4.2 Mô hình phần mềm hệ thống định tuyến giám sát 77 4.2.1 Giao thức truyền thơng nối tiếp bất đồng (UART) 77 4.2.2 Giao thức truyền thơng nối tiếp đồng (I2C) 78 4.2.3 Mô hình phần mềm trung tâm giám sát 80 4.2.4 Mơ hình phần mềm thiết bị gắn ñối tượng dịch chuyển 86 Chương 91 THỰC NGHIỆM VÀ ðÁNH GIÁ KẾT QUẢ 91 5.1 Chương trình ứng dụng 91 5.2 Chạy thực nghiệm hệ thống ñịnh tuyến giám sát 93 5.3 ðánh giá kết 94 5.4 Hướng phát triển ñề tài 95 Tài liệu tham khảo 141 Trang HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường Danh sách hình Hình 1: Chịm vệ tinh GPS 11 Hình 2: Các mảng hệ thống GPS 12 Hình 3: Các hệ vệ tinh GPS 17 Hình 4: Minh họa vị trí thu người sử dụng vệ tinh 28 Hình 5: Mơ hình hệ thống GSM 36 Hình 6: Mơ hình hệ thống định tuyến giám sát đối tượng dịch chuyển ngồi trời 39 Hình 7: Mơ hình nhận liệu từ thiết bị thu GPS 41 Hình 8: ðịnh dạng khung liệu vị trí truyền trung tâm giám sát 44 Hình : ðịnh dạng khung liệu vị trí gói tin SMS truyền từ trung tâm giám sát chế ñộ ñịnh tuyến 44 Hình 10: Bảng chân trị bảng kết phép toán XOR hai bit 45 Hình 11: Hàm tính kiểm tổng chuỗi liệu dựa phép toán XOR 46 Hình 12: Hàm kiểm tổng chuỗi liệu dựa phép toán XOR 47 Hình 13: Bảng chân trị (true table) bảng kết phép toán XOR hai bit 47 Hình 14: Bảng trân trị bảng kết phép tốn XOR hai bit 48 Hình 15: Hàm chuyển ñổi tọa ñộ sang ñộ 49 Hình 16: Cách phân chia kinh ñộ bề mặt trái ñất 50 Hình 17: Cách phân chia vĩ ñộ bề mặt trái ñất 50 Hình 18: Hình chiếu dx, dy ñoạn thẳng d lên phương kinh ñộ vĩ độ 51 Hình 19: Hàm tính khoảng cách ngắn hai ñiểm bề mặt trái ñất 52 Hình 20: Biểu diễn ñiểm bề mặt trái đất khơng gian ba chiều dựa vào vĩ độ, kinh độ bán kính trái ñất 53 Hình 21: Biểu diễn khoảng cách thực hai ñiểm bề mặt trái ñất cung tròn 55 Hình 22: Hàm tính khoảng cách trung bình hai điểm bề mặt trái đất 55 Hình 23: Tam giác tạo thành từ cực bắc hai ñiểm tính tốn 56 Hình 24: Mặt phẳng chứa tâm trái đất hai điểm cần tính tốn 57 Hình 25: Mơ hình trung tâm xử lí liệu định vị 58 Hình 26: Mơ hình phần cứng thiết bị theo dõi gắn ñối tượng dịch chuyển 60 Hình 27: Mơ hình phần cứng thiết bị theo dõi gắn ñối tượng dịch chuyển 61 Hình 28: Kít phát triển module GPS-Emd3620 64 Hình 29: Sơ đồ mạch kít phát triển GPS-eMD3620 65 Hình 30: Sơ đồ khối module eMD3620 65 Hình 31: Kít phát triển WMP100 67 Hình 32: Bo mạch ñiều khiển gắn ñối tượng dịch chuyển 69 Hình 33: Modem GSM-GM862 ñược kết nối với bo mạch ñiều khiển 69 Hình 34: Kít phát triển LM3S2965[4] 70 Hình 35: Hình dạng đóng gói chip LM3S2965 70 Hình 36: Sơ đồ khối chức chip LM3S2965 71 Hình 37: Modem GM862 với đầy đủ anten GSM, GPS 74 Hình 38: Mơ hình cấu tạo bên cảm biến la bàn YAS529 75 Hình 39: Mơ hình cấu tạo bên cảm biến gia tốc……… 65 Trang HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường Hình 40: Giao thức truyền nối tiếp bất đồng bộ………………………………66 Hình 41: Mơ hình truyền liệu theo chuẩn RS232…………………………67 Hình 42: Mơ hình truyền liệu theo chuẩn I2C…………………………….67 Hình 43: Mơ hình truyền liệu theo chuẩn I2C…………………………….68 Hình 44: Lưu đồ giải thuật chương trình ứng dụng chạy máy tính…69 Hình 45: Mơ hình phần mềm thiết bị theo dõi gắn ñối tượng dịch….75 Hình 46: Giao diện điều khiển trung tâm giám sát chế ñộ satellite 91 Hình 47: Giao diện điều khiển trung tâm giám sát xem chế độ 91 Hình 48: Kết thực nghiệm hệ thống ñịnh tuyến giám sát xem chế ñộ hybrid 93 Trang HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường Một số từ viết tắt AMPS Advanced Mobile Phone Service BSS Base Station Subsystem CCITT International Telegraph and Telephone Consultative Committee DCS Digital Cellular System ECEF Earth Centred Earth Fixed ETSI Europe Telecommunication Standard Institute GIF Graphics Interchange Format GIS Geographic Information System GLCD Graphic Liquid Crystal Display GPRS General Packet Radio Service GPS Global Positioning System GSM Global System for Mobile Communication ISDN Integrated Services Digital Network JPEG Joint Photographic Experts Group MCS Master Control Station MMS Multimedia Messaging System MS Mobile Station NMEA National Marine Electronic Association NMT Nordic Mobile Telephone OCS Operational Control System OSS Operation Subsystem PC Personal Computer PDOP Position Dilution of Precision PPS Precise Positioning Service PRN The Pseudo-Random Noise PSTN Public Switched Telephone Network Trang HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường // Declare in-out buffer for GPS data communication static array^ form1_pcGpsInBuf = gcnew array(17); String^ form1_strGpsInBuf; String^ form1_strGpsOutBuf; #pragma region Windows Form Designer generated code void InitializeComponent(void) { this->components = (gcnew System::ComponentModel::Container()); this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer()); this->webBrowserCtrlControl1 = (gcnew WebBrowserCtrl::WebBrowserCtrlControl()); this->groupBox1 = (gcnew System::Windows::Forms::GroupBox()); this->cmbComSelect = (gcnew System::Windows::Forms::ComboBox()); this->label5 = (gcnew System::Windows::Forms::Label()); this->tBoxSendCmd = (gcnew System::Windows::Forms::TextBox()); this->tBoxReceivedData = (gcnew System::Windows::Forms::TextBox()); this->clearButton = (gcnew System::Windows::Forms::Button()); this->sendButton = (gcnew System::Windows::Forms::Button()); this->label4 = (gcnew System::Windows::Forms::Label()); this->label3 = (gcnew System::Windows::Forms::Label()); this->cmbMapType = (gcnew System::Windows::Forms::ComboBox()); this->label2 = (gcnew System::Windows::Forms::Label()); this->label1 = (gcnew System::Windows::Forms::Label()); this->txtLongitude = (gcnew System::Windows::Forms::TextBox()); this->txtLatitude = (gcnew System::Windows::Forms::TextBox()); this->btnCenter = (gcnew System::Windows::Forms::Button()); this->txtZoom = (gcnew System::Windows::Forms::TextBox()); this->btnSetZoom = (gcnew System::Windows::Forms::Button()); this->btnMapInfo = (gcnew System::Windows::Forms::Button()); this->serialPort = (gcnew System::IO::Ports::SerialPort(this->components)); this->dateTimePicker1 = (gcnew System::Windows::Forms::DateTimePicker()); this->splitContainer1->Panel1->SuspendLayout(); this->splitContainer1->Panel2->SuspendLayout(); this->splitContainer1->SuspendLayout(); this->groupBox1->SuspendLayout(); this->SuspendLayout(); // // splitContainer1 // this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill; Trang 129 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường this->splitContainer1->Location = System::Drawing::Point(0, 0); this->splitContainer1->Name = L"splitContainer1"; this->splitContainer1->Orientation = System::Windows::Forms::Orientation::Horizontal; // // splitContainer1.Panel1 // this->splitContainer1->Panel1->Controls->Add(this>webBrowserCtrlControl1); // // splitContainer1.Panel2 // this->splitContainer1->Panel2->Controls->Add(this->groupBox1); this->splitContainer1->Size = System::Drawing::Size(635, 701); this->splitContainer1->SplitterDistance = 385; this->splitContainer1->TabIndex = 1; // // webBrowserCtrlControl1 // this->webBrowserCtrlControl1->CenterLatitude = 10.793718; this->webBrowserCtrlControl1->CenterLongitude = 106.627349; this->webBrowserCtrlControl1->Dock = System::Windows::Forms::DockStyle::Fill; this->webBrowserCtrlControl1->HTMLFile = L"2.html"; this->webBrowserCtrlControl1->Location = System::Drawing::Point(0, 0); this->webBrowserCtrlControl1->MapType = WebBrowserCtrl::GoogleMapType::Satelite; this->webBrowserCtrlControl1->MinimumSize = System::Drawing::Size(20, 20); this->webBrowserCtrlControl1->Name = L"webBrowserCtrlControl1"; this->webBrowserCtrlControl1->Size = System::Drawing::Size(635, 385); this->webBrowserCtrlControl1->TabIndex = 0; this->webBrowserCtrlControl1->Zoom = 16; this->webBrowserCtrlControl1->MapClicked += gcnew WebBrowserCtrl::WebBrowserCtrlControl::MapClickedHandler(this, &Form1::webBrowserCtrlControl1_MapClicked); this->webBrowserCtrlControl1->MapTypeChanged += gcnew WebBrowserCtrl::WebBrowserCtrlControl::MapTypeChangedHandler(this, &Form1::webBrowserCtrlControl1_MapTypeChanged); // // groupBox1 // this->groupBox1->Controls->Add(this->cmbComSelect); Trang 130 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường this->groupBox1->Controls->Add(this->label5); this->groupBox1->Controls->Add(this->tBoxSendCmd); this->groupBox1->Controls->Add(this->tBoxReceivedData); this->groupBox1->Controls->Add(this->clearButton); this->groupBox1->Controls->Add(this->sendButton); this->groupBox1->Controls->Add(this->label4); this->groupBox1->Controls->Add(this->label3); this->groupBox1->Controls->Add(this->cmbMapType); this->groupBox1->Controls->Add(this->label2); this->groupBox1->Controls->Add(this->label1); this->groupBox1->Controls->Add(this->txtLongitude); this->groupBox1->Controls->Add(this->txtLatitude); this->groupBox1->Controls->Add(this->btnCenter); this->groupBox1->Controls->Add(this->txtZoom); this->groupBox1->Controls->Add(this->btnSetZoom); this->groupBox1->Controls->Add(this->btnMapInfo); this->groupBox1->Dock = System::Windows::Forms::DockStyle::Fill; this->groupBox1->Location = System::Drawing::Point(0, 0); this->groupBox1->Name = L"groupBox1"; this->groupBox1->Size = System::Drawing::Size(635, 312); this->groupBox1->TabIndex = 0; this->groupBox1->TabStop = false; this->groupBox1->Text = L"Control box"; // // cmbComSelect // this->cmbComSelect->FormattingEnabled = true; this->cmbComSelect->Location = System::Drawing::Point(277, 102); this->cmbComSelect->Name = L"cmbComSelect"; this->cmbComSelect->Size = System::Drawing::Size(76, 21); this->cmbComSelect->TabIndex = 17; this->cmbComSelect->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::cmbComSelect_SelectedIndexChanged); // // label5 // this->label5->AutoSize = true; this->label5->Location = System::Drawing::Point(274, 53); this->label5->Name = L"label5"; this->label5->Size = System::Drawing::Size(85, 13); this->label5->TabIndex = 16; this->label5->Text = L"Received Data :"; // Trang 131 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường // tBoxSendCmd // this->tBoxSendCmd->Location = System::Drawing::Point(359, 260); this->tBoxSendCmd->Name = L"tBoxSendCmd"; this->tBoxSendCmd->Size = System::Drawing::Size(197, 20); this->tBoxSendCmd->TabIndex = 15; // // tBoxReceivedData // this->tBoxReceivedData->AcceptsReturn = true; this->tBoxReceivedData->AcceptsTab = true; this->tBoxReceivedData->Location = System::Drawing::Point(359, 53); this->tBoxReceivedData->Multiline = true; this->tBoxReceivedData->Name = L"tBoxReceivedData"; this->tBoxReceivedData->ScrollBars = System::Windows::Forms::ScrollBars::Both; this->tBoxReceivedData->Size = System::Drawing::Size(264, 155); this->tBoxReceivedData->TabIndex = 14; // // clearButton // this->clearButton->Location = System::Drawing::Point(569, 214); this->clearButton->Name = L"clearButton"; this->clearButton->Size = System::Drawing::Size(54, 23); this->clearButton->TabIndex = 13; this->clearButton->Text = L"Clear"; this->clearButton->UseVisualStyleBackColor = true; this->clearButton->Click += gcnew System::EventHandler(this, &Form1::clearButton_Click); // // sendButton // this->sendButton->Location = System::Drawing::Point(569, 257); this->sendButton->Name = L"sendButton"; this->sendButton->Size = System::Drawing::Size(54, 23); this->sendButton->TabIndex = 12; this->sendButton->Text = L"Send"; this->sendButton->UseVisualStyleBackColor = true; this->sendButton->Click += gcnew System::EventHandler(this, &Form1::sendButton_Click); // // label4 // Trang 132 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường this->label4->AutoSize = true; this->label4->Location = System::Drawing::Point(274, 79); this->label4->Name = L"label4"; this->label4->Size = System::Drawing::Size(64, 13); this->label4->TabIndex = 11; this->label4->Text = L"Select COM"; // // label3 // this->label3->AutoSize = true; this->label3->Location = System::Drawing::Point(12, 105); this->label3->Name = L"label3"; this->label3->Size = System::Drawing::Size(54, 13); this->label3->TabIndex = 9; this->label3->Text = L"Map type:"; // // cmbMapType // this->cmbMapType->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList; this->cmbMapType->FormattingEnabled = true; this->cmbMapType->Items->AddRange(gcnew cli::array< System::Object^ >(3) {L"Normal", L"Satellite", L"Hybrid"}); this->cmbMapType->Location = System::Drawing::Point(93, 102); this->cmbMapType->Name = L"cmbMapType"; this->cmbMapType->Size = System::Drawing::Size(121, 21) this->cmbMapType->TabIndex = 8; this->cmbMapType->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::cmbMapType_SelectedIndexChanged); // // label2 // this->label2->AutoSize = true; this->label2->Location = System::Drawing::Point(199, 79); this->label2->Name = L"label2"; this->label2->Size = System::Drawing::Size(54, 13); this->label2->TabIndex = 7; this->label2->Text = L"Longitude"; // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(199, 53); Trang 133 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(45, 13); this->label1->TabIndex = 6; this->label1->Text = L"Latitude"; // // txtLongitude // this->txtLongitude->Location = System::Drawing::Point(93, 76); this->txtLongitude->Name = L"txtLongitude"; this->txtLongitude->Size = System::Drawing::Size(100, 20); this->txtLongitude->TabIndex = 5; this->txtLongitude->Text = L"106.648031"; // // txtLatitude // this->txtLatitude->Location = System::Drawing::Point(93, 50); this->txtLatitude->Name = L"txtLatitude"; this->txtLatitude->Size = System::Drawing::Size(100, 20); this->txtLatitude->TabIndex = 4; this->txtLatitude->Text = L"10.796531"; // // btnCenter // this->btnCenter->Location = System::Drawing::Point(12, 48); this->btnCenter->Name = L"btnCenter"; this->btnCenter->Size = System::Drawing::Size(75, 23); this->btnCenter->TabIndex = 3; this->btnCenter->Text = L"&Set center"; this->btnCenter->UseVisualStyleBackColor = true; this->btnCenter->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // txtZoom // this->txtZoom->Location = System::Drawing::Point(93, 22); this->txtZoom->Name = L"txtZoom"; this->txtZoom->Size = System::Drawing::Size(100, 20); this->txtZoom->TabIndex = 2; this->txtZoom->Text = L"17"; // // btnSetZoom // this->btnSetZoom->Location = System::Drawing::Point(12, 19); Trang 134 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường this->btnSetZoom->Name = L"btnSetZoom"; this->btnSetZoom->Size = System::Drawing::Size(75, 23); this->btnSetZoom->TabIndex = 1; this->btnSetZoom->Text = L"&Zoom"; this->btnSetZoom->UseVisualStyleBackColor = true; this->btnSetZoom->Click += gcnew System::EventHandler(this, &Form1::btnSetZoom_Click); // // btnMapInfo // this->btnMapInfo->Location = System::Drawing::Point(405, 19); this->btnMapInfo->Name = L"btnMapInfo"; this->btnMapInfo->Size = System::Drawing::Size(123, 23); this->btnMapInfo->TabIndex = 0; this->btnMapInfo->Text = L"Get map &information"; this->btnMapInfo->UseVisualStyleBackColor = true; this->btnMapInfo->Click += gcnew System::EventHandler(this, &Form1::btnMapInfo_Click); // // serialPort // this->serialPort->BaudRate = 115200; this->serialPort->Parity = System::IO::Ports::Parity::Even; this->serialPort->ReadTimeout = 1000; // // dateTimePicker1 // this->dateTimePicker1->Location = System::Drawing::Point(213, 0); this->dateTimePicker1->Name = L"dateTimePicker1"; this->dateTimePicker1->Size = System::Drawing::Size(200, 20); this->dateTimePicker1->TabIndex = 2; // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(635, 701); this->Controls->Add(this->dateTimePicker1); this->Controls->Add(this->splitContainer1); this->Name = L"Form1"; this->Text = L"Form1"; this->WindowState = System::Windows::Forms::FormWindowState::Maximized; Trang 135 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); this->Click += gcnew System::EventHandler(this, &Form1::Form1_Click); this->splitContainer1->Panel1->ResumeLayout(false); this->splitContainer1->Panel2->ResumeLayout(false); this->splitContainer1->ResumeLayout(false); this->groupBox1->ResumeLayout(false); this->groupBox1->PerformLayout(); this->ResumeLayout(false); } #pragma endregion private: HtmlDocument^ document; private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { } private: System::Void btnMapInfo_Click(System::Object^ sender, System::EventArgs^ e) { String^ info = "Zoom: " + this->webBrowserCtrlControl1->Zoom.ToString() + "\r\n"; info += "The center: " + this->webBrowserCtrlControl1>CenterLatitude.ToString() + "," + this->webBrowserCtrlControl1->CenterLongitude.ToString()+ "\r\n"; MessageBox::Show(info); } private: System::Void btnSetZoom_Click(System::Object^ sender, System::EventArgs^ e) { try { webBrowserCtrlControl1->Zoom = Int32::Parse(txtZoom->Text); } catch(Exception^ ex) { MessageBox::Show(ex->Message); } } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { try { webBrowserCtrlControl1->CenterLatitude = Double::Parse(txtLatitude->Text); webBrowserCtrlControl1->CenterLongitude = Double::Parse(txtLongitude->Text); Trang 136 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường webBrowserCtrlControl1->SetMarker(Double::Parse(txtLatitude>Text),Double::Parse(txtLongitude->Text),""); } catch(Exception^ ex) { MessageBox::Show(ex->Message); } } private: System::Void cmbMapType_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { switch(cmbMapType->SelectedIndex) { case 0: webBrowserCtrlControl1->MapType = WebBrowserCtrl::GoogleMapType::Normal; break; case 1: webBrowserCtrlControl1->MapType = WebBrowserCtrl::GoogleMapType::Satelite; break; default: webBrowserCtrlControl1->MapType = WebBrowserCtrl::GoogleMapType::Hybrid; break; } } private: System::Void webBrowserCtrlControl1_MapClicked(System::Object^ sender, WebBrowserCtrl::MapClickedEventArg^ e) { MessageBox::Show("The location is: [" + e>latitude.ToString() + "," + e->longitude.ToString() + "]"); } private: System::Void webBrowserCtrlControl1_MapTypeChanged(System::Object^ sender, WebBrowserCtrl::MapTypeEventArg^ e) { switch(e->Type) { case WebBrowserCtrl::GoogleMapType::Normal: MessageBox::Show("Map type is Normal"); break; case WebBrowserCtrl::GoogleMapType::Satelite: MessageBox::Show("Map type is Satelite"); break; case WebBrowserCtrl::GoogleMapType::Hybrid: Trang 137 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường MessageBox::Show("Map type is Hybrid"); break; } } private: System::Void cmbComSelect_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) { int selectedIndex = cmbComSelect->SelectedIndex; Object^ selectedItem = cmbComSelect->SelectedItem; MessageBox::Show("Selected : " + selectedItem->ToString()); Form1::Text = selectedItem->ToString() + " 115200 8-N-1"; if(serialPort->IsOpen) serialPort->Close(); serialPort->PortName = selectedItem->ToString(); serialPort->BaudRate = 115200; serialPort->DataBits = 8; serialPort->Parity = System::IO::Ports::Parity::None; serialPort->StopBits = System::IO::Ports::StopBits::One; serialPort->Handshake = System::IO::Ports::Handshake::RequestToSend; serialPort->ReadTimeout = 5000; serialPort->WriteTimeou try { serialPort->Open(); } // give a message, if the port is not available: catch(Exception^ ex) { MessageBox::Show(ex->Message); } } private: System::Void sendButton_Click(System::Object^ sender, System::EventArgs^ e) { serialPort->WriteLine(tBoxSendCmd->Text + "\r\n"); tBoxSendCmd->Clear(); } private: System::Void clearButton_Click(System::Object^ sender, System::EventArgs^ e) { tBoxReceivedData->Clear(); } private: System::Void processCOM() { u8 cnt = 1; // real data start from index = Trang 138 HVTH: Phùng Thế Vũ Luận văn tốt nghiệp cao học GVHD: PGS.TS Lê Tiến Thường u8 isGpsData = 0; array^ param = gcnew array(2); f32 debugLat = 0; f32 debugLon = 0; Gps_pos debugPosition; memset(&debugPosition, 0, sizeof(debugPosition)); // Control::CheckForIllegalCrossThreadCalls = false; isGpsData = gpsTrackingParser(form1_strGpsInBuf, form1_pcGpsInBuf); switch(isGpsData){ case 1: /* Get position */ debugPosition.lat.deg = (u8)( (chr_to_hex(form1_pcGpsInBuf[cnt++]) & 0x0F)

Ngày đăng: 16/02/2021, 18:36

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w