#!/usr/bin/perl -w # use strict; my $status = 1; # # the outer loop motor and its positions # my $mot_2d = "mot27"; # my @pos_2d = qw( 10 20 30); my @pos_2d = map {$_ = $_*0.1 + 0.3} ( 0 .. 2); # my $mot_3d = "mot29"; my @pos_3d = map {$_ = $_*0.2 - 2.} ( 0 .. 2); # # # my $start = -2; my $stop = -1.9; my $st = 0.1; # sample time my $bl = Spectra::get_motor_unit_backlash( "mot30"); Util::log( "mot30, set backlash to 0, was $bl"); Spectra::set_motor_unit_backlash( "mot30", 0.); foreach my $pos_3d ( @pos_3d) { if( !Spectra::move( $mot_3d => $pos_3d)) { $status = Spectra::error( "failed to move $mot_3d"); goto finish; } foreach my $pos_2d ( @pos_2d) { if( !Spectra::move( $mot_2d => $pos_2d)) { $status = Spectra::error( "failed to move $mot_2d"); goto finish; } # # inner loop: mot30 # Util::log( "execute a mot30 scan, from $start to $stop "); if( !Spectra::scan( type => "motor", device => "mot30", start => $start, stop => $stop, delta => 0.01, # step width st => $st, # sample time comment => "$mot_2d at $pos_2d, $mot_3d at $pos_3d") ) { $status = Spectra::error( " Failed to scan "); goto finish; } # # this statement reverses the scan direction ( $start, $stop) = ( $stop, $start); } } finish: Util::log( "mot30, set backlash to $bl"); Spectra::set_motor_unit_backlash( "mot30", $bl); $status;