1 # tester.tcl --
2 #
3 # Test app to test accuracy of amxd control of cameras
4 #
5 # Copyright (c) 2000-2002 The Regents of the University of California.
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
10 #
11 # A. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
13 # B. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 # C. Neither the names of the copyright holders nor the names of its
17 # contributors may be used to endorse or promote products derived from this
18 # software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31 import Application DpClient
32
33 Class TesterApp -superclass {Application}
34
35 TesterApp instproc init {} {
36 $self instvar amx_
37
38 set amx_ [new DpClient htsr.bmrc.berkeley.edu 6901]
39
40 $self initUI
41
42 puts stdout "returned from initUI"
43 }
44
45 TesterApp instproc initUI {} {
46 $self instvar amx_
47
48 puts stdout "in initUI"
49
50 wm title . "tester"
51
52 # make camera controls
53 frame .top -borderwidth 3
54
55 button .top.leftPush -text "Left - Push" -command "$amx_ do camera_startMove speaker left"
56 button .top.leftRelease -text "Left - Release" -command "$amx_ do camera_stopMove speaker left"
57 button .top.rightPush -text "Right - Push" -command "$amx_ do camera_startMove speaker right"
58 button .top.rightRelease -text "Right - Release" -command "$amx_ do camera_stopMove speaker right"
59 button .top.center -text "Center" -command "$amx_ do camera_center speaker"
60
61 pack .top -side top
62
63 # buttons
64 pack .top.leftPush -side left
65 pack .top.leftRelease -side left
66 pack .top.center -side left
67 pack .top.rightPush -side right
68 pack .top.rightRelease -side right
69
70 # scale entry
71 $self instvar test_bar_
72 button .testLeft -text "test" -command "$self do_test left"
73 button .testRight -text "test" -command "$self do_test right"
74 pack .testLeft -side top -side left
75 pack .testRight -side top -side left
76 set test_bar_ [scale .scale -from 0 -to 255 -length 256 -variable x -orient horizontal -label "Send camera command:" -showvalue true]
77 pack .scale
78
79
80 # exit button
81 button .exit -text "Exit" -command exit
82 pack .exit -side bottom
83
84 button .get -text "Get" -command "$self print_amx"
85 pack .get -side bottom
86 }
87
88 TesterApp public print_amx {} {
89 $self instvar amx_
90
91 set retval [$amx_ do receive-AMX-command]
92 puts stdout $retval
93 }
94
95 TesterApp public do_test { dir } {
96 $self instvar amx_ test_bar_
97
98
99 set val [$test_bar_ get]
100 set val [expr $val * 10]
101 puts stdout "val is $val"
102 $amx_ do test_func speaker $dir $val
103 }
104
105 set app [new TesterApp]
106
107 vwait forever
108
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.