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)

GetAngle(out='RAD')[source]

Get angle value in different units

Parameters:

out – output unit (str RAD/DMS/DEG/GON/NMEA/PDEG/SEC/MIL)

Returns:

value (float or string)

Normalize()[source]

Normalize angle between 0-360 DEG

Positive()[source]

Change stored value to positive

SetAngle(value, unit='RAD')[source]

Set or change value of angle.

Parameters:
  • value – new value for angle (str or float)

  • unit – unit for the new value (str)

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

ClearState()[source]

Clear the state of the reader being used.

Filt(rec)[source]

check all filter fields are in record

Parameters:

rec – record to check to self.filt

Returns:

Tue/False keep/drop record

GetName()[source]

Get the name of the interface being used.

GetNext()[source]

Dummy function implemented in descendant objects

GetState()[source]

Get the state of the interface being used.

Load()[source]

Load all records into a list

Returns:

list of data units/lines

Rewind()[source]

Dummy function implemented in descendant objects

File Reader

class filereader.FileReader(name=None, fname=None, filt=None)[source]

Class to read file

Parameters:
  • name – name of reader (str), default None

  • fname – name of input file

  • filt – obligatory fields for Load

GetLine()[source]

Get next line from file

Returns:

next line from file or None in case of EOF

GetNext()[source]

Get next line from file

Rewind()[source]

Rewind file to start

classmethod extend_names(name_list)[source]

extend wildcard characters from the command line on windows and remove non-existent files from list

Csv Reader

class csvreader.CsvReader(name=None, fname=None, separator=';', filt=None, fields=None, numeric=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

GetNext()[source]

Get fields in dictionary from next line

Geo Reader

class georeader.GeoReader(name=None, fname=None, filt=None)[source]

Class to read GeoEasy geo and coo files

Parameters:
  • name – name of reader (str), default None

  • fname – name of input file

  • filt – obligatory list of GeoEasy field code for Load

GetNext()[source]

Get fields in dictionary from next line considering filter

Returns:

values in dict, empty dict on EOF

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

GetNext()[source]

Get next line from url

Returns:

dictionay with values

JSON Reader

class jsonreader.JSONReader(name=None, fname=None)[source]

Class to read file

Parameters:
  • name – name of reader (str), default None

  • fname – name of input file

GetLine()[source]

Not available for JSON

Load()[source]

Load full JSON file

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)

Check()[source]

Validate config values and send warning/error to log

Returns:

OK/WARNING/FATAL, msg_lst

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)

GetNext()[source]

Get next line from cursor

Returns:

dictionary with values

Queue Reader

class queuereader.QueueReader(qu=None, name=None, filt=None)[source]

Class to read queue

Parameters:
  • qu – queue (Queue), default None and queue is created

  • name – name of reader (str), default None

  • filt – list of keys to output (list), deafult None

GetLine()[source]

Get next item from queue :returns: next item from queu or none if queue is empty

GetNext()[source]

Get next item from queue :returns: next

GetQueue()[source]

method to get queue :returns: queue

INTERFACES

Interfaces handle the connection to the physical sensors.

Generic Iface

class iface.Iface(name=None)[source]

Base class for different interfaces

Parameters:

name – name of the interface (str) (default None)

ClearState()[source]

Clear the state of the interface being used.

GetName()[source]

Get the name of the interface being used.

GetState()[source]

Get the state of the interface being used.

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)

GetLine()[source]

Return next line from sequental file

Returns:

next line from the file

Send(msg)[source]

Return answer from the file instead of instrument

Parameters:

msg – message to send

Returns:

message specific answer

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’

Close()[source]

Close serial line

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

Open(port, baud=9600, byteSize=8, parity='N', stop=1, timeout=12)[source]

Open searial line

PutLine(msg)[source]

send message through the serial line

Parameters:

msg – message to send (str)

Returns:

0 - on OK, -1 on error or interface is in error state

Send(msg)[source]

send message to serial line and read answer

Parameters:

msg – message to send, it can be multipart message separated by ‘|’ (str)

Returns:

answer from instrument (str)

Bluetoth Iface

Video Iface

class videoiface.VideoIface(name='webcam', source=0)[source]

