appenz Posted February 15 Share Posted February 15 2 hours ago, WhereAreTheBathrooms said: Hey all, I'm trying to save telemetry data so I can display it in Google Sheets but I'm struggling to figure out how to convert the saved .json to .csv - Sheets does not accept .json formatting for data imports. I have no experience doing this so I don't even know where to start. Online converter tools spit out essentially garbage, or I assume, the data but in a completely different shape to what I need. Can anyone tell me where to begin? Or link a tutorial for this kind of thing? Are you comfortable with (simple) coding? If yes, python is very good at this. For example: https://www.geeksforgeeks.org/convert-json-to-csv-in-python/ As JSON is a more complex structure, there is no 1:1 conversion. You will have to parse through the tree and generate what you want. Quote Link to comment Share on other sites More sharing options...
PhilippeDS Posted February 24 Share Posted February 24 Hello. Is it possible de create a new txt file with Kontrol System 2, and to write/read this file? My ideas: - create a log mission file for each my mission - create a experiment file where I store all the science experiment already done to exclude them for the next flights. Thanks for your answers. Quote Link to comment Share on other sites More sharing options...
PhilippeDS Posted February 25 Share Posted February 25 (edited) I've created this new function using UI. In the UI, you see the current time and you have a button to warp. use { CONSOLE } from ksp::console use { yield, current_time } from ksp::game use { warp_to } from ksp::game::warp use { floor } from core::math use { screen_size, open_window, Align } from ksp::ui pub fn main_editor () -> Unit = { CONSOLE.clear() create_window() } fn create_window() -> Unit = { const myScreen = screen_size() const window_width = myScreen.x/5 const window_height = 50 const main_window = open_window("<b>CURRENT TIME</b>", (myScreen.x-window_width)/2, myScreen.y - 20, window_width, window_height) const hours_per_day = 6 const now_time: Cell<float> = Cell(current_time()) const now_time_days: Cell<float> = Cell(0) now_time_days.value = floor(now_time.value / (hours_per_day*3600)) const days_in_game: Cell<float> = Cell(0) days_in_game.value = now_time_days.value + 1 const now_time_hours: Cell<float> = Cell(0) now_time_hours.value = floor((now_time.value - now_time_days.value*(hours_per_day*3600)) / 3600) const now_time_minutes: Cell<float> = Cell(0) now_time_minutes.value = floor((now_time.value - now_time_hours.value*3600) / 60) const now_time_seconds: Cell<float> = Cell(0) now_time_seconds.value = floor(now_time.value - now_time_hours.value*3600 - now_time_minutes.value*60) const main_box = main_window.add_vertical(10.0, Align.Stretch) const detail_box = main_window.add_horizontal(10.0, Align.Center) main_window.add_spacer(20,0) const warp_box = main_window.add_vertical(10.0, Align.Stretch) const now_time_label = main_box.add_label("Current time (s):", Align.Stretch, now_time.value) now_time_label.bind(now_time, "Current time: {0:N2} s") const days_label = detail_box.add_label("day:", Align.Center) days_label.bind(days_in_game, "{0:N0} d") const hours_label = detail_box.add_label("hour:", Align.Center) hours_label.bind(now_time_hours, "{0:N0} h") const minutes_label = detail_box.add_label("min:", Align.Center) minutes_label.bind(now_time_minutes, "{0:N0} min") const seconds_label = detail_box.add_label("sec:", Align.Center) seconds_label.bind(now_time_seconds, "{0:N0} s") const warp_input_box = warp_box.add_horizontal(10.0, Align.Stretch, 10.0) const warp_label = warp_input_box.add_label("Warp (in seconds):", Align.Start) const warp_value = warp_input_box.add_float_input(Align.Start, 10.0) warp_value.value = 0 const warp_button = warp_box.add_button("WARP", Align.Center) warp_button.on_click(fn() -> { const now = current_time() const deltaT = warp_value.value warp_to(now + deltaT) }) while(!main_window.is_closed) { now_time.value = current_time() now_time_days.value = floor(now_time.value / (hours_per_day*3600)) days_in_game.value = now_time_days.value + 1 now_time_hours.value = floor((now_time.value - now_time_days.value*(hours_per_day*3600)) / 3600) now_time_minutes.value = floor((now_time.value - now_time_days.value*(hours_per_day*3600) - now_time_hours.value*3600) / 60) now_time_seconds.value = floor(now_time.value - now_time_days.value*(hours_per_day*3600) - now_time_hours.value*3600 - now_time_minutes.value*60) yield() } } Edited February 25 by PhilippeDS Quote Link to comment Share on other sites More sharing options...
appenz Posted February 26 Share Posted February 26 On 2/24/2024 at 2:14 AM, PhilippeDS said: Hello. Is it possible de create a new txt file with Kontrol System 2, and to write/read this file? My ideas: - create a log mission file for each my mission - create a experiment file where I store all the science experiment already done to exclude them for the next flights. Thanks for your answers. I believe anything you log in the console appears in the KSP.log file. See here: https://kontrolsystem2.readthedocs.io/en/latest/reference/core/logging.html There is no persistent storage for Kontrolsystem2, if that is what you are looking for. Quote Link to comment Share on other sites More sharing options...
PhilippeDS Posted February 29 Share Posted February 29 Hi. I don't really understand the method .perturbed_orbit for an orbit. I don't have the same results than the expected orbit an a node. Is it normal? CONSOLE.clear() const this_obt = vessel.orbit CONSOLE.print_line(this_obt.eccentricity.to_fixed(6)) CONSOLE.print_line(this_obt.periapsis.to_fixed(0)) CONSOLE.print_line(this_obt.apoapsis.value.to_fixed(6)) CONSOLE.move_cursor(CONSOLE.cursor_row + 1,0) let temp_obt = this_obt.perturbed_orbit(this_obt.next_periapsis_time(), vec3(0,0,500)) let new_node = vessel.maneuver.add_burn_vector(this_obt.next_periapsis_time(), vec3(0,0,500)).value CONSOLE.print_line(temp_obt.eccentricity.to_fixed(6)) CONSOLE.print_line(temp_obt.periapsis.to_fixed(0)) CONSOLE.print_line(temp_obt.apoapsis.value.to_fixed(0)) CONSOLE.move_cursor(CONSOLE.cursor_row + 1,0) temp_obt = new_node.expected_orbit CONSOLE.print_line(temp_obt.eccentricity.to_fixed(6)) CONSOLE.print_line(temp_obt.periapsis.to_fixed(0)) CONSOLE.print_line(temp_obt.apoapsis.value.to_fixed(0)) Quote Link to comment Share on other sites More sharing options...
AsteroH Posted March 14 Share Posted March 14 On 2/15/2024 at 7:48 PM, appenz said: Are you comfortable with (simple) coding? If yes, python is very good at this. For example: https://www.geeksforgeeks.org/convert-json-to-csv-in-python/ As JSON is a more complex structure, there is no 1:1 conversion. You will have to parse through the tree and generate what you want. The file isn't recognized by python i think , cause i had this error: JSONDecodeError: Expecting value: line 1 column 1 (char 0) using just a simple code : with open("E:/SteamLibrary/steamapps/common\Kerbal Space Program 2/test.json", 'r') as file: data = json.load(file) Quote Link to comment Share on other sites More sharing options...
appenz Posted March 14 Share Posted March 14 @AsteroH This looks to me like either the file is not even a text file or it is empty. If you post it somewhere, we can take a look. Quote Link to comment Share on other sites More sharing options...
AsteroH Posted March 17 Share Posted March 17 On 3/14/2024 at 8:03 PM, appenz said: @AsteroH This looks to me like either the file is not even a text file or it is empty. If you post it somewhere, we can take a look. It's not a particular file tho, each time i try with a different telemetry file, it displays the same error Quote Link to comment Share on other sites More sharing options...
choxieota Posted March 18 Share Posted March 18 Maybe a dumb question, but is there a way to activate or not skip the in game countdown(voices, water deluge...)? Quote Link to comment Share on other sites More sharing options...
appenz Posted March 18 Share Posted March 18 On 3/17/2024 at 7:08 AM, AsteroH said: It's not a particular file tho, each time i try with a different telemetry file, it displays the same error Understood. Still, if you post it we can have a look. Otherwise it's super hard to debug this. Quote Link to comment Share on other sites More sharing options...
steddyj Posted 4 hours ago Share Posted 4 hours ago @Untoldwind I just noticed that CKAN somehow seems to have 0.5.8.4 as 0.5.9.4, so it did not pick up the update you made the other day (0.5.8.5) as the latest release. It doesn't seem to have indexed it at all, the versions tab show 0.5.8.4 released 4/15/2024 4:03pm and 0.5.9.4 released 2 minutes later. ... and sorry to ping you then ask this question, but the making sure I had done my homework on the question I had led me to discovering that release mismatch. Am I correct in assuming there's no current way to use debug lines in the VAB? It seems to me that there's nothing stopping it, other than it requires a GlobalPosition and GlobalVector. I want to indicate Forward/Right/Up from my command module using the Vec3 relative_position, but I can't find anything to use as a reference to get a valid TransformFrame. I'm assuming that I need an existing Global type to get the TransframeForm from, am I incorrect here? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.