Ulyxes PyAPI developer’s documentation¶
Ulyxes PyAPI provides several classes to handle surveyor’s sensors e.g. totalstations, NMEA GNSS receivers, etc.
GENERIC MODULES¶
Angles¶
- class angle.Angle(value, unit='RAD')[source]¶
Angle class, value stored in radian internally. Angle units supported:
RAD radians (e.g. 1.54678432)
DMS sexagesimal (Degree-Minute-Second, e.g. 123-54-24)
DEG decimal degree (e.g. 25.87659)
GON gradians, the whole circle is 400g (e.g. 387.7857)
NMEA ddmm.mmmm used in NMEA sentences (e.g. 47.338765)
PDEG pseudo sexagesimal (e.g. 156.2745 = 156-27-45)
SEC sexagesimal seconds
MIL mills the whole circle is 6400 mills
Operators supported:
+ add two angles (e.g. c = Angle(180, ‘DEG’) + Angle(‘12-34-56’, ‘DMS’))
- substract two angles (e.g. d = Angle(180, ‘DEG’) - Angle(‘12-34-56’, ‘DMS’))
+= increment angle (e.g. c += Angle(1, ‘GON’))
-= decrement angle (e.g. d -= Angle(1, ‘GON’))
str() convert angle to GON string, used in print
- Parameters
value – angle value
unit – angle unit (available units RAD/DMS/DEG/GON/NMEA/PDEG/SEC/MIL)
DATA READERS¶
Reader¶
- class reader.Reader(name=None, filt=None)[source]¶
Base class for different readers (virtual)
- Parameters
name – name of reader (str), default None
filt – list of mandatory field names in input record to keep
File Reader¶
Csv Reader¶
- class csvreader.CsvReader(name=None, fname=None, separator=';', filt=None, fields=None)[source]¶
Class to read csv file, first line must contain field names or column names are in fields parameter
- param name
name of reader (str), default None
- param fname
name of input file
- param separator
field separator, default ;
- param filt
list of fields to use, default None (use all)
- param fields
list of field names for columns in CSV if not in the first line
Geo Reader¶
HTTP Reader¶
- class httpreader.HttpReader(name=None, url=None, pids=None, ptys=None, filt=None)[source]¶
Class to read data from web in JSON format No filter implemented filter by point name and point type TODO
- Parameters
name – name of reader (str), default None
url – url to read from
pids – point ids to query, list
ptys – point types to query FIX/STA/MON list
JSON Reader¶
Configuration Reader¶
- class confreader.ConfReader(name=None, fname=None, pars=None)[source]¶
Class to read json configuration file
- Parameters
name – name of reader (str), default None
fname – name of input file
pars – a dictionary for parameter validation e.g. {key : {}}, valid keys for individual config parameters are: required (True/False), type (int/float/str/list)
SqLite Reader¶
OBSOLATE USE dbreader.py
- class sqlitereader.SqLiteReader(db, sql, name=None, filt=None)[source]¶
Class to read observations/coordinates from a local sqlite database
- Parameters
name – name of reader (str)
angle – angle unit to use (str), DMS not supported
dist – distance and coordinate format (str)
dt – date/time format (str), default ansi
filt – list of allowed keys (list)
db – name of database file (str)
Queue Reader¶
INTERFACES¶
Interfaces handle the connection to the physical sensors.
Generic Iface¶
Local Iface¶
- class localiface.LocalIface(name='Local', fname='None', mode='seq')[source]¶
This local interface stands for using PyAPI without any instrument. A file is used to read data instread of instrument. It is mainly for developing or testing. rand mode can be used with GeoCom commands only, if more lines with identical codes are in the input file, they are used sequentially
- Parameters
name – name of the interface (str), default ‘Local’
fname – name of the file the data read from
mode – seq/rand, seq=read the input sequentially (e.g. NMEA GNSS), rand=get line with given key (e.g. leica totalstation)
Serial Iface¶
- class serialiface.SerialIface(name, port, baud=9600, byteSize=8, parity='N', stop=1, timeout=17, eomRead='\r\n', eomWrite='\r\n')[source]¶
Interface to communicate through serial interface. This class depends on pyserial.
- param name
name of serial interface (str)
- param port
port name e.g. com1: or /dev/stty1
- param baud
communication speed (int), default 9600
- param byteSize
byte size in communication (int), default 8
- param parity
parity of bytes even/odd/none, default none
- param stop
number of stop bits (int), default 1
- param timeout
communication timeout seconds (int), default 12
- param eomRead
end of message char from instrument (str), default ‘rn’
- param eomWrite
end of message char from computer (str), default ‘rn’
- GetLine()[source]¶
read from serial interface until end of line
- Returns
line read from serial (str) or empty string on timeout or error, state is set also
Bluetoth Iface¶
Video Iface¶
I2C Iface¶
WEB Iface¶
Gama Iface¶
- class gamaiface.GamaIface(gama_path, dimension=3, probability=0.95, stdev_angle=1, stdev_dist=1, stdev_dist1=1.5)[source]¶
Interface class to GNU Gama
- add_observation(obs)[source]¶
Add observation to adjustment
- Parameters
obs – observation to add (dic)
- add_point(point, state='ADJ')[source]¶
Add point to adjustment
- Parameters
point – point to ad network (dic)
state – FIX or ADJ (str)
- adjust()[source]¶
Export data to GNU Gama xml, adjust the network and read result
- Returns
result list of adjusment and blunder from GNU Gama
Raspberry PI Camera Interface¶
TCP Interface¶
- class tcpiface.TCPIface(name, address, bufSize=1024, timeout=15)[source]¶
Interface to communicate on TCP/IP protocol. This class requires socket.
- Parameters
name – name of tcp interface (str)
address – address of server (tuple) (ip(str), port(int))
bufSize – size of buffer in case of file (int)
timeout – communication timeout seconds (int), default 15
- GetLine(fileSize=None)[source]¶
read from TCP interface until end of line
- Parameters
fileSize – the size of the expected file (int)
- Returns
line read from TCP (str) or empty string on timeout or error, state is set also
MEASURE UNITS¶
Measure units are responsible for the specific instrument features.
Generic Measure Unit¶
Leica Measure Unit¶
- class leicameasureunit.LeicaMeasureUnit(name='Leica generic', typ='TPS')[source]¶
This class contains the Leica robotic total station specific functions common to all leica robot TS
- param name
name of ts (str), default ‘Leica generic’
- param type
type of ts (str), default ‘TPS’
- CoordsMsg(wait=15000, incl=0)[source]¶
Get coordinates
- Parameters
wait – wait-time in ms, optional (default 15000), it must be greater than 12000, the default on instrument
incl – inclination calculation - 0/1/2 = measure always (slow)/calculate (fast)/automatic, optional (default 0)
- Returns
get coordinates message
- GetAtmCorrMsg()[source]¶
Get atmospheric correction settings
- Returns
iget atmospheric settings message
- static GetCapabilities()[source]¶
Get instrument specialities
- Returns
empty list, do not use generic instrument
- GetInstrumentNoMsg()[source]¶
Get instrument factory number
- Returns
get instrument factory number message
- GetInternalTemperatureMsg()[source]¶
Get instrument internal temperature
- Returns
instrument internal temperature
- GetMeasureMsg(wait=15000, incl=0)[source]¶
Get measured distance
- Parameters
wait – time in ms, optional (default 15000), it must be greater than 12000, the default on the instrument
incl – inclination calculation - 0/1/2 = measure always (slow)/calculate (fast)/automatic, optional (default 0)
- Returns
get simple measurement message
- GetPrismTypeMsg()[source]¶
Get prism type
- Returns
prism type (0/1/2/3/4/5/6/7 round/mini/tape/360/user1/user2/user3/360 mini)
- GetRefCorrMsg()[source]¶
Get refraction correction setting
- Returns
get refraction correction message
- MeasureDistAngMsg(prg)[source]¶
Measure angles and distance
- Parameters
prg – EDM program
- Returns
measure angle distance message
- MeasureMsg(prg=1, incl=0)[source]¶
Measure distance
- Parameters
prg – measure program 1/2/3/… = default/track/clear…, optional (default 1, mode set before)
incl – inclination calculation - 0/1/2 = measure always (slow)/calculate (fast)/automatic, optional (default 0)
- Returns
measure message
- MoveMsg(hz, v, atr=0)[source]¶
Rotate instrument to direction with ATR or without ATR
- Parameters
hz – horizontal direction (Angle)
v – zenith angle (Angle)
atr – 0/1 atr off/on, default off
- Returns
rotate message
- Result(msgs, anss)[source]¶
Parse answer from message
- Parameters
msgs – messages sent to instrument
anss – aswers got from instrument
- Returns
dictionary
- SetATRMsg(atr)[source]¶
Set ATR status on/off
- Parameters
atr – 0/1 = off/on
- Returns
set atr message string
- SetAtmCorrMsg(valueOfLambda, pres, dry, wet)[source]¶
Set atmospheric correction settings
- Parameters
valueOfLambda – Constant for the instrument not changeable, use GetAtmCorr to get value
pres – pressure value
dry – dry temperature
wet – wet temperature
- Returns
set atmospheric correction message
- SetEDMModeMsg(mode)[source]¶
Set EDM mode
- Parameters
mode – string name/code
- Returns
set edm mode message
- SetLockMsg(lock)[source]¶
Set Lock status
- Parameters
lock – 0/1 = off/on
- Returns
set lock status message
- SetOriMsg(ori)[source]¶
Set orientation angle
- Parameters
ori – bearing of direction (Angle)
- Returns
0 or error code
- SetPcMsg(pc)[source]¶
Set prism constant
- Parameters
pc – prism constant [mm]
- Returns
set prism constant message
- SetPrismTypeMsg(typ)[source]¶
Set prism type
- Parameters
typ – prism type (0/1/2/3/4/5/6/7 round/mini/tape/360/user1/user2/user3/360 mini)
- SetRefCorrMsg(status, earthRadius, refracticeScale)[source]¶
Set refraction correction settings
- Parameters
status – 0/1 = off/on
earthRadius – radius ot the Earth
refracticeScale – refractice scale
- Returns
set refraction message
- SetSpiralMsg(dRangeHz, dRangeV)[source]¶
Set search priral parameters
- Parameters
dRangeHz – horizontal range of search (Angle)
dRangeV – vertical range of search (Angle)
- Returns
set search spiral message
Leica TCA 1800 Unit¶
Leica TPS 1200 Unit¶
- class leicatps1200.LeicaTPS1200(name='Leica TPS1200', typ='TPS')[source]¶
This class contains the Leica TPS1200 robotic total station specific functions
- param name
name of ts (str), default=TPS1200
- param type
type od ts (str), default=TPS
- PowerSearchMsg(direction)[source]¶
Power search
- Parameters
direction – 1/-1 clockwise/counter clockwise
- Returns
Power search message
Leica TCRA 1100 Unit¶
Trimble 5500 Unit¶
- class trimble5500.Trimble5500(name='Trimble 5500', typ='TPS')[source]¶
This class contains the Trimble 5500 robotic total station specific functions
- param name
name of ts (str), default ‘Trimble 5500’
- param type
type of ts (str), default ‘TPS’
- CoordsMsg(wait=1000, incl=0)[source]¶
Get coordinates
- Parameters
wait – wait-time in ms, optional (default 1000)
incl – inclination calculation - 0/1/2 = measure always (slow)/calculate (fast)/automatic, optional (default 0)
- Returns
get coordinates message
- static GetCapabilities()[source]¶
Get instrument specialities
- Returns
empty list, do not use generic instrument
- GetMeasureMsg(dummy1=None, dummy2=None)[source]¶
Get measured distance
- Parameters
dummy1 – dummy parameter for compatibility with Leica
dummy2 – dummy parameter for compatibility with Leica
- Returns
get measurement message
- MeasureDistAngMsg(dummy=None)[source]¶
Measure angles and distance
- Parameters
prg – dummy parameter for compatibility with Leica
- Returns
measure angle distance message
- MeasureMsg(dummy1=None, dummy2=None)[source]¶
Measure distance
- Parameters
dummy1 – dummy parameter for compatibility with Leica
dummy2 – dummy parameter for compatibility with Leica
- Returns
measure message
- MoveMsg(hz, v, dummy=None)[source]¶
Rotate instrument to direction
- Parameters
hz – horizontal direction (Angle)
v – zenith angle (Angle)
dummy – dummy parameter for compatibility with Leica
- Returns
rotate message
- Result(msgs, anss)[source]¶
Parse answer from message
- Parameters
msgs – messages sent to instrument
anss – answers got from instrument
- Returns
dictionary
- SetAtmCorrMsg(ppm, pres=None, dry=None, wet=None)[source]¶
Set atmospheric correction settings using ppm or presure, dry and wet temperature
- Parameters
ppm – atmospheric correction [mm/km] (int)
pres – air presure (optional)
dry – dry temperature (optional)
wet – wet temperature (optional)
- Returns
set atmospheric correction message
- SetEDMModeMsg(mode)[source]¶
Set EDM mode
- Parameters
mode – mode name (str) or code (int)
- Returns
set edm mode message
- SetOriMsg(ori)[source]¶
Set orientation angle
- Parameters
ori – bearing of direction (Angle)
- Returns
set orientation angle message
- SetPcMsg(pc)[source]¶
Set prism constant
- Parameters
pc – prism constant [mm]
- Returns
set prism constant message
Leica DNA Unit¶
- class leicadnaunit.LeicaDnaUnit(name='Leica level', typ='Level')[source]¶
Leica DNA measure unit
- Parameters
name – name of measure unit (str), default ‘Leica level’
typ – type of measure unit (str), default ‘Level’
- Result(msg, ans)[source]¶
process result of a measurement
- Parameters
msg – message sent
ans – answer to message
- Returns
observation results (dictionary)
NMEA GNSS Unit¶
- class nmeagnssunit.NmeaGnssUnit(filt=None, name='Nmea Gnss', typ=None)[source]¶
NMEA measure unit
- Parameters
filt – NMEA sentence filter list e.g. [“GGA”, “GNS”]
name – name of nmea unit (str), default ‘Nmea Gnss’
typ – type of nmea unit (str), default None
- Nmea2Coo(msg)[source]¶
process GGA nmea message
- Parameters
msg – NMEA GGA/GNS/RMC/GLL sentence
- Returns
dictionary of data
- static NmeaChecksum(msg)[source]¶
NMEA message checksum
- Parameters
msg – NMEA message
- Returns
True/False
Video Unit¶
BMP180 Unit¶
Based on Adafruit_BMP created by Tony DiCola
- class bmp180measureunit.BMP180MeasureUnit(name=None, typ='pressure sensor', mode=1)[source]¶
Adafruit BMP180 digital pressure sensor
- Parameters
name – name of measure unit (str), default None
typ – type of measure unit (str), default None
LSM9DS0 Unit¶
- class lsm9ds0unit.LSM9DS0Unit(name='LSM9DS0', typ='9DOF')[source]¶
LSM9DS0 9 DOF sensor
- Parameters
name – name of measure unit (str), default LSM9DS0
typ – type of measure unit
- InitAccelMsg(accel_scale=0, accel_odr=1)[source]¶
Initialize accelerometer
- Parameters
accel_scale – measure range 2g/4g/6g/8g/16g (int), default 2g
accel_odr – output data range (int), default 3.125 Hz
- Returns
initialize message of accelerometer
- InitGyroMsg(gyro_scale=0, gyro_odr=0)[source]¶
Initialize gyroscope
- Parameters
gyro_scale – 245/500/2000dps (int), default 245 dps
gyro_odr – output data range (int), default 95 Hz
- Returns
initialize message of gyroscope
- InitMagMsg(mag_scale=0, mag_odr=0)[source]¶
Initialize magnetometer
- Parameters
mag_scale – 2Gs/4Gs/8Gs/12Gs (int), default 2Gs
mag_odr – output data range (int), default 3.125
- Returns
initialize message of magnetometer
Wifi Unit¶
Web Met Unit¶
Raspberry PI Camera Unit¶
- class picameraunit.PiCameraUnit(name=None, typ=None)[source]¶
Picamera Unit for handle Picamera device
- Parameters
name – name of measure unit (str), default None
typ – type of measure unit (str), default None
SENSORS/INSTRUMENTS¶
Sensors or instruments integrate the interface, the measure unit and the optional writer. Interface is responsible for the communication with the physical device, measure unit gives the specific features of intruments, the writer adds the storing logic for observed data.
Generic Instrument¶
codes handles by descendent classes:
atrStatus: 0/1 ATR on/off, totalstation
crossincline: angle from vertical, totalstation
distance: measured distance, totalstation
dryTemp: dry temperature, met sensor
earthRadius: radius of Earth, totalstation
east: coordinate, totalstation, GPS
edmMode: distance measurement mode, totalstation
elev: elevation, totalstation, GPS
errorCode: error code from sensor, any instrument
hz: horizontal angle, totalstation
hzRange: horizontal search range, totalstation
ih: instrument height, totalstation
instrName: name of instrument, any
instrNo: product number, any
intTemp: internal temperature of instrument, totalstation, level
lambda: …, totalstation
lengthincline: angle from vertical, totalstation
lockStat: lock status, totalstation
north: coordinate, totalstation, GPS
pc: prism constant, totalstation
pressure: air pressure, met sensor
pt: prism type, totalstation
refractiveScale: …, totalstation
status: …,…
v: zenith angle, totalstation
vRange: vertical search range, totalstation
wetTemp: wet temperature, met sensor
- class instrument.Instrument(name, measureUnit, measureIface, writerUnit=None)[source]¶
Base class for different instruments
- Parameters
name – name of instrument (str)
measureUnit – measure unit of the instrument (MeasureUnit)
MeasureIface – interface to physical intrument (Iface)
writerUnit – unit to save observed data (Writer), optional
Totalstation¶
- class totalstation.TotalStation(name, measureUnit, measureIface, writerUnit=None)[source]¶
Generic total station instrument
- Parameters
name – name of instrument
measureUnit – measure unit part of instrument
measureIface – interface to physical unit
writerUnit – store data, default None
- Coords(wait=15000, incl=0)[source]¶
Read coordinates from instrument
- Parameters
wait – waiting time ms
incl – inclination
- Returns
coordinates in a dictionary
- GetFace()[source]¶
Get face left or face right
- Returns
0/1 face left/face right in a dictionary or None in case of error
- GetInternalTemperature()[source]¶
Get instrument internal temperature
- Returns
processed answer from instrument
- GetMeasure(wait=15000, incl=0)[source]¶
Get measured values
- Parameters
wait – waiting time in ms
inc – inclination …
- Returns
observations in a dictionary
- GetStation()[source]¶
Get station coordinates
- Returns
station coordinates and instrument height (dictionary)
- Measure(prg='DEFAULT', incl=0)[source]¶
Measure distance
- Parameters
prg – EDM program, DEFAULT is the only reasonable value
incl – not used, only for compability
- Returns
empty dictionary
- MeasureDistAng(prg='DEFAULT')[source]¶
Measure distance and return observations
- Returns
observations in a dictionary
- Move(hz, v, atr=0)[source]¶
Rotate instrument to a given direction
- Parameters
hz – horizontal direction (Angle)
v – zenith (Angle)
atr – 0/1 ATR on/off
- MoveRel(hz_rel, v_rel, atr=0)[source]¶
Rotate the instrument relative to actual direction
- Parameters
hz_rel – relative horizontal rotation (Angle)
v_rel – relative zenith rotation (Angle)
atr – 0/1 atr on/off
- PowerSearch(direction=1)[source]¶
Start power search
- Parameters
direction – 1/-1 clockwise/counter clockwise
- Returns
empty list if succesfull
- SetATR(atr)[source]¶
Set ATR on
- Parameters
atr – 0/1 ATR off/on
- Returns
processed answer from instrument
- SetAtmCorr(valueOfLambda, pres, dryTemp, wetTemp=None)[source]¶
Set atmospheric correction
- Parameters
valueOfLambda – instrument specific constant
pres – air presure
dryTemp – dry temperature
wetTemp – wet temperature
- SetEDMMode(mode)[source]¶
Set EDM mode
- Parameters
mode – mode name/id as listed in measure unit
- Returns
empty dictionary
- SetLock(lock)[source]¶
Set lock on prism
- Parameters
lock – 0/1 lock off/on
- Returns
processed answer from instrument
- SetOri(ori)[source]¶
Set orientation
- Parameters
ori – bearing to direction (Angle)
- Returns
empty dictionary
- SetPc(pc)[source]¶
Set prism constant
- Parameters
pc – prism constant [m]
- Returns
processed answer from instrument
- SetRedLaser(on)[source]¶
Set on/off red laser
- Parameters
on – 0/1 off/on
- Returns
empty dictionary or error
- SetRefCorr(status, earthRadius, refracticeScale)[source]¶
Set refraction correction
- Parameters
status –
???
earthRadius – radius of earth
refracticeScale –
???
- SetSearchArea(hzCenter=None, vCenter=None, hzRange=None, vRange=None, on=1)[source]¶
Set range for power search
- Parameters
hzCenter – center direction (Angle)
vCenter – center direction (Angle)
hzRange – horizontal range to search (default full circle) (Angle)
vRange – vertical range to search (default 95 degree) (Angle)
on – 0/1 off/on
- SetSpiral(dRangeHz, dRangeV)[source]¶
Set search spiral parameters
- Parameters
dRangeHz – horizontal range (Angle)
dRangeV – vertical range (Angle)
- SetStation(easting, northing, elevation, ih=0.0)[source]¶
Set station coordinates
- Parameters
easting – easting of station
northing – northing of station
elevation – elevation of station
ih – instrument height
- Returns
???
GNSS¶
Digital Level¶
- class digitallevel.DigitalLevel(name, measureUnit, measureIface, writerUnit=None)[source]¶
Class to handle Leica DNA digital level
- Parameters
name – name of digital lvel instrument
measureUnit – reference to measure unit
measureIface – reference to measure interface
writerUnit – store data
Web Camera¶
BMP180 Air Pressure Sensor¶
Based on BMP085.py created by Tony DiCola
- class bmp180.BMP180(name, measureUnit, measureIface, writerUnit=None)[source]¶
BMP180/BMP085 air pressure sensor
- Parameters
name – name of sensor (str)
measureUnit – measure unit of the sensor (MeasureUnit)
MeasureIface – interface to physical sensor (Iface)
writerUnit – unit to save observed data (Writer), optional
LSM9DS0 9DOF sensor¶
- class lsm9ds0.LSM9DS0(name, measureUnit, measureIfaces, writerUnit=None)[source]¶
LSM9DS0 9DOF sensor
- Parameters
name – name of instrument (str)
measureUnit – measure unit of the instrument (MeasureUnit)
measureIfaces – interfaces to physical intruments (tuple of two I2CIfaces, first for accelerometer/magnetometer, second for gyroscope)
writerUnit – unit to save observed data (Writer), optional, default None
WiFi Collector¶
- platform
Unix, Windows
- synopsis
Ulyxes - an open source project to drive total stations and publish observation results. GPL v2.0 license Copyright (C) 2010- Zoltan Siki <siki.zoltan@epito.bme.hu>
- class wificollector.WifiCollector(name, measureUnit, measureIface=None, writerUnit=None)[source]¶
Wifi collector collects information about available wifi networks This modul depends on https://github.com/rockymeza/wifi
- param name
name of instrument
- param measureUnit
measure unit part of instrument
- param measureIface
interface to measure unit, default None
- param writerUnit
store data, default None
Web Met Sensor¶
- class webmet.WebMet(name, measureUnit, measureIface, writerUnit=None)[source]¶
Get meteorological data from the Internet
- Parameters
name – name of sensor (str)
measureUnit – measure unit of the sensor (MeasureUnit)
MeasureIface – interface to physical sensor (Iface)
writerUnit – unit to save observed data (Writer), optional
- GetPressure(withTemp=0)[source]¶
Get pressure in HPa from sensor
- Parameters
withTemp – dummy parameter for inherited classes
- Returns
temperature data as dict
- static GetWetTemp(temp, humi)[source]¶
Calculate wet temperature from humidity and temperature formula from http://journals.ametsoc.org/doi/pdf/10.1175/JAMC-D-11-0143.1
- Parameters
temp – dry temperature
humi – humidity as percent
Camera¶
Camera station¶
- class camerastation.CameraStation(name, measureUnit, measureIface, writerUnit=None)[source]¶
CameraStation class for TotalStation combinated with camera
- Parameters
name – name of instrument
measureUnit – measure unit part of instrument
measureIface – interface to physical unit
writerUnit – store data, default None
- GetAbsAngles(targetType=None)[source]¶
Get absolute angles with automatical target recognition (not prism)
- Parameters
targetType – type of target (None)
- Returns
corrected horinzontas (hz) and vertical (v) angles in dictionary. It contains the last correction angles too.
Raspberry PI SenseHat¶
WRITERS¶
Writers are responsible to store observed data on different media.
Writer¶
- class writer.Writer(name=None, angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None)[source]¶
Base class for different writers (virtual)
- Parameters
name – name of writer (str), default None
angle – angle unit to use (str), default GON
dist – distance and coordinate format (str), default .3f
dt – date/time format (str), default ansi
filt – list of keys to output (list), default None
- DropData(data)[source]¶
Decide if data will be output or dropped
- Parameters
data – data to output
- Returns
True if no index in filter is present
Echo Writer¶
- class echowriter.EchoWriter(name='None', angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None)[source]¶
Class to write observations to consol
- Parameters
name – name of writer (str)
angle – angle unit to use (str), default GON
dist – distance and coordinate format (str), default 3 decimals
dt – date/time format (str), default ansi
filt – list of allowed keys (list)
File Writer¶
- class filewriter.FileWriter(name='None', angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None, fname=None, mode='a')[source]¶
Class to write observations to file, in the form key=value;key=value,…
- Parameters
name – name of writer (str), default None
angle – angle unit to use (str), default GON
dist – distance and coordinate format (str), default 3 decimals
dt – date/time format (str), default ansi
filt – list of allowed keys (list), default None
fname – name of text file to write to (str), default None (write to stdout)
mode – mode of file open (a or w) (str)
CSV Writer¶
- class csvwriter.CsvWriter(name='None', angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None, fname=None, mode='a', sep=';', header=None)[source]¶
Class to write observations to csv file :param name: name of writer (str), default None :param angle: angle unit to use (str), default GON :param dist: distance and coordinate format (str), default .3f :param dt: date/time format (str), default ansi :param filt: list of keys to output (list), default None :param fname: name of text file to write to (str) :param mode: mode of file open (a or w) (str) :param sep: separator character in file (str) :param header: add header to file if true and mode is ‘w’
Image Writer¶
- class imagewriter.ImageWriter(name, dirName, counter=1, itype='png')[source]¶
write images to single files to a directory, file names are ordinal numbers
- param name
name for writer (str)
- param dirname
output directory name (str)
- param counter
id number for the first image (int), default 0
- param itype
target image type, default png
HTTP Writer¶
- class httpwriter.HttpWriter(name=None, angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None, url='http://localhost/monitoring/get.php', mode='GET')[source]¶
Class to write observations to a web server (HTTP GET/POST)
- Parameters
name – name of writer (str)
angle – angle unit to use (str)
dist – distance and coordinate format (str)
dt – date/time format (str), default ansi
filt – list of allowed keys (list)
url – url to server side script (str)
mode – GET/POST
Geo Writer¶
- class geowriter.GeoWriter(name='None', angle='DMS', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None, fname=None, mode='a')[source]¶
Class to write observations to csv file :param name: name of writer (str), default None :param angle: angle unit to use (str), default GON :param dist: distance and coordinate format (str), default .3f :param dt: date/time format (str), default ansi :param filt: list of keys to output (list), default None (use all) :param fname: name of text file to write to (str) :param mode: mode of file open (a or w) (str)
SqLite Writer¶
Note
OBSOLATE USE dbwriter.py
- class sqlitewriter.SqLiteWriter(db, table, name=None, angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None)[source]¶
Class to write observations/coordinates to a local sqlite database
- Parameters
db – name of database file (str)
table – name of table to write (str)
name – name of writer (str)
angle – angle unit to use (str), DMS not supported
dist – distance and coordinate format (str)
dt – date/time format (str), default ansi
filt – list of allowed keys (list)
Video Writer¶
- class videowriter.VideoWriter(name, fname, codec=None, fps=10, size=(640, 480))[source]¶
write images to video file
- Parameters
name – name for writer
fname – output file name
codec – video compression, default JPEG
fps – frame per sec (int), default 10
size – image size (int, int), default (640, 480)
Queue Writer¶
- class queuewriter.QueueWriter(qu=None, name=None, angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=None)[source]¶
Class to write queue
- Parameters
qu – queue (Queue), default None
name – name of writer (str), default None
angle – angle unit to use (str), default GON
dist – distance and coordinate format (str), default .3f
dt – date/time format (str), dafault ansi
filt – list of keys to output (list), deafult None
SAMPLE APPLICATIONS¶
Measure to Prism¶
- Sample application of Ulyxes PyAPI to measure to a moving prism/object.
Select different modes for different scenarios<br> 0 - determine the horizontal movement of a bridge pylon without prism using edm mode RLSTANDARD<br> 1 - determine the movement of a slowly moving prism to determine 3D defomation<br> 2 - determine vertical movement of a prism, deflection of a bridge, we suppose horizontal distance is not changed (without lock ATR targeting before angles<br> 3 - determine vertical movement of a moving prism, we suppose horizontal distance is not changedi (lock on prism)<br> 4 - determine 3D movement of a moving prism on a car/machine (lock on prism)<br> 5 - measure points if the prism stopped for 3-5 seconds (lock on prism)<br>
- param argv[1] (sensor)
110n/180n/120n, default 1200
- param argv[2] (mode)
0/1/2/3/4/5 without ATR/with ATR/with ATR no distance/lock single distance/lock with distance/store if stopped, default 4
- param argv[3] (edm)
edm mode STANDARD/FAST, default FAST
- param argv[4] (port)
serial port, use a filename for local iface, default COM7
- param argv[5] (file)
output file, data are appended to the end of the file
NMEA Demo¶
Measure matrix¶
- Sample application of Ulyxes PyAPI to measure within a rectangular area
- param argv[1] (int)
number of horizontal intervals (between measurements), default 1 (perimeter only)
- param argv[2] (int)
number of vertical intervals(between measurements), default 1 (perimeter only)
- param argv[3] (sensor)
1100/1800/1200/5500, default 1100
- param argv[4] (port)
serial port, default COM5
- param argv[5]
output file, default stdout
usage: python measurematrix.py 9 3 1100 COM5
Horizontal section¶
Sample application of Ulyxes PyAPI to measure horizontal section(s).
Several parameters can be set from the command line of from a JSON configuration file.
Parameters are stored in a config file using JSON format:
log_file: name of log file
log_level: 10/20/30/40/50
log_format: format string for log file
angle_step: angle step in section
station type: Total station type 1200/1100/5500
station_east: Station east coordinate
station_north: Station north coordinate
station_elev: Station elevation
port: Communication port
hz_start: Horizontal start direction bottom
hz_top: Horizontam start direction top
max_angle: Max angle from start direction at bottom
max_top: Max angle from top direction
tolerance: Height tolerance
iteration: number of iterations to find section
height_list: Elevation list for section
Command line parameters:
-l LOG, --log LOG Logfile name "stdout" for screen output
--level LEVEL Log level
--format FORMAT Log format
--step STEP Angle step in section
--type TYPE Total station type
--east EAST Station east
--north NORTH Station north
--elev ELEV Station elevation
-p PORT, --port PORT Communication port
--start START Horizontal start direction
--top TOP Horizontal start direction at top
--max MAX Max angle
--tmax TMAX Max angle at top
--tol TOL Height tolerance
--iter ITER Max iteration to find section
--heights HEIGHTS list of elevations for more sections
--wrt WRT Output file
- class horizsection.HorizontalSection(ts, wrt, elev=None, hz_start=None, stepinterval=Angle(0.785398), maxa=Angle(0.000000), maxiter=10, tol=0.02)[source]¶
Measure a horizontal section at a given elevation
- Parameters
ts – total station instance
elev – elevation for section
hz_start – start horizontal direction (Angle)
step – horizontal step angle (Angle)
hz_max – end horizontal direction (radians)
maxiter – max iteration to find elevation
tol – tolerance for horizontal angle
levels – more parameters at horizontal cross sections to measure
Section¶
Sample application of Ulyxes PyAPI to measure an arbitrary section target on a point or points to determine a plane and start this app coordinates and observations are written to csv file
- param argv[1] (angle step)
angle step between points in DEG, default 45
- param argv[2] (sensor)
1100/1800/1200, default 1200
- param argv[3] (port)
serial port, default COM7
- param argv[4] (number of points)
number of measured points to determine a arbitrary plane, default 1
- param argv[5] (tolerance)
acceptable tolerance (meter) from the horizontal plane, default 0.01
- param argv[6] (iteration)
max iteration number for a point, default 10
- param argv[7] (range)
max angle (deg), default 360
Filemaker¶
Sample application of Ulyxes PyAPI to create input file for robot Output file uses GeoEasy geo format or simple csv
- param argv[1]
output file with observations
- param argv[2]
(sensor): 1100/1800/1200, default 1200
- param argv[3]
(port): serial port, default COM1
For each target point the point id and a mode must be given Modes:
ATRn - use automatic targeting, n is prism type id (1/2/3/...)
PRn - prism with manual targeting, n is prism type id (1/2/3/...)
RL - reflectorless distance with manual targeting
RLA - automatic reflectorless distance measurement
OR - orientation direction, manual targeting, no distance
Filegen¶
Sample application of Ulyxes PyAPI to create input file for robot Output file uses GeoEasy geo format. The first point in the coordinate list is the station if no station id given.
:param argv[1] input GeoEasy coo or csv coordinate file :param argv[2] output file with observations, geo or dmp file (default stdout) :param argv[3] station id (default first point in input) :param argv[4] instrument height (default 0)
- class filegen.ObsGen(coords, station_id=None, instrument_height=0, faces=1, directfaces=1)[source]¶
Generate observations from coordinates (bearings and zenith angles
- Parameters
ifname – input coordinate file or list of coordinates
station_id – id of the station point, default first point from input
instrument_height – height of instrument, default: 0
faces – default number of faces to measure
Coomaker¶
Sample application of Ulyxes PyAPI to create input coo file for robot/robotplus Output file uses GeoEasy coo
- param argv[1]
output file with observations
- param argv[2] (sensor)
1100/1800/1200/5500, default 1200
- param argv[3] (port)
serial port, default COM1
For each target point the point id and prism constant must be input
Coord plot¶
Blind orientation¶
Get orientation for totalstation. Command line parameters:
argv[1]: input coordinate file
- class blindorientation.Orientation(observations, ts, dist_tol=0.1)[source]¶
find prism and orientation from coordinate list
- Parameters
observations – list of observation
ts – totalstation
dist_tol – distance tolerance, default 0.1 m
Freestation¶
- class freestation.Freestation(obs, coords, gama_path, dimension=3, probability=0.95, stdev_angle=1, stdev_dist=1, stdev_dist1=1.5, blunders=True)[source]¶
Calculate freestation and remove blunders
- Parameters
obs – list of observations
coords – coordinates of points
gama_path – path to gama-local
dimiension – dimension of adjustment 1/2/3, optional default 3
probability – probability level, optional, default 0.95
stdev_angle – angle measurement standard deviation (seconds), optional, default 1”
stdev_dist – distance measurement additive standard deviation (mm), optional, default 1 mm
stdev_dist1 – distance measurement multiplicative standdard deviation (mm/km), optional, default 1.5 mm/km
blunders – remove blunders, optional, default True
Robot¶
Sample application of Ulyxes PyAPI to measure a serie of points. Command line parameters:
argv[1]: input file with directions
argv[2]: output file with observations default stdout
argv[3]: sensor tcra1103/1100/tca1800/1800/tps1201/1200, default 1200
argv[4]: serial port, default COM1
argv[5]: number of retry if target not found, default 3
argv[6]: delay between retries default 0
argv[7]: name of met sensor BMP180/webmet, default None
argv[8]: address of met sensor, i2c addres for BMP180 or internet address of webmet service
argv[9]: parameters for webmet sensor
Input file is a GeoEasy geo file or a dmp (can be created by filemaker.py or filegen.py). Sample geo file:
{2 S2} {3 0.0} # station id & istrumnt h.
{5 2} {7 6.283145} {8 1.120836} {4 PR0} {112 2} # target id, hz, v, code,
{5 T1} {7 2.022707} {8 1.542995} {4 RL} {112 2} # number of faces
{5 3} {7 3.001701} {8 1.611722} {4 OR} {112 2}
{5 T2} {7 3.006678} {8 1.550763} {4 ATR1} {112 2}
{5 4} {7 3.145645} {8 1.610680} {4 PR2} {112 2}
{5 1} {7 6.002123} {8 1.172376} {4 PR} {112 2}
{5 9} {7 6.235123} {8 1.178538} {4 RLA} {112 2}
instead of code=4 you can define prism constant using code=20
prism constant units are meter
Sample dmp file:
station; id; hz; v; code;faces
S2;2;6.283145;1.120836;PR0;2
S2;T1;2.022707;1.542995;RL;2
S2;3;3.001701;1.611722;OR;2
S2;T2;3.006678;1.550763;ATR1;2
S2;4;3.145645;1.610680;PR2;2
S2;1;6.002123;1.172376;PR;2
Codes describe target type:
ATRn - prism and automatic targeting, n referes to prism type 0/1/2/3/4/5/6/7 round/mini/tape/360/user1/user2/user3/360 mini
ATR-n - prims and automatictargeting but wait for a keypress to measure
PRn - prism, n referes to prism type 0/1/2/3/4/5/6/7 round/mini/tape/360/user1/user2/user3/360 mini, manual targeting
RL - refrectorless observation, manual targeting
RLA - reflectorless observation (automatic)
OR - do not measure distance (orientation), manual targeting
In case of PR/RL/OR the program stops and the user have to aim at the target
- class robot.Robot(directions, coordinates, ts, maxtry=3, delaytry=0, dirLimit=0.015, distLimit=0.1)[source]¶
manage robotic observations
- Parameters
directions – observation directions, dictionary
coordinates – station coordinate, dictionary
ts – instrument, totalstation
maxtry – max retry for a point, default 3
delaytry – delay in seconds between retries, default 0
dirLimit – max angle difference [radians], default 0.015 (5’)
distLimit – max slope distance difference [m], default 0.1 m
Robot+¶
Sample application for complex monitoring for a station Different prism constants can be set with code 20/pc in input
Parameters are stored in config file using JSON format:
log_file: path to log file, file must exist!
log_level: 10/20/30/40/50 for DEBUG/INFO/WARNING/ERROR/FATAL
log_format: format string for log (default: "%(asctime)s %(levelname)s:%(message)s"), optional
station_type: 1100/1200/1800
station_id: pont id for the station
station_height: instrument height above point, optional (default: 0)
station_coo_limit: limitation for station coordinate change from free station (default 0.01), optional
orientation_limit: distance limit for orientation to identify a target (default 0.1)
faces: number of faces to measure (first face left for all pointt then face right) (default 1)
face_coo_limit: maximum difference for face left and face right coords (m) (default: 0.01)
face_dir_limit: maximum difference for face left and face right angle (rad) (default 0.0029 60")
face_dist_limit: maximum difference for face left and face right dist (m) (default 0.01)
directfaces: number of faces to measure (face left and right are measured directly) (default 1)
avg_faces: 1/0 calculate average for faces of monitoring points and store only average/do not calculate average store individual faces, default: 1
fix_list: list of fix points to calculate station coordinates, optional (default: empty)
mon_list: list of monitoring points to measure, optional (default: empty)
max_try: maximum trying to measure a point, optional (default: 3)
delay_try: delay between tries, optional (default: 0)
dir_limit: angle limit for false direction in radians (default 0.015. 5')
dist_limit: distance limit for false direction in meters (default 0.1)
port: serial port to use (e.g. COM1 or /dev/ttyS0 or /dev/ttyUSB0)
coo_rd: source to get coordinates from
coo_wr: target to send coordinates to
obs_wr: target to send observations to
met_wr: target to send meteorological observations to, optional (default: no output)
inf_wr: target to send general information to
avg_wr: calculate averages from more faces if value 1, no average calculation if value is zero, optional (default: 1) DEPRICATED average always calculated
decimals: number of decimals in output, optional (default: 4)
gama_path: path to GNU Gama executable, optional (default: empty, no adjustment)
stdev_angle: standard deviation of angle measurement (arc seconds), optional (default: 1)
stdev_dist: additive tag for standard deviation of distance measurement (mm), optional (default: 1)
stdev_dist1: multiplicative tag for standard deviation of distance measurement (mm), optional (default: 1.5)
dimension: dimension of stored points (1D/2D/3D), optional (default: 3)
probability: probability for data snooping, optional (default: 0.95)
blunders: data snooping on/off 1/0, optional (default: 1)
met: met sensor name WEBMET/BMP180/SENSEHAT, optional default None
met_addr: URL to webmet data, optional (default: empty)
met_par: parameters to web met service, optional (default: empty)
- robotplus.avg_coo(coords, face_coo_limit=0.01)[source]¶
Calculate average coordinates
- Parameters
coords – input coordinate list (duplicates)
- Params face_coo_limit
difference limit from average coords (m)
- Returns
average coordinates no duplicates
- robotplus.avg_obs(obs, face_dir_limit=0.0029, face_dist_limit=0.01)[source]¶
Calculate average observations in faces
- Parameters
obs – list of observations dictionaries
- Params face_dir_limit
difference limit from average angles (rad)
- Params face_dist_limit
difference limit from average distance (m)
- Returns
average observations
Coords¶
Coordinate calculation from monitoring observation file
Parameters are stored in config file using JSON format:
log_file: path to log file, file must exist!
log_level: 10/20/30/40/50 for DEBUG/INFO/WARNING/ERROR/FATAL
log_format: format string for log (default: "%(asctime)s %(levelname)s:%(message)s"), optional
station_type: 1100/1200/1800
station_id: pont id for the station
station_height: instrument height above point, optional (default: 0)
station_coo_limit: limitation for station coordinate change from free station (default 0.01), optional
fix_list: list of fix points to calculate station coordinates, optional (default: empty)
mon_list: list of monitoring points to measure, optional (default: empty)
coo_rd: URL or local file to get coordinates from
coo_wr: URL or local file to send coordinates to
obs_wr: URL or local file to send observations to, oprional (default: no output)
obs_wr_sql: SQL select command to execute
strict: 1/0 free station calculated if only all fix points observed in round
mon_only: 1/0 calculate polars if only monitoring point in observations/do not calculate polar
st_only: 1/0 calculate monitoring point only in the same round with freestation
avg_wr: calculate averages from more faces if value 1, no average calculation if value is zero, optional (default: 1) OBSOLATE average always calculated
decimals: number of decimals in output, optional (default: 4)
gama_path: path to GNU Gama executable, optional (default: empty, no adjustment)
stdev_angle: standard deviation of angle measurement (arc seconds), optional (default: 1)
stdev_dist: additive tag for standard deviation of distance measurement (mm), optional (default: 1)
stdev_dist1: multiplicative tag for standard deviation of distance measurement (mm), optional (default: 1.5)
dimension: dimension of stored points (1D/2D/3D), optional (default: 3)
probability: probability for data snooping, optional (default: 0.95)
blunders: data snooping on/off 1/0, optional (default: 1)
Geo to SQLite¶
Sample application to convert robotplus output geo/coo files to sqlite db
- param argv[1]
input geo/coo file
- param argv[2]
output database file (tables have to be created)