-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from LStudioLoren/dev
重构了目录
- Loading branch information
Showing
25 changed files
with
819 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# 项目排除路径 | ||
/venv/ | ||
/venv/ | ||
/data/no_git_folder/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import binascii | ||
|
||
import serial | ||
|
||
import serial.tools.list_ports | ||
import time | ||
class serialConfig: | ||
|
||
def initPort(self,portNum,baudrate): | ||
self.ser = serial.Serial() | ||
self.ser.port = "COM"+portNum | ||
self.ser.baudrate = baudrate | ||
self.ser.timeout = 1 | ||
self.ser.open() | ||
if self.ser.isOpen(): | ||
return self.ser | ||
else: | ||
print("open serial error!check port num and baudrate!") | ||
|
||
def updateFW(filepath,ser): | ||
#fo = open("D:\program\python\SPPositionWithGPSandGLO\data\OM7MR0800RN0000.shex", mode='r', newline='\r\n') | ||
fo = open(filepath, mode='r', newline='\r\n') | ||
|
||
maxlenth = 0 | ||
# while True: | ||
pack_data = "" | ||
count = 0 | ||
|
||
while True: | ||
#for i in range(10): | ||
fline = fo.readline().strip() | ||
|
||
if fline == "": | ||
break | ||
|
||
|
||
if fline.startswith("S0") or fline.startswith("S5") or fline.startswith("S7"): | ||
pack_data = "SOFTLOADSREC \""+fline+"\"\r\n" | ||
ser.write(pack_data.encode("utf8")) | ||
print(pack_data) | ||
#while True: | ||
time.sleep(0.2) | ||
if ser.inWaiting() > 0: | ||
# ser.write("LOG version\r\n".encode("gbk")) | ||
|
||
data_str = ser.read(ser.inWaiting()).decode('ascii') | ||
print(data_str) | ||
#print(ser.readlines()) | ||
|
||
#if check.find("OK") >0: | ||
#break | ||
#print() | ||
pack_data = "" | ||
elif fline.startswith("S3"): | ||
line = fline.replace("S3", "", 1) | ||
line_len = int(line[0:2], 16) | ||
line_add = line[2:10] | ||
line_data = line[10:line_len * 2] | ||
# print(len(bytes(line_data, encoding='UTF8'))) | ||
pack_data += line_data | ||
if len(bytes(pack_data, encoding='UTF8')) + 56 > 4096 or line_len < 33: | ||
pack_data2 = "SOFTLOADDATA " + pack_data +"\r\n" | ||
print(count,pack_data2) | ||
ser.write(bytes(pack_data2)) | ||
#while True: | ||
#check = ser.read(15) | ||
#if check.find("OK") > 0: | ||
#break | ||
time.sleep(0.2) | ||
if ser.inWaiting() > 0: | ||
#ser.write("LOG version\r\n".encode("gbk")) | ||
|
||
data_str = ser.read(ser.inWaiting()).decode('ascii') | ||
print(data_str) | ||
pack_data = "" | ||
count += 1 | ||
ser.write(bytes("SOFTLOADCOMMIT", encoding='ascii')) | ||
# while True: | ||
# check = ser.read(15) | ||
# if check.find("OK") > 0: | ||
# break | ||
time.sleep(0.2) | ||
while True: | ||
if ser.inWaiting() > 0: | ||
# ser.write("LOG version\r\n".encode("gbk")) | ||
data_str = ser.read(ser.inWaiting()).decode('ascii') | ||
print(data_str) | ||
# print("SOFTLOADDATA",fline,line_len,line_add,bytes(line_data,encoding='UTF8')) | ||
|
||
if __name__ == '__main__': | ||
ser = serialConfig().initPort("13",230400) | ||
ser.write("SOFTLOADRESET\r\n".encode("ASCII")) | ||
updateFW("/data/no_git_folder/OM7MR0800RN0000.shex", ser) | ||
#for i in range(20): | ||
#ser.write("log version\r\n".encode("gbk")) | ||
# while True: | ||
# if ser.inWaiting() > 0: | ||
# ser.write("LOG version\r\n".encode("gbk")) | ||
# time.sleep(0.2) | ||
# data_str = ser.read(ser.inWaiting()).decode('ascii') | ||
# print(data_str,end='') | ||
# #else: | ||
#break | ||
|
||
#while True: | ||
#print(ser.read(15)) | ||
#print(count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
# project1 | ||
学习PY,加使用PY实现卫星定位算法 | ||
# Py_study目录: | ||
# SatellitePosition项目 | ||
此项目是关于学习PY,以及使用PY实现卫星定位算法,目前v1.0版本实现将rinex格式数据进行读取,并实现基于测距的单点定位算法。 | ||
|
||
## Py_study目录: | ||
主要是关于py的一些学习,功能实现的方式等。 | ||
|
||
# singlepoint目录: | ||
学习并实现卫星的基于伪距的单点定位算法实现。 | ||
## positon目录: | ||
学习并实现卫星的定位算法,目前实现伪距单点定位算法 | ||
|
||
### 1、common目录: | ||
- \_\_init\_\_:初始化类 | ||
- CoordinateTransformation.py:XYZ坐标系与BLH坐标系互相转换的功能类。 | ||
- NAVDATA.py:包含将rinex格式的星历文件进行提取转换的方法,并打包成星历类。 | ||
- OBSDATA.py:包含将rinex格式的观测量文件进行提取转换的方法,并打包成观测值类。 | ||
- SATPOS.py:用于计算卫星坐标的方法。 | ||
- tool.py:包含了一些常用的常参、数学方法等工具。 | ||
- solution.py:包含定位结果、历元时间、解算卫星数、定位状态、age等信息 | ||
|
||
### 2、singlepoint目录 | ||
- \_\_init\_\_:初始化类 | ||
- singlepoint.py:主函数。 | ||
- SINGLEPOINTPOSITION.py:实现单点定位算法。 | ||
### 3、rtkpoint目录 | ||
- \_\_init\_\_:初始化类 | ||
- rtkpoint.py:主函数。 | ||
- RTKPOSITION.py:实现RTK算法,正在完善 | ||
|
||
CoordinateTransformation.py:XYZ坐标系与BLH坐标系互相转换的功能类。 | ||
NAVDATA.py:包含将rinex格式的星历文件进行提取转换的方法,并打包成星历类。 | ||
OBSDATA.py:包含将rinex格式的观测量文件进行提取转换的方法,并打包成观测值类。 | ||
SATPOS.py:用于计算卫星坐标的方法。 | ||
singlepoint.py:主函数。 | ||
SINGLEPOINTPOSITION.py:实现单点定位算法。 | ||
tool.py:包含了一些常用的常参、数学方法等工具。 |
Oops, something went wrong.