Space Engineers

Space Engineers

WCCS - Dock
51 Comments
Wicorel  [author] 23 Jan, 2020 @ 3:28pm 
This part is the drone side. The mothership is in the Antenna Receive script.

It can be mobile.. however. the ship needs to be non-moving while docking is taking place.
Black.icE 22 Jan, 2020 @ 9:50pm 
Can this script be used on a mobile mothership, please?
no 31 May, 2019 @ 2:04pm 
I've added the antenna receive script and the master control script, it turns out I only needed to recompile it :steamfacepalm: . I think the instructions should be a bit clearer though since I had to look through some stuff to find the answer, thanks for your help though :steamhappy:
Wicorel  [author] 31 May, 2019 @ 7:44am 
The 'base' also needs the Antenna receive script and the master control script so it can tell the drone its available connectors.
no 31 May, 2019 @ 6:18am 
Hello, I seem to be having a problem with this script. I have followed the instructions and my drone won't move at all. I have an antenna attached to the drone and an antenna attached to the base or "mom" . Is this script not working? Also, could I have access to the world you used for the demo just to compare? Thanks :cozyspaceengineersb:
Vĕnŕøm™ 27 Feb, 2019 @ 4:36am 
Thanks for the info.
On our server someone made the docking port inside a tunnel/passage so the ship has to turn before the entrance, because it cant turn inside.

On my carrier i had to rework the whole hangar so it can rotate but if the drone only turned 20m earlier i would not need to do anything.

It would be nice if there was a parameter/variable to change the distance.
Wicorel  [author] 26 Feb, 2019 @ 9:00am 
The docking start position is set to the length of the ship +50%. Are you having a problem with this distance?

The drone will align it's connector to the docking connector no matter which side of the drone the connector is on. This is so it can connect when moved closer.

The rest of the drone is aligned to the base ship if the alignment is set in the target connector.
if align= is not found in CustomData of the target connector, no alignment is done

0 = forward
1 =up
2 = down
3=left
4=right
5=back

These are oriented according to the orientation of the ShipController in the base.
Vĕnŕøm™ 26 Feb, 2019 @ 6:22am 
Can i change the distance where the drone turn for docking?
Can I determine how the drone is aligned to the docking port like 90°?
sonicrules1234 19 Nov, 2018 @ 11:39am 
I'm having problems with this again. Everything looks fine except for the speed of the spinning progress indicator. The ship doesn't move when I tell it to dock.

Here's a link to the world:

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1569165496
sonicrules1234 24 Jul, 2018 @ 8:11am 
I'd love to see this working on planets as well. :D
zernon 23 Jul, 2018 @ 9:29pm 
oh ok, no worries, :) I know planets can be a pain, I can test for you if and when you get it up and running.
Wicorel  [author] 23 Jul, 2018 @ 9:28pm 
I'll have to make changes to get it working on planets.
zernon 23 Jul, 2018 @ 7:53pm 
ok, so how do I get it to dock? I was hoping to use this for a freighter solution planet to asteroid, and small drones from my planetary mines, I will link you one when I am finished with it,
Wicorel  [author] 23 Jul, 2018 @ 6:52pm 
I see the problem.

It's not moving up/down to the waypoint because it's trying to maintain level flight in gravity.. and it's too far away when it's right above/below the target point...
zernon 22 Jul, 2018 @ 9:33pm 
as soon as I figure out how to make a blueprint since update... I hit cntrl b and then I cant save it :(
Wicorel  [author] 22 Jul, 2018 @ 8:44pm 
ah, planets... I haven't tested much there with docking..

Either blueprint is fine. I'll use it for testing to ensure I don't have bias for my own test drones :)
zernon 22 Jul, 2018 @ 8:24pm 
I have moved the connector from front, middle, back, left side, right side, behind, and on top, seems to only happen on planets, space it docks just fine, I even made some little drones, they spin also, just a lot faster. and as far as blueprint, you want my little drones or slightly larger frieghter?
Wicorel  [author] 22 Jul, 2018 @ 5:16pm 
Hmm. Where is the connector? Are there any ships in the way?

Can I get a blueprint so I can test?
zernon 22 Jul, 2018 @ 8:28am 
Ok so my ship on docking approaches, then spins in a circle.. moves a little bit and spins, what am I doing wrong?
Wicorel  [author] 15 Mar, 2018 @ 3:19pm 
Precision matching of velocities is not only complicated, it will be subject to clang/desync/etc.. So I have not even attempted it.

Note that the co-ordinate of the moving connector is just an updated GPS point...

