-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjointtest.cpp
More file actions
executable file
·67 lines (59 loc) · 1.78 KB
/
Copy pathjointtest.cpp
File metadata and controls
executable file
·67 lines (59 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <iostream>
#include "JointMoveProto.h"
#include "tserial.h"
using namespace std;
using TLeyson_Robot::PI;
using TLeyson_Robot::joint;
int MoveRobot(Tserial* ComPort, char Joint);
int main(void)
{
Tserial com;
com.connect(L"com1", 9600, spEVEN);
try
{
TLeyson_Robot::JointMove djoint('D', 5 * PI/12, -5 * PI/12,
"H:\\C++_Examples\\MoveClass\\Prototypes\\JointMoveProto\\resolutions.txt", &com);
TLeyson_Robot::JointMove ejoint('E', PI/3, -PI/3,
"H:\\C++_Examples\\MoveClass\\Prototypes\\JointMoveProto\\resolutions.txt", &com);
TLeyson_Robot::JointMove fjoint('F', PI/6, -PI/6,
"H:\\C++_Examples\\MoveClass\\Prototypes\\JointMoveProto\\resolutions.txt", &com);
Sleep(1000);
djoint.Move(-PI/8);
djoint.Move(PI/12);
fjoint.Move(PI/8);
djoint.Move(-PI/12);
fjoint.Move(-PI/12);
ejoint.Move(-PI/8);
}
catch (TLeyson_Robot::FileNotFoundException e)
{
cout << "File not found." << endl;
cout << "File with name " << e.fname << " could not be located." << endl;
}
catch (TLeyson_Robot::ValueNotFoundException f)
{
cout << "The value could not be found in " << f.fname << endl;
}
catch (TLeyson_Robot::BoundaryViolationException)
{
cout << "Boundary violated." << endl;
}
com.disconnect();
return 0;
}
// This function was used to reposition the robot after movement; the Visual Basic program
// does a better job.
// int MoveRobot(Tserial* ComPort, char Direction, char Joint)
// {
// char input;
// char Up[] = {Joint, '+', '5', '0', 0x0A, 0x0D};
// char Down[] = {Joint, '-', '5', '0', 0x0A, 0x0D};
// while ( (input = cin.get()) == '+' || input == '-')
// {
// if (input == '+')
// (*ComPort) << Up;
// else if (input == '-')
// (*ComPort) << Down;
// }
// return 0;
// }