Space Engineers

Space Engineers

Sam's Autopilot Manager
131 Comments
Spite May 25, 2020 @ 12:52pm 
@FlyingMachineGun, you might have better luck if you switched to SAMv2, which is the updated version of this script. Not sure whether this one still works
Prison Mike May 25, 2020 @ 12:12pm 
For some reason i cant assing my antenna to the PB.. Anyone know a solution?
Magistrator  [author] Feb 13, 2019 @ 11:35am 
LisanAlGaib Feb 3, 2019 @ 12:25am 
I had to learn a bit more about the stock autopilot to figure out what was going wrong. I did not have any downward facing thrusters, which cause the stock autopilot feature that your script manages to lose it's shit.
Anyone having problems like I did, put some thrusters in every direction, even toward gravity. It improved functionality by a lot.
LisanAlGaib Feb 2, 2019 @ 9:08pm 
Thanks for that. Maybe I'm doing something wrong, but when I start navigation to a different point, the script get perpetually stuck in the "withdrawing" step, but doesn't actually move. If I manually withdraw it though, and start the nav while already in the air, it proceeds to the destination. Have I set something up wrong?
I also observed that when I am able to get it to navigate to the point, once it gets there, it manages to get within like a meter or two from the connector, but then lightly spins and rises higher until I cancel the nav and land it myself.
Final note: I have not changed anything in the previously suggested code as of yet.
Magistrator  [author] Feb 2, 2019 @ 6:28am 
Kerberos, for version SAMv1 you can play with these values:
https://github.com/sugardose/SpaceEngineers/blob/master/SamsAutopilotManager.cs#L26
LisanAlGaib Feb 1, 2019 @ 7:56pm 
Approach/Withdraw both mention orientations and vectors seemingly being remembered or at least reused. Is there a method that can be used to influence these?
Darian Stephens Jan 30, 2019 @ 7:35pm 
I am very much looking forward to it. I tried the original SAM a few times but it never quite worked out, always ended up overshooting the connector and smashing the drone in to things.
Here's hoping that SAMv2 solves this issue!
Magistrator  [author] Jan 30, 2019 @ 2:55pm 
Folks, I am done with SAMv2. I will release it in the coming week. Highlights are: working with, without and alternating gravity; auto dock learning - no more need to program coordinates; Much better path finding.
I will take some of days to do the documentation and some videos to help who ever uses this. If anybody is interested to do a tutorial video, do let me know.

Note: the new version will be a new Script. I wont replace this one because it fundamentally changes some functionalities and I dont want to catch users by surprise.
Darian Stephens Jan 12, 2019 @ 6:50am 
Version 2 has been planned for quite some time, which will work in both Gravity and Space, with easy transitions between each.
Version 1 is only intended for planets, though.
uglydisease Jan 12, 2019 @ 6:45am 
I'm not sure if I am using the script incorrectly or not, but when I try to set a waypoint using DOCK REGISTER in space I get a message "Not In a planet" which is caused by the following line :
if (!this.InPlanet()) {
this.Log("Not in a planet");
return;
}

