Close

setAttitude and setTranslation

A project log for KAPCOM

Yet another hardware controller for Kerbal Space Program. Leveraging Telemachus, Python and Arduino to drive joysticks, buttons and displays

lawnmowerlattelawnmowerlatte 05/11/2015 at 06:000 Comments

So last night I was brainstorming how best to accomplish multiple configuration modes and I was sorta struggling with how I implemented the joysticks. While it works, it is far from elegant. Each `Joy.toString()` returns a comma separated list of the axes: i.e. -1,-1,-1 or 0,0,0 or 1,1,1 or something in between. Because the Telemachus API only has `setYawPitchRollXYZ`, I have to aggregate both responses into a single API call.

It's not bad, but it makes `Joy0` and `Joy1` special snowflakes and not as easily interchangeable as the rest of the system. If I wanted to implement separate controls for spaceplanes, it'd have to be very specific code and not just reuse what I'm using for all the other devices.

So that got me thinking: maybe I should put in a feature request for this? Unfortunately, the author hasn't been really active recently. I decided to search the repository and see if I couldn't reverse engineer what I needed. It turned out to be a single place in the repository, so I added two separate methods `setAttitude[yaw, pitch, roll]` and `setTranslation[x, y, z]` and submitted a pull request.

This was probably not the right thing to do since I hadn't tested it at all, but I put it out there in the hopes that it might be someday pulled in. This morning I woke up and decided to try my hand at building a mod. Seeing as I had zero experience with this and no environment setup, I started with the Telemachus docs. I did hit some snags.

Anyway, all that said and done, I was able to successfully build Telemachus from source with my new contributions. I'll be using this build from now on and it'll make life MUCH simpler for the planned modal inputs.

Discussions