MeteoricGames / pioneer

A game of lonely space adventure
GNU General Public License v3.0
9 stars 3 forks source link

Odd autopilot behaviour #241

Closed outridersol closed 10 years ago

outridersol commented 10 years ago

Start in firedrake, take off, select fly to vicinity of station from autopilot.

What tends to happen is the ship flies to 5000km out, and then switches off autopilot and goes back to maneuver mode. If you then select autopilot and fly to vicinity of station again, it takes you to 15km away from station as you'd expect. Bit of a waste of time since this is all being replaced soon, but hopefully it's a simple fix.

Salwan commented 10 years ago

If I understand the issue correctly,.. I'm not able to reproduce it (testing on master). When I take off and select harken station then fly to vicinity command the autopilot turns off immediately and zeroes the speed out, I have to fly 15km or farther away from the station for the fly to vicinity command to do something. Strange..

outridersol commented 10 years ago

Sorry, might not have been the best description; this is what happens for me on master;

-start on harken

-take off

-select autopilot fly to vicinity of rust transfer station

-autopilot shuts off by itself while at exactly 5000km distance from station, switches to set speed mode (set to 0m/s) and comes to a full stop.

-from there if I again select fly to vicinity of rust transfer station, it does as expected and takes me to 15km distance from the station before turning off.

Salwan commented 10 years ago

Yes, was able to reproduce it, so far seems to happen whenever the transit drive is activated during autopilot flight.

shadmar commented 10 years ago

Just tested, yeah it happens here too. After transit autopilot shuts off yes.

Use ctrl+i to get debug info on autopilot.

shadmar commented 10 years ago

line 849 returns true and kills the autopilot in shipaicmd.cpp Was changed in #200

shadmar commented 10 years ago

line 792 also returns true wich will kill the autopilot (also changed in #200), I don't know if it affects anything yet there.

Salwan commented 10 years ago

There was an issue with flyto that made the autopilot never turn off when arriving at the vicinity of a planet, it would just keep going back and forth and triggering the transit drive on and off repeatedly. I think the return calls I changed were causing the autopilot to not terminate in that situation.

shadmar commented 10 years ago

849 fixes this issue when I tested now. I will fly around and test abit more.

Salwan commented 10 years ago

Tested 849 for a while, it does fix it but it still causes the fly to planet problem. I noticed target_radii having a high default value and is changed to a different value for planets and ships but not spacestations (799), changing it for spacestations causes overshooting and results seem relative to the distance between ship and spacestation at the beginning of travel. I'll test more.

shadmar commented 10 years ago

I know 5000km was the closest I risked when I once wrote that "messy" transit stuff. For planets I used phyradius*1.25.

shadmar commented 10 years ago

ok flying to Atlantica displays the problem with 849 as true right?

You arrive at planet, and autopilot wants to fly abit further out and transit starts to and brings you back to 1.25, right?

shadmar commented 10 years ago

Will changing 799 to if (m_target->IsType(Object::PLANET)) target_radii = VICINITY_MUL*MaxEffectRad(m_target, m_ship)+5000000.0; fix the problem? while leaving 849 to return true?

Seems to work for both planets and spacestations.

Salwan commented 10 years ago

It is happening for all planets when I test.
The modified target_radii calculation seems to stop the autopilot when it arrives, but it does it far away from the planet :) Gonna do more testing

shadmar commented 10 years ago

The original autopilot "go to vicinity" uses VICINITY_MUL*MaxEffectRad(m_target, m_ship) as distance. The transitdrive is set to use phyradius*1.25

So when transit is done and autopilot takes over it will try and go to VICINITY_MUL*MaxEffectRad(m_target, m_ship), but if that is further way than phyradius*1.25, the transit drive kicks in again, and you have an endless loop.

Salwan commented 10 years ago

Ok, after trying many different adjustment I used VICINITY_MUL and modified the extra distance to 16000000 so it gets as close as possible to flyto destination without entering an infinity autopilot-flyto loop. Pushed directly to master since it's a minor adjustment.

outridersol commented 10 years ago

Cool, the autopilot switch-off problem's solved for me. Another problem that popped up for me yesterday (before this fix, so I don't think it caused it) is after autopilot gets to 15km from station, instead of going to maneuver mode and set speed 0, it goes to maneuver mode and set speed 100km/s. (like when you deactivate transit drive mid-autopilot)

Salwan commented 10 years ago

Changed transit to only lower speed if transit is interrupted or ended, is the issue still there? I don't have a sure way to check for it

outridersol commented 10 years ago

yep, that's done it :). Hopefully we can forget about it now!

Salwan commented 10 years ago

Great! :)

outridersol commented 10 years ago

Ok as far as I can tell there's no major problem left with autopilot so I'm closing this one, new issue can be opened if problems pop up anywhere else.