The following VM has been coded for haspp02ch1a. This way, cx of a slit can be used as the outer loop motor of 2D scans.
Before the virtual motor can be used, the following
command has to be entered: ONLINE> def vm1.
#!/usr/bin/perl -w
#
# file name: /online_dir/vm1.pl
#
# This script is a template for a virtual motor.
#
my ($method, $value_new) = @ARGV;
my $cx = Motor->locate( name => "slit( slt3, cx)");
my $status = 1;
if( $method eq "set_position")
{
$status = $cx->set( position => $value_new);
}
elsif( $method eq "get_position")
{
$SYM{RETURN_VALUE} = $cx->get( "position")
}
elsif( $method eq "get_limit_min")
{
$SYM{RETURN_VALUE} = $cx->get( "unit_limit_min")
}
elsif( $method eq "get_limit_max")
{
$SYM{RETURN_VALUE} = $cx->get( "unit_limit_max")
}
elsif( $method eq "exec_stop")
{
Util::log( "vm1: method exec-stop");
}
else
{
Spectra::error( "vm1: failed to identify $method");
$status = 0;
goto finish;
}
finish:
$status;