Jump to content
Sign in to follow this  
sirglider

Plane WP not working

Recommended Posts

Hi all!

I'm working hard on my UAV consol to control many uav's at the same time and also in mp. My main script, from the dialog, is quite big about 20Ko. I'm testing it for the moment only on one computer, so in SP, so in local.

I'm assigning new WP from the main script to my uav's. They are then published with the publicvariable command. Each uav has got it's own loop running to see if their wp has changed for example.

The state is so: it's working fine at the beginning, every uav moves to its first wp. But then when I assigned them a new WP, they move but in a complete different direction and they never stop. They just flight straight in a direction. I've checked at many states if my wp are recognized. They are even recognized in the uav script. But the UAV doesn't obey to the moving order anymore.

Last test: if I assign a new WP from a radio trigger for example. No prob then.

Any idea? Limit of number of commands in a loop for example?

Thx for your help mates!  thumbs-up.gif

Share this post


Link to post
Share on other sites

How far apart are the new waypoints for the old ones?

Also, why are you using public variable? If the UAV's are not piloted by the player, wont they be local to the server?

Share this post


Link to post
Share on other sites

you're right the UAV will be local on the server. But the controler is a player, the one which gives them orders.

For your 1st question: points are at least 50m away from eachother. But I've tried with points close the 1st one and also points really far (~10'000m) from the 1st one. Both the same results

Share this post


Link to post
Share on other sites
Quote[/b] ]you're right the UAV will be local on the server. But the controler is a player, the one which gives them orders.

I see, are you plotting a path to follow. Or trying to control the UAV in flight?

Quote[/b] ]points are at least 50m away from each other. But I've tried with points close the 1st one and also points really far (~10'000m) from the 1st one. Both the same results

The distance must not be less that the value used for Precision, in the config. For class Air the deafult value is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">precision=100;

If the distance is less than the precision, I think it assumes it's already there. So it ignores the waypoint. Plus there also appeares to be a maximum range for wapoints. It goes down to about 1000m when you start ploting points off the visible map area.

What happens if you stay within 2000 meters apart, for each waypoint?

I came across some of these limitations, trying to direct AI aircraft. If you can avoid them, then it should work ok.

Share this post


Link to post
Share on other sites

The control script checks if the WP from the actual Ranger is different from the Temppos defined with an OnMapSingleClick command and published. If there's a difference then it publishes the new position for the Ranger.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...

#loop

~0.005

...

_RangerWP = Call format [ "Ranger%1WP",_IDofRanger ]

...

If (abs ((Temppos select 0) - (_RangerWP select 0)) > 50) then {Call format ["Ranger%1WP = Temppos; publicvariable {Ranger%1WP}",_IDofRanger]; _objRanger sidechat format ["Roger, UAV %1 moving to %2",_IDofRanger,Temppos]}

If (abs ((Temppos select 1) - (_RangerWP select 1)) > 50) then {Call format ["Ranger%1WP = Temppos; publicvariable {Ranger%1WP}",_IDofRanger]; _objRanger sidechat format ["Roger, UAV %1 moving to %2",_IDofRanger,Temppos]}

...

goto "loop"

Then the UAV script checks if there's a difference between its actual position and the position saved in the consol script. If yes, then it orders the uav to move to this new WP.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...

#loop

_RangerWP = Call format [ "Ranger%1WP",_IDofRanger ]

...

If (abs ((_RangerWP select 0) - (getpos _objRanger select 0)) > 50) then {_objRanger move _RangerWP; player sidechat format ["_RangerWP = %1 pour _objRanger %2", _RangerWP, _IDofRanger]}

If (abs ((_RangerWP select 1) - (getpos _objRanger select 1)) > 50) then {_objRanger move _RangerWP; player sidechat format ["_RangerWP = %1 pour _objRanger %2", _RangerWP, _IDofRanger]}

...

goto "loop"

I've changed into move commands instead of domove ones. Results, working the first time I run the test, but not on the next ones... strange behaviour! But it works from time to time. But most of the time not...

An other result: the _RangerWP is well read in the UAV script. It means the information of changing it's designed point and publish it is good! Only the UAV doesn't answer on the command...

Thx for your help mates!

Share this post


Link to post
Share on other sites
Quote[/b] ]WP from the actual Ranger

When you say you check the Rangers waypoint, is that with the GetWPPos command. Or are both waypoints just stored as position arrays?

It does sound like your trying to update the waypoints, while the Ranger is flying, that could be the problem.

Quote[/b] ]I've changed into move commands instead of domove ones. Results, working the first time I run the test, but not on the next ones... strange behaviour! But it works from time to time. But most of the time not...

There are some subtle differences with the Move & DoMove command. If I remember correctly, one of them (DoMove I think) will create a waypoint that can be accessed with things like GetWPPos. The others are to do with speed and combat mode. With the Move command you have to make sure you don't over extend it. I wrote a small function that took to positions (start & End), and measured the distance between them. If it was over a certain limit, it would interpolate a new waypoint, thats was in range. And keep repeating the process until it reached the original End point.

Does it work ok in SP, it could be a MP problem? You could always send me the addon and test mission, if you don't find a solution.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×