Jump to content

Cbrollin

Members
  • Posts

    5
  • Joined

  • Last visited

Reputation

15 Good

Profile Information

  • About me
    Bottle Rocketeer

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Yeah, I really wanted the staging button to do that. The button was hard to find though. Not many people selling yellow. Got it from adafruit. So the enclosure is built from the metal sides of an old computer case and some wood. Just what I had laying around. I just had to cut the Saitek in half, and solder some longer wires to the potentiometer for the throttle. Then I just put some screws straight into the plastic of the controller. I will try to get some pictures of the inside later, though it isnt pretty. Yeah. The other student that is also doing a controller got a Due to do his project. A lot more I/O pins. Im kinda jealous. I have limited funds though, with a wife and kid, so I had to work with what I had laying around at first. I already had an Uno, and the MCP23017 chips give me 16 more IO pins per chip at about 3 dollars a chip. So that was cheaper for me. The only thing is that I am not sure how the code is gonna look once I add the second IO chip. I am currently using an MCP library from adafruit. Next time I post some code, I will go for the spoiler look. More clean for sure.
  2. So this summer, I and a fellow grad student decided to both work on making a controller for Kerbal Space Program. My controller has all of the main functions working now, so I thought I would post the progress so far. Current Progress Credit I have zitronen to thank for his excellent plugin and tutorial on the arduino working with KSP. You can find his page here. I was very much inspired by the K.E.E.B. controller made by Luis, and took many of my ideas from his design. I took a look at Odysseus by Sputnix. It is very clean and an excellent design. I will probably implement some of his design elements in my controller as it progresses. I also liked the form of Sputnix's forum post, and I am trying to emulate that here. Also, thanks to all on the forums for all your wonderful ideas and knowledge, especially in C# and arduino coding. FunctionsThe main joystick is just a Saitek ST290 chopped in half. I figured it was easier to use an existing joystick than having to wire it up to the arduino and code it. This handles main flight, rotation, yaw and pitch. This also handles the throttle. It also means this will take up 2 USB ports instead of 1. Thank goodness for powered USB hubs. The small center joystick is a work in progress. It is the only thing currently not wired up. It is a small hat switch that will be used for translation movements for docking. The 5 red buttons handle SAS, RCS, Lights, gears, and brakes. They are backlit by LEDs and display the current in game status, regardless of the switch position. The red arm switch is essentially a stage lock. The yellow staging button is only active when the arm switch is armed. The yellow staging button launches and stages the rocket. It blinks similar to the LED on the in game staging panel. It blinks when the rocket is on the launch pad. When in flight it is solid until there are no stages left. When there are no stages left, or the arming switch isnt armed, the light is off. The blue switch opens Map View, and is lit up when in Map View. Finally, the LCD displays information from the game. I currently have it only displaying altitude and velocity. I would like to add a selector switch to change between different information. I would also like to add the functionality to display sci notation with units instead of a very large number. The next things I am going to add are a few buttons to switch between staging, docking, and maybe horizontal flight modes. I also need to add a handle for the top of the throttle. Parts 1x Arduino Uno R3 1x Saitek St290 1x old computer case (for the metal) 1x MCP23017 I/O expander - adding another later, link, arduino code library, you can also get them cheaper here 5x Red Latching Illuminated buttons - link 1x Toggle switch with Missile cover - here and here 1x Yellow momentary illuminated button - link 1x Blue momentary illuminated button - link 1x hat switch - salvaged from another old joystick 1x 16x2 LCD screen I will add links to these and to the other things that I used
  3. Man. I love your setup. Very cleanly done. I love the handles. I guess I need to make a trip to the hardware store to look at handles and see if I can find something that will work for my setup.
  4. Thanks. I am going to try to look at switching between docking and staging also, since I would like that to be implemented in my controller. Also, I dont know much about the serial side, but I did assume that there was some maximum packet size. Is there some hard limit on how many variables we will be able to put in VesselData? Just wondering so I can maybe consolidate some of the variables I created. Ok. My code is below. added to VesselData public int CurrentStage; //51 Cbrollins code here - Current stage, total stage and map status public int TotalStage; //52 public int MapStatus; //53 I used the public byte Mode to transmit the state for the map button added to struct VesselControls public Boolean MapMode; //Cbrollin - used in Map code later on. We may be able to use an int and convert the correct bit to a boolean added to private void VesselControls() VControls.MapMode = BitMathByte(CPacket.Mode, 2); //Cbrollin - I added this to convert the correct byte in Mode to a boolean. There is corresponding code in the arduino portion as well added to void Update - #region outputs KSPSerialPort.VData.CurrentStage = (int)Staging.CurrentStage; // Cbrollin - here is where we get the info from the staging class KSPSerialPort.VData.TotalStage = (int)Staging.StageCount; KSPSerialPort.VData.MapStatus = (int)Convert.ToInt32(MapView.MapIsEnabled); //Cbrollin - Getting info on Map status from MapView class added to void Update - #region inputs //Cbrollin - Implementing changing to Map View using MapView class - this should be compatible with Zitronens Mode usage for stage, docking, map, etc if (KSPSerialPort.VControls.MapMode != KSPSerialPort.VControlsOld.MapMode && KSPSerialPort.VData.MapStatus == 0) { MapView.EnterMapView(); KSPSerialPort.VControlsOld.MapMode = KSPSerialPort.VControls.MapMode; } else if (KSPSerialPort.VControls.MapMode != KSPSerialPort.VControlsOld.MapMode && KSPSerialPort.VData.MapStatus == 1) //Checking both Mode status and Map status so the ExitMapView isnt called constantly { MapView.ExitMapView(); KSPSerialPort.VControlsOld.MapMode = KSPSerialPort.VControls.MapMode; } Then I had to add corresponding code in the arduino code, variables and whatnot. This is added to output - void controls, with some debouncing because I have a momentary switch. Also for regular arduino, it should just be digitalRead(MAPPIN). The mcp is because I am using an IO expander. readingMap = mcp.digitalRead(MAPPIN); if (readingMap == LOW && previousMap == HIGH && millis() - time > debounce) { if (VData.MapStatus == 1) Mode(MAP, LOW); else Mode(MAP, HIGH); } previousMap = readingMap; Then I had to add another section to output void Mode(byte n, boolean s) { if (s) CPacket.Mode |= (1 << n); // forces nth bit of x to be 1. all other bits left alone. else CPacket.Mode &= ~(1 << n); // forces nth bit of x to be 0. all other bits left alone. } That is all that I have really changed so far.
  5. Hello everybody, First off I would like to say that this is an awesome plugin, and has helped me so much. Thanks zitronen and all who have contributed!! I am in the process of building a controller/display (why else would I need this plugin). I have a couple of illuminated buttons that I wanted to display info from the game. As in the staging button will reflect the staging light that blinks in game. Also, I wanted a map mode button which would light up when in the Map. I know that map view hasnt been implemented yet. So I took it upon myself to get into the code and mess around a bit. I have edited the plugin to receive info from the Staging and MapView classes. The stage button blinks when on the ground, is solid when flying and there is another stage left, and is unlit when there are no stages left. I put in 2 new variables into VesselData to reflect TotalStage and CurrentStage. I also got Map View to work mostly. It is still a little buggy. You can enter and exit Map View by calling MapView.EnterMapView() or MapView.ExitMapView(). The only issue I am having is if you enter Map mode using the game interface (using the mouse), and try to exit using the button, it doesnt work. Otherwise the button will enter and exit Map mode fine. I am pretty new to forums in general, but I can try to post the snippits of code that I added.
×
×
  • Create New...