kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

waypoint mean_altitude incorrect

jj314 opened this issue ยท 1 comments

commented

What happened?

waypoint mean_altitude is incorrect

How can someone else reproduce it?

launch a vessel consisting of just a probe core to the launchpad. Access Kerbnet on the probe core. Create a waypoint via the kerbnet tool window with name test. Note the altitude.

image

Hence the mean_altitude of this waypoint should be 64.8 m.

import krpc

conn = krpc.connect(name='foo')
space_center = conn.space_center
for x in space_center.waypoint_manager.waypoints:
	if x.name == 'test':
		print(x.mean_altitude)

But this code prints 0.0

What is your environment?

krpc 0.5.2

Anything else we need to know?

No response

commented

Thanks for the bug report!

It appears that the altitude is not including the bedrock altitude relative to sea level. I'll get this fixed in the next release, but for now you can use this to get correct values:

import krpc

conn = krpc.connect(name='foo')
space_center = conn.space_center
for x in space_center.waypoint_manager.waypoints:
	if x.name == 'test':
		print(x.mean_altitude + x.body.bedrock_height(x.latitude, x.longitude))