Read from video stream or video file. This class depends on OpenCV.

Parameters:
  • name – name of interface (str), default ‘webcam’

  • source – id of device or file name (int/str), default = 0

GetImage()[source]

Get image from stream

Returns:

an image or None

I2C Iface

WEB Iface

class webiface.WebIface(name, url, fmt, timeout=15)[source]

Class for communicating web page using HTTP GET and json/txt output.

Parameters:
  • name – name of interface (str)

  • url – address to read from (str)

Send(msg)[source]

send message to web

Parameters:

msg – parameters to url

Returns:

downloaded data

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

remove_last_observation(st=False)[source]

remove last observation or station data

Parameters:

st – False remove single observation, True remove station (Bool)

remove_observation(fr, to)[source]

Remove a polar observation TODO it erases hz, v and distance TODO it removes first occurance

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

Close()[source]

Close TCP socket

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

Open(address, bufSize=1024, timeout=15)[source]

Open TCP socket

PutLine(msg)[source]

send message through the TCP socket

Parameters:

msg – message to send (str)

Returns:

0 - on OK, -1 on error or interface is in error state

Send(msg)[source]

send message to TCP socket and read answer

Parameters:

msg – message to send, it can be multipart message separated by ‘|’ (str)

Returns:

answer from server (str)

MEASURE UNITS

Measure units are responsible for the specific instrument features.

Generic Measure Unit

class measureunit.MeasureUnit(name=None, typ=None)[source]

Virtual base clase for measure units

Parameters:
  • name – name of measure unit (str), default None

  • typ – type of measure unit (str), default None

GetName()[source]

Get name of measure unit

Returns:

name of measure unit

GetType()[source]

Get type of measure unit

Returns:

type of measure unit

Result(msgs, anss)[source]

Dummy function it must be implemented in inherited classes

Parameters:
  • msgs – messages sent to instrument

  • anss – answers got from instrument

Returns:

None

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’

ChangeFaceMsg()[source]

Change face

Returns:

change face message

ClearDistanceMsg()[source]

Clearing distance

Returns:

clear distance message

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

GetATRMsg()[source]

Get ATR status

Returns:

get atr message

GetAnglesMsg()[source]

Get angles

Returns:

get angles 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

GetEDMModeMsg()[source]

Get EDM mode

Returns:

get edm mode message

GetInstrumentNameMsg()[source]

Get instrument name

Returns:

get instrument name

GetInstrumentNoMsg()[source]

Get instrument factory number

Returns:

get instrument factory number message

GetInternalTemperatureMsg()[source]

Get instrument internal temperature

Returns:

instrument internal temperature

GetLockMsg()[source]

Get Lock status

Returns:

get lock status message

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

GetPcMsg()[source]

Get prism constant

Returns:

get prism constant 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

GetSpiralMsg()[source]

Get search spiral parameters

Returns:

get spiral message

GetStationMsg()[source]

Get station coordinates

Returns:

get station coordinates message

LockInMsg()[source]

Activate lock

Returns:

active lock 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

SearchTargetMsg()[source]

Search target using user spiral

Returns:

Search target message

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

SetStationMsg(e, n, z, ih=0.0)[source]

Set station coordinates

Parameters:
  • e – easting

  • n – northing

  • z – elevation

  • ih – instrument height (optional, default 0)

Returns:

set station coordinates message

SwitchOffMsg()[source]

Switch off instrument

SwitchOnMsg(mode=1)[source]

Switch on instrument or wake up and change to remote mode

Parameters:

mode – startup mode 0/1 local/remote

Returns:

switch on message

Leica TCA 1800 Unit

class leicatca1800.LeicaTCA1800(name='Leica TCA1800', typ='TPS')[source]

This class contains the Leica TCA1800 robotic total station specific functions

param name:

name of ts (str), default=TCA1800

param type:

type od ts (str), default=TPS

static GetCapabilities()[source]

Get instrument specialities

Returns:

List of specialities

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

static GetCapabilities()[source]

Get instrument specialities

Returns:

List of specialities

PowerSearchMsg(direction)[source]

Power search

Parameters:

direction – 1/-1 clockwise/counter clockwise

Returns:

Power search message

SetRedLaserMsg(on)[source]

