4 # pragma warning(disable: 4005)
7 #include "VideoSource_Controller_PMD.hh"
10 # include <Base/Common/getopt_W32.h>
14 #include <Base/Image/ImageIO.hh>
15 #include <Image/Camera.hh>
16 #include <Gui/StringConv.hh>
36 ,wxDefaultPosition,wxSize(500,500),wxSTAY_ON_TOP |wxCAPTION)
41 min_integrationTime_=0; max_integrationTime_=120;
42 min_distanceOffset_=0; max_distanceOffset_=1500;
46 SetDistanceOffsetRange(min_distanceOffset_, max_distanceOffset_);
47 SetIntegrationTimeRange(min_integrationTime_, max_integrationTime_);
54 VideoSource_Controller_PMD::
55 ~VideoSource_Controller_PMD()
60 void VideoSource_Controller_PMD::
63 sliderBox_ShGa_Visible =
true;
66 wxSize SlSize(100,200);
69 wxBoxSizer *slInt =
new wxBoxSizer(wxVERTICAL);
70 wxStaticText *tInt =
new wxStaticText(
this,ID_TEXT, wxT(
"Integration Time \n[ms]"));
71 SliderIntegration =
new wxSlider(
this, ID_INT, 0, min_integrationTime_,
73 wxDefaultPosition,SlSize,
74 wxSL_VERTICAL | wxSL_LABELS | wxSL_RIGHT,
75 wxDefaultValidator, wxT(
"Int"));
77 SliderIntegration->Enable(
true);
78 slInt->Add(tInt,0,wxALL,2);
79 slInt->Add(SliderIntegration,0, wxALL,2);
81 checkBoxShowDepth =
new wxCheckBox(
this, ID_CHECK_SHOWDEPTH, wxT(
"Show Depth"), wxDefaultPosition, wxDefaultSize, 0 );
83 wxBoxSizer *slMod =
new wxBoxSizer(wxVERTICAL);
84 wxStaticText *tMod =
new wxStaticText(
this,ID_TEXT, wxT(
"Modulation Freq"));
85 wxSize comboSize(150,25);
86 wxString choices[10] = {wxT(
"MF_60MHz"),
96 comboBoxModFreq =
new wxComboBox(
this,ID_MOD,wxT(
"ModFreq"),wxDefaultPosition,
97 comboSize,10,choices,wxCB_READONLY);
98 comboBoxModFreq->SetSelection(6,6);
99 comboBoxModFreq->SetValue(wxT(
"MF_20MHz"));
101 comboBoxModFreq->Enable(
true);
102 slMod->Add(tMod,0,wxALL,2);
103 slMod->Add(comboBoxModFreq,0, wxALL,2);
105 slMod->Add( checkBoxShowDepth, 0, wxALL, 5 );
108 wxBoxSizer *slDist =
new wxBoxSizer(wxVERTICAL);
109 wxStaticText *tDist =
new wxStaticText(
this,ID_TEXT, wxT(
"Distance Offset"));
110 SliderDistanceOffset =
new wxSlider(
this, ID_DIST, 0, 0, 30000,
111 wxDefaultPosition,SlSize,
112 wxSL_VERTICAL | wxSL_LABELS | wxSL_RIGHT,
113 wxDefaultValidator, wxT(
"Dist"));
115 SliderDistanceOffset->Enable(
true);
116 slDist->Add(tDist,0,wxALL,2);
117 slDist->Add(SliderDistanceOffset,0, wxALL,2);
120 showButton =
new wxButton(
this, ID_HIDE, wxT(
"Hide"),
121 wxDefaultPosition,BtSize);
122 update_Button =
new wxButton(
this, ID_BUTTON_UPDATE,
123 wxT(
"UPDATE"),wxDefaultPosition,BtSize);
125 vBox =
new wxBoxSizer(wxHORIZONTAL);
126 vBox->Add(showButton,0,wxALIGN_LEFT | wxBOTTOM);
127 vBox->Add(update_Button, 0, wxALIGN_RIGHT | wxBOTTOM);
129 wxBoxSizer *sl =
new wxBoxSizer(wxHORIZONTAL);
131 sl->Add(slMod,0,wxALL,2);
132 sl->Add(slInt,0,wxALL,2);
133 sl->Add(slDist,0,wxALL,2);
135 sliderBox_ShGa =
new wxBoxSizer(wxVERTICAL);
136 sliderBox_ShGa->Add(sl,0,wxALL, 2);
137 sliderBox_ShGa->Add(vBox,0,wxALL,2);
139 vBox->SetSizeHints(
this);
140 this->SetSizer(sliderBox_ShGa);
148 void VideoSource_Controller_PMD::
154 void VideoSource_Controller_PMD::
155 OnHide(wxCommandEvent& event){
159 void VideoSource_Controller_PMD::
160 OnClose(wxCloseEvent& event) {
165 void VideoSource_Controller_PMD::
166 OnIntegration(wxScrollEvent& event) {
167 double value = SliderIntegration->GetValue();
171 Cam_->SetIntegrationTimeMS(
unsigned(rint(value)));
176 void VideoSource_Controller_PMD::
177 OnDistance(wxScrollEvent& event) {
178 double value = SliderDistanceOffset->GetValue();
180 Cam_->SetDistanceOffset(
unsigned(rint(value)));
186 void VideoSource_Controller_PMD::
189 unsigned int currentInt = 0;
190 Cam_->GetIntegrationTimeMS(currentInt);
192 SliderIntegration->SetValue(currentInt);
193 Cam_->GetDistanceOffset(currentInt);
194 SliderDistanceOffset->SetValue(currentInt);
198 void VideoSource_Controller_PMD::
199 OnUpdate(wxCommandEvent& event) {
203 void VideoSource_Controller_PMD::
204 SetDistanceOffsetRange(
unsigned int min,
unsigned int max)
206 SliderDistanceOffset->SetRange(min,max);
209 void VideoSource_Controller_PMD::
210 SetIntegrationTimeRange(
unsigned int min,
unsigned int max)
212 SliderIntegration->SetRange(min,max);
216 void VideoSource_Controller_PMD::
217 OnCheckShowDepth(wxCommandEvent& event) {
218 Cam_->GrabImageReturnsDepth(event.IsChecked());
222 void VideoSource_Controller_PMD::
223 OnModFreq(wxCommandEvent& event) {
224 std::string text = WxToAscii(comboBoxModFreq->GetValue());
225 unsigned int freq = 20000000;
227 if(text.compare(
"MF_60MHz") == 0)
229 else if(text.compare(
"MF_40MHz") == 0)
231 else if(text.compare(
"MF_31MHz") == 0)
233 else if(text.compare(
"MF_30MHz") == 0)
235 else if(text.compare(
"MF_29MHz") == 0)
237 else if(text.compare(
"MF_21MHz") == 0)
239 else if(text.compare(
"MF_20MHz") == 0)
241 else if(text.compare(
"MF_19MHz") == 0)
243 else if(text.compare(
"MF_15MHz") == 0)
245 else if(text.compare(
"MF_10MHz") == 0)
249 Cam_->SetModulationFrequency(freq);
Defines a common interface to different devices.
Support for CamCube usb cam.