To get this to work, you need to have current position and also the current linear and angular velocity (velocity) of that object.. Then the drone would have to match velocity, but then move relative to that velocity to the docking approach and then dock itself.. All the while the velocity of the target ship can change.
woostyboy 15 Mar, 2018 @ 2:24pm 
:( Sadly I know nothing about coding. What I'm really after is for the co-ordinate of the moving connector, rather than a fixed GPS point be transmitted to the approaching connector
Wicorel  [author] 15 Mar, 2018 @ 1:46pm 
It does not support moving "mother" ships.
woostyboy 15 Mar, 2018 @ 4:24am 
Can you use the script to dock onto a moving large grid ship? Thanks.
Wicorel  [author] 4 Dec, 2017 @ 6:33am 
do you have a blueprint I can look at? I want to fix that bug.

You do need craft controller to keep it running.

I do have manually choosing the connector on my list of wanted features.

With the current system, you should be able to make trips between stations: "Dock" has a "launch" command. Then you can travel to the other station (using my NAV module or Keen's autopilot), and then "godock" which will choose the nearest base to dock to.
rol4400 4 Dec, 2017 @ 5:16am 
Whenever I send a docking request from a ship the ant recieve programming block on my station generates an "Object reference not set to an instance of an object" error. I thought this may have been because I didn't have the craft controller running however this script didn't work when run on a static station. Is there some way it can be run on stations rather than mother ships? Also, it would be good if we had the option of manually specifying which connecter or station to dock at. This would essentially allow much more complex drones to be developed easily using timer blocks as they could be set to regularly make trips between stations (e.g. mining base and headquarters).
tom 7 Nov, 2017 @ 11:44am 
adding to the comments below it does seem the launch function is not working in the current version (or previous). As sonicrules says it appears maybe a timing issue with the connector magnet kicking back in before the thrust? possibly!

As per novacores comment we now are able to acheive the ideal docking behaviour we were hoping for (dock to the nearest 'mom') but it seems the only way to make it consistantly avoid a trip back to another mothership is with a sequence of godock, pause, launch, pause, godock.

that sequence resets it if it was going to the wrong target but doesn't cause a problem if it was going to the right target so can be worked around, as can the launch issue, but happy to help testing!

novacore_ae 6 Nov, 2017 @ 4:51pm 
I should have been clearer below - V3.0L of the dock script seemed to still thrust the ship away from the dock when I tested it yesterday, later versions don't appear to thrust away. Didn't test it tonight though. Cheers
novacore_ae 6 Nov, 2017 @ 4:44pm 
Perhaps more along the lines of the original purpose of your script, the second test flew 'Lobster' to a co-ordinate closer to one ship than another, then switched the motherships positions around. Pleasingly, in this situation the' Lobster' targeted the nearest ship every time after only a single 'godock' command was issued. Thanks man!
novacore_ae 6 Nov, 2017 @ 4:44pm 
Unfortunately I can confirm issuing the 'launch' command the ship still doesn't thrust away from the connector, nonetheless this is the best iteration of this script so far....
Very nice work, dude, thanks!

We did a couple of tests tonight, firstly we manually moved the 'Lobster' between the two motherships which were kept stationary. At one end 'Lobster' would dock without issue, at the other end 'Lobster' would start to dock at the ship but then change its aim aim for the further ship, travelling the distance to the further ship then returning to the dock it was closest to initially. Watching the output of the dock PB, you can see when it changes target.
Quite by accident we discovered a sequence which ensured 'Lobster' would dock at it's nearest ship every time - by issuing 'godock', then issuing ' launch' then 'godock' again, we achieved functional transfer between two stationary docks without the long journey.
Wicorel  [author] 6 Nov, 2017 @ 4:40pm 
hmm. it should wait unti it moves farther away before turning the connector back on.

But there may have been recent changes in SE for that. I'll test it again.
sonicrules1234 6 Nov, 2017 @ 4:35pm 
Yep, that fixes it. Last thing, I don't know if it's a bug with my computer or not, as it happens to me too sometimes. When I use launch, it unlocks but doesn't thrust in time before the connector magnet turns back on. All I needed was the auto dock, but if you have a solution to the auto launch, that'd be great
Wicorel  [author] 6 Nov, 2017 @ 4:30pm 
The ship is missing the [WCCT] timer so it cannot do precise movements.

I added it and it docked fine.

Please add a timer with [WCCT] in the name that runs the main Craft Control PB with the argument wcct

sonicrules1234 6 Nov, 2017 @ 8:47am 
Ok, finally got back to my computer. The symtoms are a bit different, now it just moves back and forth twisting a bit. Other tests it would just change it's angle. I suppose it's because it has different starting points. I updated the scripts, although I didn't use the new docking script, I used this one. Here's the world:

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1193642494
Wicorel  [author] 5 Nov, 2017 @ 5:38pm 
oh. also make sure to turn on the WCCM timer on Roddy... it was off in that world.
Wicorel  [author] 5 Nov, 2017 @ 5:38pm 
Found and fixed the problem.. Sorry about that.
Script updated.
Wicorel  [author] 5 Nov, 2017 @ 5:16pm 
did yhou also update the Dock script?

I will take a look at the world in a minute.
novacore_ae 5 Nov, 2017 @ 3:38pm 
Confirming updated Small Void world at https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1163110234

Focusing on the ship at co-ordinates x = -4364.52, y = -2230.71, z = -990.45 ('Rowdy Roddy' with 'Lobster'), updating the Master Control script and Ant Receive on both ships does not affect behavior of docking.

Adding to tom's description below, we've found that Dock script V3.0L performs as per our previous discussions over at the now outdated DockMGR script; also as you know V3.0S would complete the docking sequence but not launch properly.
V3.0T2 no longer completes the docking sequence, and further testing shows that it, like V3.0S, no longer thrusts away from the dock.

Thanks again, dude, you've been racking up some serious Kudos Points with your efforts here!
Wicorel  [author] 5 Nov, 2017 @ 2:21pm 
hmm. ok. I'll check back in a bit to see if it's updated.
tom 5 Nov, 2017 @ 2:18pm 
Hi Wicorel,

We are finding a problem with the updated scripts... updating the craft control and and ant receive scripts is working fine but when we update the dock script on the drone it is not able to dock with its mothership.

it sits there with repeated messages on the pb dock that it knows its mothership but it doesn't start to dock when the godock command is issued. Ant receive shows 'no [BASE] connectors'

There are [BASE] connectors on the mothership and if we revert the pb dock code to an earlier version it works fine.

Think novacore is going to upload a new version of the test world to demo it.

Wicorel  [author] 30 Oct, 2017 @ 9:44pm 
Ah, there's the "problem". The dock request and reponse don't limit themselves. so whoever is first message received is the dock that is used..

This may also tie up docking ports on bases that think a ship should be in-bound.. I'll have to do major changes to fix all that.

Also: you should check out the NAV sub-module. It lets you move the ship easily with just program arguments: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=797020890
Wicorel  [author] 30 Oct, 2017 @ 8:07pm 
Camera naming shouldn't matter. Except if it has [VIEW] in the name/CustomData then the camera scanner code won't use the camera.

The sensors do need to be facing 'front/up' for the sensors to be manage correctly.. That's a limitation of my script currently
tom 30 Oct, 2017 @ 5:06am 
for what its worth as we've been testing this a lot recently...

i found that i needed to use the exact same camera / sensor layout and named them the same as on one of wicorels mining ships. e.g Camera Front Scan (possibly not necessary)

Any additional cameras on the ship must be turned off during docking or launch sequences, sensors the same i think otherwise it causes navigation issues.

We have ported this setup on to a few different ships now and it works consistantly for us if we keep that layout, naming and other sensors/cameras off

Make sure the miner and base connecters have [DOCK] and [BASE] respectively.
Wicorel  [author] 24 Oct, 2017 @ 9:42pm 
maybe the sensors are hitting part of your ship? Do you have a world I can look at to see what's going on?
sonicrules1234 24 Oct, 2017 @ 9:14am 
I put a bunch of camera's and sensors on it, and reverted it so that it uses the back part for the connector again, and cleared out the mobile base. It'll approach the connector, flip around a couple times, fly out, and repeat. It gets pretty close to the connector, but not all the way. What am I doing wrong?
Wicorel  [author] 21 Oct, 2017 @ 3:56pm 
It does have collision detection/avoidance, but it needs camera and sensors.
sonicrules1234 21 Oct, 2017 @ 12:13pm 
So I tried having my mining ship dock with this script, but it just crashes into my mobile base on the way there. Does this have collision avoidance?
Wicorel  [author] 15 Sep, 2017 @ 12:09pm 
gravity, no. This script doesn't handle orbital descent. I have a seperate script for that.
FPC 15 Sep, 2017 @ 7:29am 
Awesome! So to confirm- This and the dock manager can be used to have a transport ship go back and forth between a connector in space and a connector in gravity, continuously?
Wicorel  [author] 15 Sep, 2017 @ 6:40am 
I do have a version that works, but it looks like I haven't updated the workshop in a while. The workshop version likely DOES work still. The mother ship needs to have the DOCK MGR script.