Live data from Hacker News

Show HN: SpaceX Dragon simulator docking autopilot in Clojure

github.com

11–20 of 38 posts

Re: Show HN: SpaceX Dragon simulator docking autopilot in Clojure

#11

https://www.reddit.com/r/spacex/comments/gigmfh/spacex_iss_d... does it in one line but it's kind of cheating.

Definitely cheating, it's not autopilot. It is just updating your co-ordinates every 500ms on a straight line.

I would like to see a real autopilot written in javascript that you can paste into the console.

Re: Show HN: SpaceX Dragon simulator docking autopilot in Clojure

#15

https://www.reddit.com/r/spacex/comments/gigmfh/spacex_iss_d... does it in one line but it's kind of cheating.

Definitely cheating, it's not autopilot. It is just updating your co-ordinates every 500ms on a straight line. I would like to see a real autopilot written in javascript that you can paste into the console.

It's cheating but not as much. It's setting the "motion vector" aka setting the speed at current instant. It's just skipping the controls which are normally setting the "motion vector". For the orientation it's totally cheating though using camera.lookat(target).

Re: Show HN: SpaceX Dragon simulator docking autopilot in Clojure

#16

https://www.reddit.com/r/spacex/comments/gigmfh/spacex_iss_d... does it in one line but it's kind of cheating.

Definitely cheating, it's not autopilot. It is just updating your co-ordinates every 500ms on a straight line. I would like to see a real autopilot written in javascript that you can paste into the console.

I wrote an autopilot[0] for the simulator in JS, which sends key events to the game.

[0]: https://gist.github.com/ForestKatsch/01069f29e8316df11774025...

Re: Show HN: SpaceX Dragon simulator docking autopilot in Clojure

#17
post #6

I have a question about control flow of the overall system. Note that I haven't actually run this or debugged it. Or frankly, thought about it for more than a minute or two. Its more of an architectural question. So in dragon.clj there's a case statement to execute commands in the translate function such that the command to go down or left in an abstract calculated sense is implemented as hitting a virtual down or le…

Heh, never thought about it that way! But good question. Yes, it can translate on 2 axes at the same time, since the control loops for each axis run in separate threads, so there is no control locking. The same is with rotation - it can e.g. pitch, roll and yaw at the same time.

Just from a layman, this is so freaking cool, thank you for writing it and sharing it!

Re: Show HN: SpaceX Dragon simulator docking autopilot in Clojure

#19

OK so yes the ISS docking sim is old news, but good lord do I love that UX. I really hope someone has modded it into Kerbal Space Program!

It's definitely easier to read than KSP's navigation ball.

KSP was also 100% the reason I managed dock with the simulator on the first try, because in a way it was more like the 50th-100th try, just using a different interface.

Re: Show HN: SpaceX Dragon simulator docking autopilot in Clojure

#20
Not to say this is bad or incorrect, but this is very unidiomatic Clojure. I would question the amount of global state, and the broad use of loops inside threads. This can’t be fun to try and test!

Perhaps better would be to make pure functions to take current telemetry as an argument and return actions as outputs, perhaps all at once or more likely individually for each control. You could then capture all of this inside core.async go-loops to manage the control flow and timeouts, but you could also probably build something simple with one or more agents wrapping the current state and updating a set of commands to be executed later. Another argument for core.async would be to make it easier to funnel all commands into a single channel because I’m not entirely convinced a WebDriver is multithreaded, but perhaps the library manages that for you.

Anyway, cool stuff!

Post reply on HN