Skip to content

BenChung/KRPC.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KRPC

A Julia wrapper library for the KRPC remote procedure call system for Kerbal Space Program.

Example

Setup:

using KRPC
using KRPC.Interface.SpaceCenter.Helpers

KRPC.kerbal_connect("test", "127.0.0.1") do
	# use the connection
end

Get the vessel's current position:

spaceCenter = KRPC.Interface.SpaceCenter.RemoteTypes.SpaceCenter(conn)
vessel = ActiveVessel(spaceCenter)
body_rf = ReferenceFrame(Body(Orbit(vessel)))
println(Position(vessel, body_rf))

Stream the vessel's current position:

spaceCenter = KRPC.Interface.SpaceCenter.RemoteTypes.SpaceCenter(conn)
vessel = ActiveVessel(spaceCenter)
body_rf = ReferenceFrame(Body(Orbit(vessel)))
add_stream(conn, (KRPC.Interface.SpaceCenter.Vessel_Position(vessel, body_rf), )) do stream
	for (position, ) in stream
		println(position)
	end
end