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:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
|
main()
{
thread link();
thread cat1_move_1();
thread cat1_move_2();
stop();
}
link()
{
trig_cat1_1 = getent ("trig_cat1_1","targetname");
trig_cat1_2 = getent ("trig_cat1_2","targetname");
trig_cat1_stop = getent ("trig_cat1_stop","targetname");
trig_cat1_1 enablelinkto();
trig_cat1_2 enablelinkto();
trig_cat1_stop enablelinkto();
}
cat1_move_1()
{
cat1 = getent ("cat1","targetname"); // Plattform
trig_cat1_1 = getent ("trig_cat1_1","targetname"); // richtung -200, 1480, 90
trig_cat1_2 = getent ("trig_cat1_2","targetname"); // richtung 1072, 1480, 90
trig_cat1_stop = getent ("trig_cat1_stop","targetname");
//mg_1 = getent ("mg_1","targetname");
while (1)
{
trig_cat1_2 waittill ("trigger");
trig_cat1_1 linkto(cat1);
trig_cat1_2 linkto(cat1);
trig_cat1_stop linkto(cat1);
//mg_1 linkto (cat1);
start = cat1.origin; //aktuelle Position des Objektes
dest = (1072, 1480, 90); // Zielpunkt des Objektes
dist = distance(start, dest); // Entfernung zwischen Start- und Zielpunkt
speed = (1 / 35) * dist; // Sekund / WE
cat1 moveto(dest, speed); // Objekt zur neuen Position bewegen
}
}
cat1_move_2()
{
cat1 = getent ("cat1","targetname");
trig_cat1_1 = getent ("trig_cat1_1","targetname");
trig_cat1_2 = getent ("trig_cat1_2","targetname");
trig_cat1_stop = getent ("trig_cat1_stop","targetname");
//mg_1 = getent ("mg_1","targetname");
while (1)
{
trig_cat1_1 waittill ("trigger");
trig_cat1_1 linkto(cat1);
trig_cat1_2 linkto(cat1);
trig_cat1_stop linkto(cat1);
//mg_1 linkto (cat1);
start = cat1.origin; //aktuelle Position des Objektes
dest = (-200, 1480, 90); // Zielpunkt des Objektes
dist = distance(start, dest); // Entfernung zwischen Start- und Zielpunkt
speed = (1 / 35) * dist; // Sekund / WE
cat1 moveto(dest, speed); // Objekt zur neuen Position bewegen
}
}
stop()
{
cat1 = getent ("cat1","targetname");
trig_cat1_stop = getent ("trig_cat1_stop","targetname");
while(1)
{
trig_cat1_stop waittill("trigger");
cat1 moveto(cat1.origin, 0.1);
wait 0.1;
}
}
|