Example for using the Isel iMC-S8 linear controller, defines a command line interface
#include <PanTilt/IselLinearControlTwoAxis.hh>
using namespace BIAS;
using namespace std;
int main(int argc, char *argv[])
{
char menuChoice;
int input, input2;
float f, f2;
string s;
if(argc != 2) {
cout << "Usage: ./ExampleIselLinearControlTwoAxis <PortName>" << endl;
return -1;
}
if (control.
Init(argv[1]) != 0) {
cout << "Initialising IGOR unit on serial port x failed!" << endl;
return -1;
}
cout << "bla" << endl;
while(true) {
cout << "============================" << endl;
cout << "(1) move x-axis" << endl;
cout << "(2) move y-axis" << endl;
cout << "(3) status output" << endl;
cout << "(4) set speed" << endl;
cout << "(5) reference movement" << endl;
cout << "(6) move free" << endl;
cout << "(7) position output" << endl;
cout << "(8) set position" << endl;
cout << "(9) send command" << endl;
cout << "(Q) quit" << endl;
cin >> menuChoice;
switch (menuChoice) {
case '1':
cout << "move distance (mm):" << endl;
cin >> input;
break;
case '2':
cout << "move distance (mm):" << endl;
cin >> input;
break;
case '3':
cout << s << endl;
break;
case '4':
cout << "set speed on x-axis (mm/sec) to:" << endl;
cin >> input;
cout << "set speed on y-axis (mm/sec) to:" << endl;
cin >> input2;
break;
case '5':
break;
case '6':
break;
case '7':
cout << "position (mm): " << f <<", " << f2 << endl;
break;
case '8':
cout << "set position on x-axis (mm) to:" << endl;
cin >> input;
cout << "set position on y-axis (mm) to:" << endl;
cin >> input2;
break;
case '9':
cout << "enter command:" << endl;
cin >> s;
cout << "return: " << s << endl;
break;
case 'Q':
case 'q':
return 0;
default:
cout << "unknown input!" << endl;
}
}
}