Space Engineers

Space Engineers

Not enough ratings
[SUPERCEDED] Nav Dock Wico Modular
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
104.714 KB
25 Mar, 2020 @ 5:44pm
31 Mar, 2020 @ 4:35pm
3 Change Notes ( view )

Subscribe to download
[SUPERCEDED] Nav Dock Wico Modular

Description
Too big to fit into one script, so I had to split back into two.

NAV: https://steamproxy.net/sharedfiles/filedetails/?id=2073024104
DOCK: https://steamproxy.net/sharedfiles/filedetails/?id=2073024363

------

Fourth generation of my scripts.

Combines my Docking and Navigation modules into one big script.

Navigation: autopilot with collision detection and avoidance.
Space Dock: Docking to dynamic connectors. Requires 'base' to have script to communicate connector locations.

Dock Instructions

Dock module requires the Navigation module to move long distances. They are integrated in this script.

When docked, the script will turn off thrusters and try to charge batteries and fill hydrogen tanks.

If relaunch is enabled, then the script will automatically relaunch the ship after the ship is refueled.

Connectors to be used for docking must have [DOCK] in their name or customdata.

If autorefuel is on, then the ship will stop whatever it is doing and go back to a base when the fuel is running low.

NOTE: right now, bases are not asked what they provide for fuel. For example, if the ship uses hydrogen, it is assumed that the base can provide it. I'll add this checking in the future so that bases can specify what they can provide.


Navigation instructions

Multiple instructions can be given in a sequence, separated by semi-colon
or new line. A space is required between the instruction letter and any
parameters you pass to it.

NOTE: currently only one waypoint command can be given; patrols are not (yet) supporte)

C <text>
Comment, to help label your instructions.
Has no effect on the program. Does not count towards instruction limit.

D <distance>
Sets the arrival distance (how close to get to the destination), in meters,
for the next waypoint.
Distance can be a single number, which the ship will try to reach

Distance is measured from the chosen Ship Orientation Block, so if that block is in
the back of your ship, you'll need to increase the arrival distance by at
least the length of your ship (in meters, not blocks).

Default value is 50m.


S <number>
Sets the maximum ship speed, in meters. If set to 0, no limit is enforced.

Default value is 0.

W <coordinates>
Adds a waypoint, at the specified coordinates. Coordinates are a set of
three numbers, separated by commas (i.e. 123,456,-78) or colons
(i.e. 123:456:-78). The last waypoint given (or only waypoint, if only
one given) is the final destination.

GPS Formatted coordinates are also suppoted

O <coordinates>
Orients the FRONT of the ship towards the coordinates.


EXAMPLE:

You can add comments, and you can even set a different speed or distance for
each waypoint:

D 10;patrol
S 45;W GPS:Wicorel #1:-0.51:94.27:-93.73:;W GPS:Wicorel #2:109.91:-384.71:119.44:



Commands can be issued through Programmable Block arguments


Instruction List:
D Distance D min
C Comment C [text]
O Orient O [x,y,z|x;y;z]
W Waypoint W [x,y,z|x;y;z]

L launch from connector (requires dock module)
OL Orbital launch from planet (requires orbital module
dock dock to a connector (requires dock module)
patrol gets waypoints from remote control and follows them in sequence. The max speed is set from the remote control setting

autopatrol toggles the autopatrol flag (automatically restarting patrols). Defaults to off.
refuel toggles the automatic refueling feature (will automatically dock when needed) Defaults to on
relaunch toggles the automatic relaunch feature. Defaults to off (false)

Sensors
The navigation will use a sensor for collision detection. The sensor must have [WICO] in the name or customdata.

Since the sensor will be used to scan forward, it should be placed as far forward in the craft as possible to give the best scanning range.

Cameras

The navigation will use camera raycast for collision detection. All cameras will automaticlly be used.

To stop a camera from being used for raycast (because it is inside the craft or otherwise obstructed) put [VIEW] in the name or customdata

Mainly, cameras on the front (direction of travel) are used. However, when the ship is 'inside' an asteroid, it will pathfind to find an exit; it uses cameras on all sides to do this.

Options

Options are stored in custom data so they can be changed.

The main ones are:

[POWER]
batterypcthigh=80 Battery charge needed before relaunch from connector
batterypctlow=20 Battery charge minimum needed before automatically needing a refuel

[CARGO]
cargopctmin=5

[TANKS]
tankspcthigh=99 Hydrogen tanks fill needed before relaunch from connector
tankspctlow=25 Hydrogen tanks fill minimum needed before automatically needing a refuel

12 Comments
Wicorel  [author] 11 Oct, 2020 @ 9:26am 
set mode 0
will stop all actions and reset the control to the player
Shadowpheonix 11 Oct, 2020 @ 5:18am 
Thank you very much for the quick response. That makes sense and now that I know how it works, I can easily get a naming convention that works for me. :)

One more quick question... Is there a "stop" command to cancel any navigation currently in progress?
Wicorel  [author] 10 Oct, 2020 @ 10:09pm 
It looks for the names of the modules to be in the name. If not found, it creates a name starting with PB.

You can add any other names you like or change the PB to something else.
Shadowpheonix 10 Oct, 2020 @ 10:03pm 
Is there a way I can control the name of the Programmable Block this uses? I am finding it confusing when I have a bunch of "PB Navigation Space Dock" listed in my base's control panel and no way to tell which ships they belong to. :D
Wicorel  [author] 5 Sep, 2020 @ 2:38pm 
No. It is not. It only gets the thrusters fixed on the craft.
Shadowpheonix 4 Sep, 2020 @ 11:03pm 
Is this compatible with rotor based craft? (IE: With ships using Whip's Subgrid Thruster Manager and your Wico Gimbal Rotors ?
Wicorel  [author] 22 Apr, 2020 @ 9:28am 
How large is your ship?

I haven't tested on very large ships.

Can you send me a blueprint of the ship?
FigoPhoenix 22 Apr, 2020 @ 7:15am 
When trying to compile this I am getting an error on the PB: "Script execution terminated, script is too complex. Please edit and rebuild script."

I replaced the PB and reloading the script I am getting the same error kicked back.

Is this because I have multiple seats/controllers? How do I tell the script which controller to use for orienting?
VoidRunner 10 Apr, 2020 @ 10:38am 
Found them!
Info for Other People:

Go to EDIT - You'll be in the Code Editor
Last Button on the right: Browse Scripts - It'll be there
VoidRunner 10 Apr, 2020 @ 10:18am 
Ah Gotcha! I didn't know that difference. Thanks for the clarification :D