Set red laser on/off

Parameters:

on – 0/1 turn off/on read laser

Returns:

red laser on/off message

SetSearchAreaMsg(hzCenter, vCenter, hzRange, vRange, on=1)[source]

set search area for power search

Parameters:
  • hzCenter – center direction (Angle)

  • vCenter – center direction (Angle)

  • hzRange – horizontal range to search (Angle)

  • vRange – vertical range to search (Angle)

  • on – 0/1 off/on

Leica TCRA 1100 Unit

class leicatcra1100.LeicaTCRA1100(name='Leica TCRA1100', typ='TPS')[source]

This class contains the Leica TCRA1100 robotic total station specific functions

param name:

name of ts (str), default=TCRA1100

param type:

type od ts (str), default=TPS

static GetCapabilities()[source]

Get instrument specialities

Returns:

List of specialities

SetRedLaserMsg(on)[source]

Set red laser on/off

Parameters:

on – 0/1 turn off/on read laser

Returns:

red laser on/off message

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’

ChangeFaceMsg()[source]

Change face

Returns:

None

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

GetAnglesMsg()[source]

Get angles

Returns:

get angles message

GetAtmCorrMsg()[source]

Get atmospheric correction settings

Returns:

atmospheric correction message

static GetCapabilities()[source]

Get instrument specialities

Returns:

empty list, do not use generic instrument

GetEDMModeMsg()[source]

Get EDM mode

Returns:

None

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

GetPcMsg()[source]

Get prism constant

Returns:

get prism constant message

GetRefCorrMsg()[source]

Get refraction correction setting

Returns:

refraction correction message

GetStationMsg()[source]

Get station co-ordinates

Returns:

get station coordinates 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

SetRefCorrMsg(status, earthRadius, refrac)[source]

Set refraction correction settings

Parameters:
  • status – not used

  • earthRadius – radius ot the Earth (int)

  • refrac – refraction (float)

Returns:

set refraction correction message

SetStationMsg(e, n, z=None, ih=0)[source]

Set station coordinates

Parameters:
  • e – easting

  • n – northing

  • z – elevation

  • ih – instrument height

Returns:

set station coordinates 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’

GetAutoOffMsg()[source]

Get auto off message

Returns:

get auto off message

static GetCapabilities()[source]

Get instrument specialities

Returns:

List of specialities

MeasureMsg()[source]

Start measure message

Returns:

measure message

Result(msg, ans)[source]

process result of a measurement

Parameters:
  • msg – message sent

  • ans – answer to message

Returns:

observation results (dictionary)

SetAutoOffMsg(par)[source]

Set auto off message

Parameters:

par – 0/1/2 Off/On/Sleep mode

Returns:

auto off message

TemperatureMsg()[source]

Get temperature message

Returns:

temperature message

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

static GetCapabilities()[source]

Get instrument specific functions

Returns:

list of capabilities

MeasureMsg()[source]

NMEA sentence type for lat,lon

Returns:

accepted messages

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

static NmeaDateTime(msg)[source]

get date/time from ZDA message

Parameters:

msg – NMEA ZDA sentence

Returns:

dete/time or None

Result(msgs, ans)[source]

process the answer from GNSS

Parameters:
  • msgs – MNEA messages to get (list), None means to use filter

  • ans – NMEA message from GNSS unit

Returns:

processed message or None if msg and ans do not match

Video Unit

class videomeasureunit.VideoMeasureUnit(name='webcam', typ='video')[source]

Video device specific features.

Parameters:
  • name – name of measure unit (str), default ‘webcam’

  • typ – type of measure unit (str), default ‘video’

static GetCapabilities()[source]

Get instrument specialities

Returns:

list of capabilities

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

GetPressureMsg()[source]

Read pressure message

:returns read pressure message

GetTempMsg()[source]

Read temperature message

Returns:

read temperature message

LoadCalibrationMsg()[source]

Load calibration data from sensor message

Returns:

load calibration data message

Result(msg, ans)[source]

Dummy function it must be implemented in inherited classes

Parameters:
  • msgs – messages sent to instrument

  • anss – answers got from instrument

Returns:

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

GetAccelMsg()[source]

Read accelerometer message

Returns:

