Grapenut Autopilot Console

From HSpace

Jump to: navigation, search

Grapenut said:

People clamor for autopilot help, so I made this(I thought i made one already?) It must be added as a console to the ship. Once added, use init to have it set itself as the controller for the ship's autopilot system(must add this before).
engage/disengage - whether or not the AP has control of the ship. AP will auto disengage if you manually set the ship heading or speed.
waypoint * * * - set the destination for the autopilot
range * - set the range to halt within(default 1)
xydrift * - set the max drift in degrees on the xy axis(default 1)
zdrift * - set the max drift in degrees on the z axis(default 1)
cpower on/off - to turn on the console
maxspeed - limit autopilot speed (default max engine speed)
You could make yourself a non-console version if you wanted to conserve computer power. Use hs_sysset() on the ENGAGED attribute instead of @nav/autopilot. You should generally leave the range and drifts alone, unless you encounter problems(loops, misses, etc). The HSDATA_DESTINATION is a trigger, currently it just emits that the ship has arrived at the set waypoint. You could get elaborate and make it autoland at a planet, switch to next leg of a trip, etc.

@create AP Control
@lock/Basic AP Control==me
@set AP Control = SAFE
@set AP Control = WIZARD
@set AP Control = !NO_COMMAND
&CMD_CPOWER_OFF AP Control=$cpower off:@console/power 0;&hsdb_console_power %!=0
&CMD_CPOWER_ON AP Control=$cpower on:@console/power 1;&hsdb_console_power %!=1
&CMD_DISENGAGE AP Control=$disengage:@nav/autopilot 0
&CMD_ENGAGE AP Control=$engage:@nav/autopilot 1
&CMD_INIT AP Control=$init:@pemit %#=hs_sysset(v(hsdb_owner)/autopilot,CONTROLLER:%!)
&CMD_RANGE AP Control=$range *:@pemit %#=set(%!,HSDATA_RANGE:%0)Range set.
&CMD_WAYPOINT AP Control=$waypoint * * *:@pemit %#=set(%!,HSDATA_X:%0)[set(%!,HSDATA_Y:%1)][set(%!,HSDATA_Z:%2)]Waypoint set.
&CMD_XYDRIFT AP Control=$xydrift *:@pemit %#=set(%!,HSDATA_XYDRIFT:%0)XYDrift set.
&CMD_ZDRIFT AP Control=$zdrift *:@pemit %#=set(%!,HSDATA_ZDRIFT:%0)ZDrift set.
&HSDATA_DESTINATION AP Control=@emit The ship has arrived at waypoint [v(hsdata_x)] [v(hsdata_y)] [v(hsdata_z)].
&HSDATA_RANGE AP Control=1
&HSDATA_X AP Control=0
&HSDATA_XYDRIFT AP Control=1
&HSDATA_Y AP Control=0
&HSDATA_Z AP Control=0
&HSDATA_ZDRIFT AP Control=1 

Views
Personal tools