Is this script only intended to work on planets and not in space?
coolfarmer Jan 8, 2019 @ 7:12pm 
Does Sam V2 will be possible to create a cargo run between Earth and Moon? I hope so!!
enenra Jan 2, 2019 @ 2:32pm 
Hi. The script diag screen asks me to add a reference cockpit to the grid in the thrusters part. I have done so but it doesn't seem to do anything. Unsure what to do at this point. Any ideas?
2TauntU Nov 19, 2018 @ 11:50pm 
Hello thank you so much for your time on this script!
Does this work on MP server?
TankPrime Nov 13, 2018 @ 5:21am 
Great Script i love it helps my ship get around on the planet i wish i can be used for space :)
Guran Nov 11, 2018 @ 5:38am 
The concept is fantastic, please implement space too :)
Izidore Nov 4, 2018 @ 3:32am 
V2 Sounds exciting. I hate to ask but... 'almost done' = week(s), month(s), don't know - it'll be done when it works? I'm in the middle of a pretty big SE build project that I may put on hold until V2 comes out. I wish I could do something to help but my scripting skills are limited to what I can squeeze out of VSB.
Magistrator  [author] Nov 4, 2018 @ 2:24am 
Izidore, in v1 there is no way to do that currently. When you save a dock, it saves various information like orientation, location, etc. So it is never only one coordinate. In v2 you wont need to physically fly to docks. The system learns about them automatically if they are under antenna range. Its almost done if only I had 2x more time in a day.
Izidore Nov 4, 2018 @ 1:00am 
My bad; I neglected to thank you for your reply. Thank you. So SAMv2? I look forward to it. I do have another question; is there anyway to 'feed' SAM a grid coord for a dock location other than phisically flying there and recording it?
Magistrator  [author] Oct 24, 2018 @ 10:15am 
Thanks Izidore for the feedback. SAMv2 which I am currently working on, has a completelly re-written pipeline. Pipeline that avoids the use of the Autopilot and therefore some of its bugs. Consequently, the navigation algorithm is improved and a better docking system is possible, where you wont need to teach the ship where to Dock.
Izidore Oct 24, 2018 @ 6:54am 
(5) My ability to write scripts is strictly and completely limited to what I can coax out of Visual Script Builder so I truly appreciate and admire your skill. That being stated, please don't be insulted by this question; have you considered looking at Spug's script to see how he executes docking? Remote control location doesn't matter with Spug's and it nails the landing every time. Just a thought.
Izidore Oct 24, 2018 @ 6:53am 
(4) None of what I stated previously is a complaint. I just wanted to provide some feedback from my use of your script. I appreciate all of your work and the main function of your script (the actual navigation and terrain avoidance part) works like a dream. Other features like the multiple info displays available and just overall ease of use are fantastic bonuses to a great script.
Izidore Oct 24, 2018 @ 6:52am 
(3) I did a work-around in that I registered additional locations shy of the actual connector and used a tagged PB to run "Spug's Easy Automated Docking" to fly to the connector. While I couldn't get the timer to work, NAV STOP seems to pass to the PB just fine. Spug's nails the landing perfectly every time
Izidore Oct 24, 2018 @ 6:52am 
(2) I prefer not to rebuild my ship to get the remote closer to the CoM. On approach to the docking location the ship dips below the connector a few meters shy of termination (but then climbs back up) and on departure it exhibits the same behavior but just in reverse (dipping down when backing up). This causes my ship to bang off of a few blocks here and there and, actually, with the recommended number of downward thrusters it would often get stuck on the edge of the platform where one of my registered connectors is located (on approach). Also on some registered connectors (but not others) the ship would stop 'just' shy of the connector's grab range. Additionally, for some reason, I could never get the tagged timer block to start/trigger.
Izidore Oct 24, 2018 @ 6:51am 
(1) Just for some feedback. Adding additional downward facing thrusters (to get to the recommended thrust) did change docking behavior slightly but did not seem to change performance/accuracy. It may be due to the design of my ship. Its is a small cargo ship/drone built for a 3X inventory game setting. The remote control is slightly below and aft of the CoM when the ship is full and slightly below and forward of the CoM when empty. The farthest from CoM (according to the diagnostics) is 1.4m (and it shifts depending on my load).
Izidore Oct 22, 2018 @ 12:49pm 
Thank you for the response. I'll give it a try.
Magistrator  [author] Oct 22, 2018 @ 5:05am 
@Izidore, it is not critical but it helps avoiding some Remote Controller bugs. So give it a try and if all works good then you are good.
Izidore Oct 21, 2018 @ 3:40am 
Sorry to spam questions but I have another one. In the Diagnostics it is telling me that I am underpowered for downward movement (UP in menu). In reality, due to gravity, that is the direction of my fastest acceleration. Is it critical to have the recommended thrust in order for SAM to work properly?
Spite Oct 21, 2018 @ 2:10am 
@Izidore, yes it does
Izidore Oct 21, 2018 @ 2:00am 
Does the 2nd Camera (downward facing) also require the [SAM] tag?
Spite Oct 11, 2018 @ 12:43am 
@MOOKIE1590 It is not designed to work in space, but the author of the script has said that he has a space one he is working on when life doesn't get in the way.
mookie1590 Oct 10, 2018 @ 1:14pm 
I assume this works in space?
Testing either way
FrenzyGr Oct 2, 2018 @ 4:56pm 
Is there a way to make it less aggresive on maintaining auto pilot speed?
MR_Wizard Sep 19, 2018 @ 11:51am 
is it possible to use this script for a surrface to space drone? (reliably)
Wolverine Sep 19, 2018 @ 8:26am 
Got it. Setup a timer block with dock prev, nav start, start timer to run itself
Wolverine Sep 19, 2018 @ 8:02am 
How do i get my ship to endlessly fly back and forth between 2 connectors? i want to use a drone to haul ore from my mining base, to main station to refine it. i got the ship to go from one dock to another, but it stops at the last one
Dark_Wulfric Sep 16, 2018 @ 5:29am 
hello friend! love your mod. amazing to sat the least. i have been using it for a couple days now and have fallen in love. sadly i have encountered this on the program block "script execution halted temporarily. the combined execution between a calling prgrammable block and this script has not been terminated, but the calling script has." whenever i try to tel my ship to go to the next point, pre point, change points or to stop, i get kicked out of the server. i was wondering if anyone has come across this and f ound a fix yet. tried deleting the programble block and remote control block with no luck.
chell Sep 11, 2018 @ 3:12pm 
This looks interesting. How well does it handle interplanetary travel?
RVenes Sep 11, 2018 @ 2:04pm 
I would love a space edition of this script!
Enigmus Aug 25, 2018 @ 7:09pm 
Script seems to have trouble with canyons. When Attempting to leave a canyon the ship undocks and backs away and hen it just spins. Entering a canyon it doesn't calulate it's stopping speed and can running into the wall attempting to slow down. I would suggest a crusing altitude variable that gives a preference to flying above obsticals before docking.
ttami Aug 10, 2018 @ 11:51am 
Congratulation from me also. After successfully working with this script in gravity, I would appreciate if we get a version for space also. ... but .... no hurry .. taking care of your family is always prio no.1
Magistrator  [author] Aug 2, 2018 @ 2:30pm 
Thanks, I have updated the SE.
NorcaSystems Aug 1, 2018 @ 2:30pm 
Congratulations on becoming a father, I will send a PR to Github.
Magistrator  [author] Aug 1, 2018 @ 2:24pm 
Thanks NorcaSystems, no offence taken. If you send a PR to the github repository I will update it here.

