1 # camapp.tcl --
2 #
3 # Test app for controlling cameras using vcc3d and amxd
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 enable
32
33 import Application 405Client
34
35 Class CameraApp -superclass Application
36
37 CameraApp instproc init {argv} {
38 $self instvar 405_
39
40 $self next $argv
41 set 405_ [new 405Client]
42 $self init_ui
43 }
44
45 CameraApp instproc init_ui {} {
46 global g_camSelect
47 $self instvar 405_
48
49 wm title . "Camera Control"
50
51 frame .select_frame
52 pack .select_frame -fill x -side top
53
54 radiobutton .select_frame.speakerBut -text "Speaker" -variable g_camSelect -value "speaker"
55 pack .select_frame.speakerBut -side top
56
57 radiobutton .select_frame.audienceBut -text "Audience" -variable g_camSelect -value "audience"
58 pack .select_frame.audienceBut -side top
59
60 set g_camSelect "speaker"
61
62 # controls for moving the camera
63 frame .controls_frame
64
65 pack .controls_frame -side top
66
67 frame .controls_frame.top -borderwidth 3
68 frame .controls_frame.middle -borderwidth 3
69 frame .controls_frame.bottom -borderwidth 3
70 frame .controls_frame.bottom2 -borderwidth 3
71
72 button .controls_frame.top.up -text " Up " -command "$self move_camera up 1"
73 button .controls_frame.middle.left -text "Left" -command "$self move_camera left 1"
74 button .controls_frame.middle.center -text "Center" -width 4 -command "$self center_camera"
75 button .controls_frame.middle.right -text "Right" -command "$self move_camera right 1"
76 button .controls_frame.bottom.down -text "Down" -command "$self move_camera down 1"
77 button .controls_frame.bottom2.in -text "In" -width 3 -command "$self move_camera in 1"
78 button .controls_frame.bottom2.out -text "Out" -width 3 -command "$self move_camera out 1"
79
80 pack .controls_frame.top -side top -fill x
81 pack .controls_frame.top.up -side top
82
83 pack .controls_frame.middle -side top
84 pack .controls_frame.middle.left -side left
85 pack .controls_frame.middle.center -side left
86 pack .controls_frame.middle.right -side right
87
88 pack .controls_frame.bottom -side top
89 pack .controls_frame.bottom.down -side top
90
91 pack .controls_frame.bottom2 -side top
92 pack .controls_frame.bottom2.in -side left -ipadx 2
93 pack .controls_frame.bottom2.out -side right -ipadx 2
94
95 #####
96
97 # controls for moving the camera
98 set cur_frame .controls_frame2
99 frame $cur_frame
100 pack $cur_frame -side top
101
102 frame $cur_frame.top -borderwidth 3
103 frame $cur_frame.middle -borderwidth 3
104 frame $cur_frame.bottom -borderwidth 3
105 frame $cur_frame.bottom2 -borderwidth 3
106
107 button $cur_frame.top.up -text " Up "
108 bind $cur_frame.top.up <Button-1> "$self start_move up"
109 bind $cur_frame.top.up <ButtonRelease-1> "$self stop_move"
110
111 button $cur_frame.middle.left -text "Left"
112 bind $cur_frame.middle.left <Button-1> "$self start_move left"
113 bind $cur_frame.middle.left <ButtonRelease-1> "$self stop_move"
114
115 button $cur_frame.middle.center -text "Home" -width 4 -command "$self center_camera"
116
117 button $cur_frame.middle.right -text "Right"
118 bind $cur_frame.middle.right <Button-1> "$self start_move right"
119 bind $cur_frame.middle.right <ButtonRelease-1> "$self stop_move"
120
121 button $cur_frame.bottom.down -text "Down"
122 bind $cur_frame.bottom.down <Button-1> "$self start_move down"
123 bind $cur_frame.bottom.down <ButtonRelease-1> "$self stop_move"
124
125 button $cur_frame.bottom2.in -text "In" -width 3
126 bind $cur_frame.bottom2.in <Button-1> "$self start_move in"
127 bind $cur_frame.bottom2.in <ButtonRelease-1> "$self stop_move"
128 button $cur_frame.bottom2.out -text "Out" -width 3
129 bind $cur_frame.bottom2.out <Button-1> "$self start_move out"
130 bind $cur_frame.bottom2.out <ButtonRelease-1> "$self stop_move"
131
132 pack $cur_frame.top -side top -fill x
133 pack $cur_frame.top.up -side top
134
135 pack $cur_frame.middle -side top
136 pack $cur_frame.middle.left -side left
137 pack $cur_frame.middle.center -side left
138 pack $cur_frame.middle.right -side right
139
140 pack $cur_frame.bottom -side top
141 pack $cur_frame.bottom.down -side top
142
143 pack $cur_frame.bottom2 -side top
144 pack $cur_frame.bottom2.in -side left -ipadx 2
145 pack $cur_frame.bottom2.out -side right -ipadx 2
146
147 #####
148
149 frame .presets
150 pack .presets -fill x -side top
151
152 frame .presets.set_frame
153 pack .presets.set_frame -fill x -side top
154
155 button .presets.set_frame.set1 -text "Set 1" -command "$self set_preset 1"
156 pack .presets.set_frame.set1 -side left
157 button .presets.set_frame.set2 -text "Set 2" -command "$self set_preset 2"
158 pack .presets.set_frame.set2 -side left
159 button .presets.set_frame.set3 -text "Set 3" -command "$self set_preset 3"
160 pack .presets.set_frame.set3 -side left
161 button .presets.set_frame.set4 -text "Set 4" -command "$self set_preset 4"
162 pack .presets.set_frame.set4 -side left
163 button .presets.set_frame.set5 -text "Set 5" -command "$self set_preset 5"
164 pack .presets.set_frame.set5 -side left
165 button .presets.set_frame.set6 -text "Set 6" -command "$self set_preset 6"
166 pack .presets.set_frame.set6 -side left
167
168 frame .presets.go_frame
169 pack .presets.go_frame -fill x -side top
170
171 button .presets.go_frame.set1 -text "Go 1" -command "$self go_preset 1"
172 pack .presets.go_frame.set1 -side left
173 button .presets.go_frame.set2 -text "Go 2" -command "$self go_preset 2"
174 pack .presets.go_frame.set2 -side left
175 button .presets.go_frame.set3 -text "Go 3" -command "$self go_preset 3"
176 pack .presets.go_frame.set3 -side left
177 button .presets.go_frame.set4 -text "Go 4" -command "$self go_preset 4"
178 pack .presets.go_frame.set4 -side left
179 button .presets.go_frame.set5 -text "Go 5" -command "$self go_preset 5"
180 pack .presets.go_frame.set5 -side left
181 button .presets.go_frame.set6 -text "Go 6" -command "$self go_preset 6"
182 pack .presets.go_frame.set6 -side left
183
184 # make exit button
185 button .exit -text "Exit" -command exit
186 pack .exit -side bottom
187 }
188
189 CameraApp public start_move {dir} {
190 global g_camSelect
191 $self instvar 405_
192
193 $405_ camera_startMove $g_camSelect $dir
194 }
195
196 CameraApp public stop_move {} {
197 global g_camSelect
198 $self instvar 405_
199
200 $405_ camera_stopMove $g_camSelect
201 }
202
203 CameraApp public move_camera {argument num_times} {
204 global g_camSelect
205 $self instvar 405_
206
207 $405_ camera_pulseMove $g_camSelect $argument $num_times
208 }
209
210 CameraApp public center_camera {} {
211 global g_camSelect
212 $self instvar 405_
213
214 $405_ camera_center $g_camSelect
215 }
216
217 CameraApp public set_preset { num } {
218 global g_camSelect
219 $self instvar 405_
220
221 $405_ camera_setPreset $g_camSelect $num
222 }
223
224 CameraApp public go_preset { num } {
225 global g_camSelect
226 $self instvar 405_
227
228 $405_ camera_goPreset $g_camSelect $num
229 }
230
231 # driver engine
232
233 set app [new CameraApp $argv]
234
235 # next line is very important!!!
236 vwait forever
237
238
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.