read accel message (tuple)

GetGyroMsg()[source]

Read gyroscope message

Returns:

read gyro message (tuple)

GetMagMsg()[source]

Read magnetometer message

Returns:

read mag message (tuple)

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

Result(msg, ans, part='gyro')[source]

Process answer got from sensor

Parameters:
  • msg – message sent to device

  • ans – answer got from device

  • part – gyro/accel answer from gyro or accel

Returns:

processed values in dict

WhoAmIMsg()[source]

get who am i reg

Parameters:

reg – addres of who am i register

Returns:

content of who am i register

Wifi Unit

class wifiunit.WifiUnit(name='wlan', typ='wifi', wlan='wlan0')[source]

Collect wifi information

Parameters:
  • name – name of nmea unit (str), default ‘Nmea Gnss’

  • typ – type of nmea unit (str), default None

  • wlan – wifi interface, default wlan0

static GetCapabilities()[source]

Get instrument specific functions

Returns:

list of capabilities

Web Met Unit

class webmetmeasureunit.WebMetMeasureUnit(name=None, typ='met sensor', msg=None)[source]

Web meteorological sensor

Parameters:
  • name – name of measure unit (str), default None

  • typ – type of measure unit (str), default None

GetPressureMsg()[source]

Read pressure message

:returns read pressure message

GetTempMsg()[source]

Read temperature message

Returns:

read temperature message

Result(msg, ans)[source]

Dummy function it must be implemented in inherited classes

Parameters:
  • msgs – messages sent to instrument

  • anss – answers got from instrument

Returns:

None

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

GetContrastMsg(mask)[source]

Get contrast of picture (beta)

Parameters:

mask – picture mask

Returns:

contrast

StartCameraViewMsg()[source]

Start camera preview

Returns:

empty dictionary

StopCameraViewMsg()[source]

Stop camera preview

Returns:

empty dictionary

TakePhotoMsg(pic, resolution=(720, 480))[source]

Take photo

Parameters:
  • pic – writable binary file

  • resolution – resolution of picture (tuple)

Returns:

dictionary contain picture in binary file

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

GetIface()[source]

Get the measure interface

Returns:

reference to interface

GetMeasureUnit()[source]

Get the measure unit

Returns:

reference to measure unit

GetName()[source]

Get the name of the Instrument

Returns:

instrument name

GetWriterUnit()[source]

Get the writer unit

Returns:

reference to writer unit

Totalstation

class totalstation.TotalStation(name, measureUnit, measureIface, writerUnit=None)[source]

Generic total station instrument :param name: name of instrument :param measureUnit: measure unit part of instrument :param measureIface: interface to physical unit :param writerUnit: store data, default None

ChangeFace()[source]

Change face

Returns:

empty dictionary

ClearDistance()[source]

Clear measured distance on instrument

Coords(wait=15000, incl=0)[source]

Read coordinates from instrument

Parameters:
  • wait – waiting time ms

  • incl – inclination

Returns:

coordinates in a dictionary

GetATR()[source]

Get ATR status of instrument

Returns:

0/1 ATR off/on

GetAngles()[source]

Get angles from instrument

Returns:

angles in a dictionary

GetAtmCorr()[source]

Get atmospheric correction

Returns:

atmospheric corrections (dictionary)

GetEDMMode()[source]

Get EDM mode

Returns:

actual EDM mode

GetFace()[source]

Get face left or face right

Returns:

0/1 face left/face right in a dictionary or None in case of error

GetInstrumentName()[source]

Get instrument name

Returns:

processed answer from instrument

GetInstrumentNo()[source]

Get instrument factory number

Returns:

processed answer from instrument

GetInternalTemperature()[source]

Get instrument internal temperature

Returns:

processed answer from instrument

GetLock()[source]

Get lock status

Returns:

lock status of the instrument 0/1 on/off

GetMeasure(wait=15000, incl=0)[source]

Get measured values

Parameters:
  • wait – waiting time in ms

  • inc – inclination …

Returns:

observations in a dictionary

GetPc()[source]

Get prism constant

Returns:

processed answer from instrument

GetPrismType()[source]

Get prism type

GetRefCorr()[source]

Get refraction correction

Returns:

refraction correction (dictionary)