I have been away from the Interwebs since I become a father. I left version 2.0 half baked, but am planning to resume working on it as time allows.
NorcaSystems Aug 1, 2018 @ 12:44pm 
HI, Not sure if the Magistrator is still actively updating this script and the GitHub version appears to be a couple of versions behind the one you can download here.

Given the problem both myself and some other users have been having to make the notify timer function work I decided to see if I could get it to work.

If anyone is interested I have made the following changes:

Line 640 - remove following -- block.ApplyAction("TriggerNow");
Replace with -- block.GetActionWithName("TriggerNow").Apply(block);

Line 644 - remove following -- block.ApplyAction("Start");
Replace with -- block.GetActionWithName("Start").Apply(block);

After Line 167 [this.controlBlock.ClearWaypoints();] of the StopRemoteAutopilot function add the following new line -- this.NotifyTimers();

Line 623 - remove following -- this.NotifyTimers();


I hope this helps other people out, and I hope I have not offended the original author by making and posting these updates.
DUBz Jul 29, 2018 @ 4:13pm 
hi man, count me as waiting for it to work in space, otherwise perfect good job!
NorcaSystems Jul 24, 2018 @ 4:08pm 
Does anyone have trouble with the triggers for the timers not working since the latest update? I added a couple of Logging lines to the code to count the timer blocks that it finds on the grid and it reports zero found.
Mr_? Jul 21, 2018 @ 8:48am 
I would love it to have space and orbital functionalities
pro100tv Jul 21, 2018 @ 2:24am 
Hey, is there any way to stabilize the aircraft while the script is running?

I`m working on a cargo plane which need to be trim a bit while at full load and autopilot seems to doesn`t care about the craft pitch and sometimes it just happen to crash it to the ground
Merced Jul 20, 2018 @ 9:48am 
Sad it doesn't work in space