[10065] | 1 | -- Set some test variables |
---|
| 2 | xm = 1000 |
---|
| 3 | ym = 0 |
---|
| 4 | zm = 0 |
---|
[10035] | 5 | |
---|
[10065] | 6 | xl = -1000 |
---|
| 7 | yl = 3000 |
---|
| 8 | zl = -1000 |
---|
[10035] | 9 | |
---|
[10065] | 10 | d = 5 |
---|
| 11 | Tabs = 0 |
---|
[10035] | 12 | |
---|
[10065] | 13 | pi = 3.1415 |
---|
[10037] | 14 | |
---|
[10047] | 15 | -- Get a local pointer to a scriptcontroller |
---|
[10045] | 16 | local ctrl = orxonox.ScriptController:getScriptController() |
---|
[10047] | 17 | |
---|
| 18 | -- If it worked, call its "movetoposition" function |
---|
[10046] | 19 | if ctrl ~= nil then |
---|
[10065] | 20 | -- Move to the starting point at (xl+3000,yl,zl) while looking |
---|
| 21 | -- at xl,yl,zl over the time span of 3 seconds |
---|
| 22 | ctrl:eventScheduler("mal", xl+3000,yl,zl, xl,yl,zl, 3, 0) |
---|
| 23 | |
---|
| 24 | -- From there, perform a rotation around the harvester placed there |
---|
| 25 | -- in 100 steps |
---|
| 26 | dt = math.pi/100 |
---|
| 27 | for t = 0,math.pi,dt do |
---|
| 28 | xt = math.cos(t) |
---|
| 29 | yt = math.sin(t) |
---|
| 30 | |
---|
| 31 | ctrl:eventScheduler("mal", xl+3000*xt, yl+3000*yt, zl, xl, yl, zl, 3*dt, 3*t+2.9) |
---|
| 32 | end |
---|
| 33 | |
---|
| 34 | -- Update absolute time |
---|
| 35 | Tabs = 3*math.pi + 2.9 |
---|
| 36 | |
---|
| 37 | -- Move away again, still looking at the station |
---|
| 38 | ctrl:eventScheduler("mal", 0,0,1000, xl,yl,zl, 3, Tabs+0.4) |
---|
| 39 | |
---|
| 40 | |
---|
[10046] | 41 | end |
---|
| 42 | |
---|
[10057] | 43 | |
---|
| 44 | |
---|
[10047] | 45 | -- Output the newctrlid variable we set from the C++ code |
---|
[10046] | 46 | if newctrlid ~= nil then |
---|
| 47 | orxonox.execute("orxout message test " .. newctrlid) |
---|
| 48 | end |
---|
[10037] | 49 | |
---|
[10045] | 50 | --orxonox.execute("setPause 1") |
---|
[10037] | 51 | |
---|
[10045] | 52 | |
---|