Space Engineers

Space Engineers

220 ratings
"Behind you" drone-companion script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
1.840 MB
Feb 23, 2016 @ 3:55pm
Apr 19, 2022 @ 8:55am
37 Change Notes ( view )

Subscribe to download
"Behind you" drone-companion script

Description
Hello everyone!

WARNING!
Finally I rewrote script from the scratch! I tried to optimise internal script structure, so it became lighter both in terms of symbols and system load.

Short description
With help of this script you could create your own drone-companion, that can follow you, remember it's connection point, remember path to it. It has obstacle detection and can work in natural gravity field correctly.

Current functions:
-Follows directly to the target (target point could be configured).
-Remembers target movements and follow them.
-Remembers connection points. Up to 2, for cargo transfer, as example.
-Remembers own movements and reply them to follow from start point to end point. Could be combined with connection points to create full route form one to another.
-Lands drone on safe speed level by command.
-Has simplified landing sequence, if drone was started fom connector.
-Checks path for obstacles and stops the drone until route is safe again (need cameras for it).
-Optimises remembered waypoints an deletes unnecessary.
-Shows own status, using Beacon or Antenna.
-Shows own mode, using any light source (interior Light, Spotlight or Text Panel).
-Has automatic calculation of thrust vector for correct movement.
-Has automatic calculation of gyros override, according to drone's directions.
-Corrects work in natural gravity field (Bottom thrusters always look down, parallel to gravity vector).
-Can use landing gears to connect/disconnect together with connector, determinated for this script.
-Decreases calculation rate, while waiting or parked.
-...

Short installation guide:
Scroll down and you will find...

Vital/Non-vital blocks:
Minimal setup (vital):
-Programmable block (for script).
-Remote Control block (used for calculating drone's direction and position)
-Sensor for target detecting (detect player for following)

Appendixes, determinated in the script:
All blocks, used by script (gyros, thrusters, sensor, etc.) should have "_Follow" in the name.

Optimal setup(not so vital, but useful)
-full list above
-Cameras (obstacle detection).
-Text panel (external memory, helps to remember waypoints, connection points)
-Antenna or Beacon (for staus information)
-Connector for auto drop/take/transfer goods (separate connector only for this function)

Script parameters:
You can find this parameters in the beginning of the script. They could be changed to your own needs.

Name appendix (for searching blocks on a grid):
Name_Appendix - suffix for all Terminal blocks, used by this script

Variables for fine tuning:
Follow_Distance - drone tries to follow target on that distance + 1/2 of the drone's grid bounding box.
Follow_Height - minimal height between your position (player's position calculates somewhere near feets) and follow point for the drone + 1/4 of the drone's grid bounding box..
Maximum_Speed - mximum speed to follow you.
Minimal_Speed - minimal safe speed to follow you.

Commands for programmable block
You can type commands directly to the argument box in programmable block, but i recommend you to use Button Panels.

"start" - starts script to runs itself. Initial boot.
"stop" - typed once, stops script. Typed twice, resets parameters.
"follow" - switch on/off follow mode for drone.
"pause" - pauses current mode.
"land" - push drone directly down on a safe speed (parallel to natural gravity vector, if it's exist).
WP commands works only if you install text panel!
"wp" or "wp:s" - if drone has no remembered waypoints, it starts to write them to external memory. if it's currently write waypoints, it stops process. If it has pre-written waypoints, it starts to follow them.
"wp:c" - if drone is not writing waypoints at this moment, it starts/continue to write them to external memory. if it's currently write waypoints, it stops process.
"wp:d" - deletes all waypoints and connection points.
"wp:r" - if drone is currently in follow waypoints mode, it reverses current follow waypoints mode (forward to reverse, and vice versa).

Connector's automation:
Automation for connector works only if you install text panel!
if you have connector and want drone to drop/take/transfer goods, you should use correct name appendix.
This connector can initiate four events for drone:
-connector was locked - shut down thrusters, reset gyros override, switch to "Parked" mode.
-connector was locked and drone writes own waypoints - same as above and stops to write waypoints and write final connection point to the external memory.
-connector was unlocked and no waypoints in the external memory - it start to write waypoints and write first connection point to external memory.
-connector was unlocked and drone has waypoints in the external memory - switch to follow waypoints mode and checks, which direction drone should fly.

Updates:
Updates


Examples:
Simple drone ion thrusters
Large drone ion thrusters
Simple drone atmo thrusters
Cargo drone atmo thrusters
Companion (player defender)
...

Big thanks to:
tachweave W.A.L.I. - W.A.L.I.3 был крут!
MMaster Configurable Automatic LCDs
d4rky1989 Multipurpose Filter and Control Block
Alysius Cruise Missile Demonstration
Pennywise Guided torpedo carrier
Popular Discussions View All (4)
4
Oct 12, 2019 @ 11:16am
Bug report : drone flying into the sky (detailed)
Switch
4
Oct 14, 2017 @ 7:10pm
bug: atmospheric drone suddenly flying upward without stopping
Enkar
0
Dec 15, 2019 @ 6:57pm
Camera obstacle detection / landing in planets? / Confusion in general
Roasty my Toasty
423 Comments
Skleroz  [author] Dec 2, 2022 @ 2:27am 
@jivaii Yes, script works with thrusters.
jivaii Dec 2, 2022 @ 1:06am 
I take it this only works for flying drones, not rover drones?
Skleroz  [author] Oct 30, 2022 @ 1:43am 
@CDR.Kitten Good news! Glad to to hear that script is working again
User error is totally normal, without error will be no progress XD
CDR.Kitten Oct 29, 2022 @ 8:14pm 
The script works fine after having built a new one from scratch. I think it's just some weirdness when trying to update the ship. Most likely it's my own user error honestly. XD
Skleroz  [author] Oct 29, 2022 @ 11:35am 
@CDR.Kitten I have an idea. Script calculates average runtime in terminal?
Skleroz  [author] Oct 29, 2022 @ 11:31am 
Well, this kinda strange, until it has thrusters, gyros, sensor and some type of control block with "_Follow" appendix, it should work. At least, it works in my local example world. Script needs text panel of the PB, it could be an issue, when PB replaced by modded one.
CDR.Kitten Oct 28, 2022 @ 3:32am 
Yeah my old BB was from Aug-2020. It served me well until I realized the script has been overhauled. I swear, time flies when you're having fun. :D I did try to throw in the new appendix but the whole girl was like, way too old. I decided to mothball my BB-02. I mean, to give an example her antenna was like An0.follow and a bunch of old stuff back when times were simplier and a bit more buggy. :D
Skleroz  [author] Oct 28, 2022 @ 12:05am 
@CDR.Kitten Hi! "program.V is not used..." - this is just warning, it shouldn't break anything. In old versions there were a lot of unused variables in the code =)
Regarding version changes - if I remember correctly, there were several appendix changes? it could source of the problem. In the actual version for all terminal blocks used by the script appendix "_Follow" have to be applied. Hope this will help!
CDR.Kitten Oct 27, 2022 @ 11:20pm 
Heyoh. I'm getting a, program.V is not used error on code-check.Not sure if impacts anything but, after having updated my drone from an ancient version of the code, she's not too keen on doing anything haha.
Skleroz  [author] Oct 10, 2022 @ 10:38am 
@Shadaris Hi! Custom turret controller doesn't work without full setup. Theoretically you could install two rotors and camera but it makes grid too complicated.