GetSpiral()[source]

Get search spiral parameters

Returns:

horizontal and vertical range

GetStation()[source]

Get station coordinates

Returns:

station coordinates and instrument height (dictionary)

LockIn()[source]

Turn on lock

Returns:

empty

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

SearchTarget()[source]

Search target

Returns:

TODO

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

SetPrismType(typ)[source]

Set prism type :param typ: prizm type

SetRCS(rcs)[source]

Remote control

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:

???

SwitchOff()[source]

Switch off instrument

Parameters:

mode – 0/1 power down/sleep state

Returns:

processed answer from instrument

SwitchOn(mode=1)[source]

Switch on or wake up instrument and change to remote control

Parameters:

mode – 0/1 local/remote mode

Returns:

empty list if successful, timeout may occure

GNSS

class gnss.Gnss(name, measureUnit, measureIface, writerUnit=None)[source]

GNSS receiver sending NMEA messages

Parameters:
  • name – name of gnss instrument

  • measureUnit – reference to measure unit

  • measureIface – reference to measure interface

Measure()[source]

Get position from nmea stream

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

GetAutoOff()[source]

Query auto off state

Returns:

auto off state

Measure()[source]

Start reading on staff

SetAutoOff(par)[source]

set automatic turning off to on/off

Parameters:

par – 1/0 on/off

Returns:

empty dictionary

Temperature()[source]

Get temperature

Returns:

internal temperature

Web Camera

class webcam.WebCam(name, measureUnit, measureIface, writerUnit=None)[source]

WebCam or video device

Parameters:
  • name – name of instrument

  • measureUnit – measure unit part of instrument

  • measureIface – interface to measure unit

  • writerUnit – store data, default None

GetImage()[source]

Get next image from stream

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

GetHumi()[source]

Get humidity from sensor

Returns:

None (no humidity available)

GetPressure(withTemp=1)[source]

Get pressure in hecto Pascals (hPa) from sensor

Parameters:

withTemp – measure temperature also for fresh correction value (B5 stored in measure unit)

Returns:

pressure in Pascals

GetTemp()[source]

Get temperature from sensor

Returns:

temperature in centigrades

LoadCalibration()[source]

read calibration data from sensor

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

GetAccel()[source]

get accelerometer data

Returns:

3 axis accel data

GetGyro()[source]

get gyro data

Returns:

3 axis gyro data

GetMag()[source]

get magnetometer data

Returns:

3 axis magneto data

Init(a_sc=0, a_odr=1, m_sc=0, m_odr=0, g_sc=0, g_odr=0)[source]

initialize sensors: accelometer/magnetometer and gyroscope

WiFi Collector

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

GetAltitude()[source]

calculate altitude from sealevel pressure

Returns:

altitude

GetHumi()[source]

Get humidity from sensor

Returns:

temperature data as dict

GetPressure(withTemp=0)[source]

Get pressure in HPa from sensor

Parameters:

withTemp – dummy parameter for inherited classes

Returns:

temperature data as dict

GetTemp()[source]

Get temperature from sensor

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

SetSealevel(altitude, pressure=None)[source]

calculate sealevel pressure from known elevation and pressure

Parameters:
  • altitude – known elevation (float) meters

  • pressure – know pressure at elevation, default None means get the pressure from sensor

Camera

class camera.Camera(name, measureUnit, measureIface=None, writerUnit=None)[source]

Class for handle different camera unit

Parameters:
  • name – name of instrument

  • measureUnit – measure unit part of instrument

  • measureIface – interface to physical unit

  • writerUnit – store data, default None

GetContrast(mask=None)[source]

take picture and get contarst

Returns:

contrast of taken picture

StartCameraView()[source]

Start Camera View method

StopCameraView()[source]

Stop Camera View method

TakePhoto(pic, resolution=(480, 720))[source]

taking photo method

Parameters:
  • pic – name of image file

  • resolution – resolution of picture (tuple)

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

FollowTarget()[source]

Following target (beta)

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.

LoadAffinParams(file)[source]

Load affin params to measure on pictures

Parameters:

file – name of the params file (It have to be .npy file)

PicMes(photoName, targetType=None)[source]

