Space Engineers

Space Engineers

Not enough ratings
Wico Modular Navigation (WMNav)
   
Award
Favorite
Favorited
Unfavorite
Tags: autopilot
File Size
Posted
Updated
497.278 KB
24 Apr, 2020 @ 5:25pm
12 May, 2022 @ 8:50pm
10 Change Notes ( view )

Subscribe to download
Wico Modular Navigation (WMNav)

Description
Fourth generation of my scripts.

Navigation: autopilot with collision detection and avoidance.

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.

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.

autopatrol toggles automatically starting a patrol when commands are ended

patrol follows the waypoints in a remote control in order. Once unless autopatrol is on


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

20 Comments
Mad Doctor Tolliver 16 May, 2022 @ 1:26am 
As of now, the only potential oddities I can find are a notable lack of collision detection on planets (even with working cameras and sensors and proper settings enabled in the Custom Data), and that the script seems to hate the idea of having a minimum altitude set in the Custom Data. Every time I have the altitude set to 0, everything works correctly. However, changing that number causes the navigation systems to become wonky. This could be an issue of correlation and not causation, but it seems to be worth mentioning. Beyond that, the script is working extremely well, and I greatly appreciate your hard work in creating it.
Wicorel  [author] 12 May, 2022 @ 8:52pm 
Parameter in CustomData is MaxWorldMps
Wicorel  [author] 12 May, 2022 @ 8:50pm 
Written, minor testing and updated.

You'll need to change the SpeedMax parameter in CustomData and also specify the higher speed in the nav commands
Mad Doctor Tolliver 11 May, 2022 @ 8:15pm 
@Wicorel I'm using Configurable Parameters, but I'll also do a test or two with a different speed mod. I suspect part of the issue is some stubborn memory storage that doesn't want to be modified after the first run. Some of the issues I have will get resolved by removing and rebuilding the programmable block itself. I'll do further testing and update you.
Wicorel  [author] 11 May, 2022 @ 7:53am 
hmm. which mod are you using to increase speed? I'll test with that.
Mad Doctor Tolliver 10 May, 2022 @ 8:50pm 
So far, no major issues with navigation within or outside of gravity. The script is doing an excellent job, and I'm excited to work with it further.

One odd thing, though, is the apparent inability to set the maximum travel speed to a number higher than 100 m/s. Also, running "S 0" apparently enforces the max speed to in fact be 0 m/s instead of removing the limit.
Wicorel  [author] 9 May, 2022 @ 7:49pm 
Updated yesterday to fix the issues with navigating in gravity.

Let me know if anybody finds any more problems or has feature requests.
Mad Doctor Tolliver 3 May, 2022 @ 11:26pm 
@Wicorel Sorry to hear that it's being a problem. I'm greatly looking forward to using this script as a drone autopilot whenever it gets fixed. Outside of the glitchiness, your script is, I believe, the best autopilot I've found to date.
Wicorel  [author] 3 May, 2022 @ 8:41pm 
some luck, yes. but I found more issues.

Seems like I hadn't tested in gravity for a while.. :(

(and I have busy work schedule recently)
Mad Doctor Tolliver 2 May, 2022 @ 7:14pm 
@Wicorel Have you had any luck with the script weirdness? If not, that's totally fine. I was just curious.