Overview | Index by: file name | procedure name | procedure call | annotation

measureToPrism.tcl  (annotations | original source)

# !/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

#//#
#	This program measures a slowly moving prism (with ATR) or 
#	any target at the same direction (without ATR)
#	and writes the time and the measured values to standard output.
#	Oriented total station is supposed.
#
#	@param atr 0/1/2/3 measure without/with ATR/with ATR but no distance meas/lock single distance measurement  (default 1)
#	@param com name of RS-232 parameter file, optional (default leica.com)
#	@param debuglevel 0/1/2 for debugging, optional (default 0)
#	
#	<p>Ulyses - an open source project to drive total stations and
#			publish observation results</p>
#	<p>GPL v2.0 license</p>
#	<p>Copyright (C) 2010-2012 Zoltan Siki <siki@agt.bme.hu></p>
#	@author Daniel Moka
#	@version 1.1
#//#

source global.tcl
source common.tcl
source leica.tcl

global argv argc

# Adding parameter  0/1 =  measuring without distance(only angles) / measuring angles and distances too
set dist 1
if {$argc > 0} { set dist [lindex $argv 0] }

# Adding the 2nd parameter
set com "leica.com"
if {$argc > 1} {set com [lindex $argv 1]}

set debuglevel 0
if {$argc > 2} { set debuglevel [lindex $argv 2] }

# Open and set communication port
if {[::OpenCom $com]} {
	puts "Error opening communication port"
	exit 1
}
if {$dist} {
	::SetEDMMode 0		;# standard distance measurement
	::SetLock 0
	::SetATR 1
	::MoveRel 0 0 "RAD" 1	;# target on prism with ATR
	set res [::Measure]
	if {$dist == 3} {
		::SetLock 1	;# lock on target
		set systemTime [clock seconds]  ;# set current time
#		set res [Measure]	;# initial distance measurement
		if {[llength $res] > 2} {
			puts "[::GetVal 7 $res] [::GetVal 8 $res] [::GetVal 9 $res] [clock format $systemTime -format %H:%M:%S]"
		} else {
			puts "*** $res [clock format $systemTime -format %H:%M:%S]"
		}
	}
} else {
	::SetATR 0
	::SetEDMMode 5
}

while {1} {
	set systemTime [clock seconds]  ;# set current time
	switch -exact $dist {
		0 {
#			set res [GetAngles]	;# get angles only
			set res [::Measure]	;# distance measurement
		}
		1 {
			::MoveRel 0 0 "RAD" 1	;# aim on target with ATR
			set res [::Measure]	;# distance measurement
		}
		2 {
			::MoveRel 0 0 "RAD" 1	;# aim on target with ATR
			set res [::GetAngles]	;# get angles only
		}
		3 {
			set res [::GetAngles]	;# get angles only
		}
	}
	# write data to standard output
	if {[llength $res] >= 2} {
		puts "[::DMS [::GetVal 7 $res]] [::DMS [::GetVal 8 $res]] [::GetVal 9 $res] [clock format $systemTime -format %H:%M:%S]"
	} else {
		puts "*** $res [clock format $systemTime -format %H:%M:%S]"
	}
}

file name | procedure name | procedure call | annotation
File generated 2014-04-15 at 20:21.