Measure angles between the target and the optical axis :param photoName: name of the photo :param targetType: type of the target :returns: horizontal (hz) and vertical (v) correction angle in dictionary

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, pid=0)[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

ClearState()[source]

Clear the state of the writer being used.

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

ExtendData(data)[source]

Add datetime and id to data if neccessary

Parameters:

data – data to extend (dict)

Returns:

extended data (dict)

GetName()[source]

Get the name of the interface being used.

Returns:

name of writer

GetState()[source]

Get the state of the interface being used.

Returns:

state of writer

StrVal(val)[source]

Get string representation of value

Parameters:

val – value to convert to string

Returns:

value in string format

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', pid=0)[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)

WriteData(data)[source]

Write observation data to file

Parameters:

data – dictionary with observation data

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, pid=0)[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’

WriteData(data)[source]

Write observation data to csv file

Parameters:

data – dictionary with observation data

Returns:

0/-1/-2 OK/write error/empty not written

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

WriteData(data, convert=None)[source]

write image to file

Parameters:
  • data – image to write

  • convert – conversion before write e.g. convert=’gray’

Returns:

name of image file

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

WriteData(data)[source]

Write observation data to server

Parameters:

data – dictionary with observation data

Returns:

server answer or negative error code

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)

WriteData(data)[source]

Write observation data to csv file

Parameters:

data – dictionary with observation data

Returns:

non zero if error

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)

WriteData(data)[source]

Write observation data to db

Parameters:

data – dictionary with observation data

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)

WriteData(data)[source]

write image to video file

Parameters:

data – image to write

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

GetQueue()[source]

method to get queue :returns: queue

WriteData(data)[source]

Write observation data to queue :param data: dictonary with observation data :returns: 0/-1/-2 OK/write error/empty not written

SAMPLE APPLICATIONS

Measure to Prism

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/axis10, default 1100

param argv[4] (port):

serial port, default /dev/ttyUSB0

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 or 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
--pid ID              Start of point IDs, default 0
class horizsection.HorizontalSection(ts, wrt, st_east=None, st_north=None, hoc=None, 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

  • wrt – result writer

  • hoc – height of collimation

  • 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

  • pid – start point id

Coords(measure)[source]

calculate target coordinates

Parameters:

measure – disctionary of observations

Returns:

dictionary of coords

invalid(ans)[source]

check observation results are complete use after GetMeasure

Parameters:

ans – result of GetMeasure call

:returns True/False invalid/valid

run()[source]

do the observations in horizontal section

horizsection.cmd_params()[source]

process command line parameters parameters can be given by switches or in a json file

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

run()[source]

generate observation list

Returns:

list of observation dicts ordered by hz

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

coomaker.GetFloat(prompt, default=0.0, errstr='Invalid value!')[source]

read a float value with error control & default :param prompt: message to write out to the user :param default: default value :param errstr: error message if input not float :returns: value entered or none

coomaker.GetInt(prompt, default=0.0, errstr='Invalid value!')[source]

read an int value with error control & default :param prompt: message to write out to the user :param default: default value :param errstr: error message if input not float :returns: value entered or none

Coord plot

Blind orientation

Get orientation for totalstation. Command line parameters:

argv[1]: input coordinate file
argv[2]: station name
argv[3]: instrument height, default 0.00
argv[4]: total station type, default 1200
argv[5]: port, default /dev/ttyUSB0
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

FindPoint(obs)[source]

Find point from observation (distance and zenith) compering slope distances and heigth differences

Parameters:

obs – observation data

Returns:

bearing to actual instrument direction

Search()[source]

Search for a prism

Returns:

dictionary on error with errorCode

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

Adjustment()[source]

adjustment & and blunder removing

Returns:

adjusted coordinates or None

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

polar(obs)[source]

calculate coordinates for target

Parameters:

obs – observed angles and distance

Returns:

(east, north, elev)

run()[source]

run an observation serie

Returns:

(obs_out, coo_out)

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
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

robotplus.get_mu(t)[source]

Select measure unit

Parameters:

t – instrument type 1200/1800/1100/local

Returns:

measure unit or False

Coords

Coordinate calculation from monitoring observation file

Parameters are stored in config file using JSON format:

log_file: path to log file
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)