Search the Community
Showing results for tags 'sensors'.
-
LaserDist LaserDist v1.4.0 for KSP 1.10x. and KSP 1.11.x The only real change here is compiling against KSP 1.10.x DLLs and support for putting LaserDist parts inside the new KSP inventory system. The KSP 1.11.x updates added an EVA inventory system for parts and they require parts have a new "ModuleCargoPart" section added to its Part.cfg files to use it. This release also works on the previous KSP version, KSP 1.10.x too, but it may cause a startup complaint (which it is safe to ignore) in the logs on KSP 1.10.x when it sees the new "ModuleCargoPart" section in the config files. LaserDist v1.3.0 for KSP 1.8.1 Why does this Mod exist? The intended purpose of this part is to be used in conjunction with scripted autopilots like [kOS](https://github.com/KSP-KOS/KOS/releases), to provide a way to for you to write scripted pilot software that can see the distance to the ground (or anything else like a ship) along the laser line. See the image in the picture album to see what its meant by this.The reason this can be useful is so you can detect things like terrain slope and mountains in the way. The default radar altimiter in KSP only shows you the distance directly under the craft. Hey, where'd the pictures go? This post used to contain some embedded images illustrating what LaserDist looks like. They no longer appear because I no longer want to support the IMGUR site due to their awful willingness to let advertisers run whatever Javascript they feel like without properly vetting it for safety. So I pulled my albums off that site. Too many random ad redirects and browser-hijackings on that site for me. If KSP forums support some other image hosting site, I may put the images back but I don't know at the moment how to get the forum to use anything other than IMGUR.\ KSP 1.8 update. No changes to Laserdist except API usage with KSP 1.8. KSP 1.8 deprecated some API calls, replacing them with alternate versions. In particular, the shader used with LineRenderer to draw the laser lines needed to be built with a new kind of constructor. The V1.1.0 update: Another go at fixing the phantom hits bug. See: https://github.com/Dunbaratu/LaserDist/pull/24 The V1.0.0 update: I believe I have finally fixed the phantom hit problems (I found that Squad changed a few of the layer numbers in 1.2.2. My raytracing calls were giving phantom hits to the UI elements and the map view's planets because the layermask that worked fine in 1.1 wasn't right for 1.2.2.) Since the phantom hits problem was the main thing making me consider the mod "not ready", and tha'ts been fixed - I now am moving it to version 1.0. (1.0 also includes a few minor tweaks to the laser visual animation you should barely notice.) Releases, from major download sites: http://mods.curse.com/ksp-mods/kerbal/246141-laserdist https://spacedock.info/mod/765/LaserDist https://github.com/Dunbaratu/LaserDist/releases ZIP Download (See release page above): Source Code Hosting site: * https://github.com/Dunbaratu/LaserDist License: * GPL v3 Copyright (C) 2014,2015,2016 Steven Mading (aka Dunbaratu on Github) [email protected] 100x model This is a very small plugin. It makes a KSP Part that measures straight line distances by laser. The "Beamer 100x Disto-o-meter" Part aims a laser in a lin and then measures the distance in meters to the first object the laser hits. The result is displayed in the right-click menu for the part and can be read by kOS (and other?) script mods. 200x model The "Beamer 200x Bendable Disto-o-meter" Part is the same as the 100x part described above, but it lets you choose a deflection angle with the "Bend X" widget on the slider, (or by using SETFIELD in kOS on it), and the laser can dynamically change it's aim along this one axis. 500x model The "Beamer 500x Aimable Disto-o-meter" Part is the same as the 200x part described above, but it lets you bend the laser in two different axes, to aim it whereever you like within a zone, using both "Bend X" and "Bend Y" settings. All models: The laser can work over long distances - here it's measuring the distance from a Kerbin orbit vessel to the Mun: The direction of the laser is whichever way the laser gun is pointed when you mounted it on the craft. ### Information about the data fields the part displays: ![LaserDist Rightclick panel 1](rightpanel.png) KSPField: 'Distance' is a float - the number of meters being shown in the display. It's -1 if there is currently no hit. KSPField: 'Hit' is a string - the name of the object being hit. KSPField: 'Enabled' is a bool - true if the measuring device is on. KSPField: 'Visible' is a bool - true if the laser should be drawn when it's activated or false if it should be (realistically) invisible because, hey, it's coherent light and it's not supposed to be seen from the side. KSPField: 'CPUGreedyPercent' is a float (called "CPU hog" in the GUI) ranging from 0.0 to 20.0. It's how much of a single physics tick of time this mod will allow itself to consume during a single Update. If it hasn't gotten a good enough answer within that much time, it will wait until the next update to continue the calculation. KSPField: 'UpdateAge' is an integer - It's how many Unity Updates (animation frames, basically) it's been since the value you are seeing was calculated. Because of the logic of CPUGreedyPercent (see above) sometimes the value being displayed is stale by a few update ticks and shouldn't be trusted until the next time that UpdateAge becomes zero again. If you're in a situation where this mod needs to spend more than 1 update of time to get to a good answer for the distance, you'll see this value spinning a bit, quickly going 0,1,2,3,0,1,2,3,0,1,2,3...etc. When you see that, only when it hit the zeros was the distance value perfectly correct at THAT moment. KSPField: 'Bend X' is a float - the number of degrees the laser is deflected in its relative Yaw direction, if it's the type of laser that can be deflected. KSPField: 'Bend Y' is a float - the number of degrees the laser is deflected in its relative Pitch direction, if it's the type of laser that can be deflected. KSPField: 'Max Bend X' is a float - the range of bending the laser can do in its relative Yaw direction. If this is zero, then the laser cannot bend that way. The range is always centered at zero, plus or minus this number. KSPField: 'Max Bend Y' is a float - the range of bending the laser can do in its relative Pitch direction. If this is zero, then the laser cannot bend that way. The range is always centered at zero, plus or minus this number. Note: The higher that CPUGreedyPercent ("CPU hog") is, the less likely it is that UpdateAge will ever be nonzero, but the bigger hit your framerate might take. ### How to Mount it. ![icon of Electronics node](http://wiki.kerbalspaceprogram.com/w/images/d/dd/Electronics.png). The Beamer 100x Dist-o-Meter is located in the "Electronics" tech node of the career tech tree. It's a 300-point node on the tree so you might not have it yet in a new fresh career game. It appears in the science tab of the parts bin. The Laser can be mounted anywhere as a surface-mount item. Take care to note the orientation of the laser emiiter. (KSP lets you fine-tune the rotation of a part by using the SHIFT key while you hit the WASDQE keys.) The Laser will bounce back and give you a distance measurement when it encounters *ANY* object, including parts of your own craft. So take care to mount it somewhere where the laser beam will have a clear line of sight without obstruction. To ensure a good mounting point, you can use "tweakables" to enable the laser and make it show up in the VAB to look and see if you have it aimed well. ### Lightspeed Note that if you use it to measure the distance to a far away body (i.e. like aiming it at Duna from Kerbin), the mod does take into account lightspeed. You have to hold the laser on an object steady and unchange for the entire duration of time it takes for lightspeed delay to bounce the signal back or you won't get a measurement, so using it at that great distance will be very hard. ### How do I use it from my script then? Quick synopsis: Getting a handle on the laser, then turning on the laser using that module: SET laser_module TO SHIP:MODULESNAMED("LaserDistModule")[0]. IF not laser_module:GETFIELD("Enabled") { laser_module:SETFIELD("Enabled",true). } Getting a reading from the laser: SET laser_module TO SHIP:MODULESNAMED("LaserDistModule")[0]. PRINT "Laser distance is measuring " + laser_module:GETFIELD("Distance") + " meters." PRINT "Laser is hitting: " + laser_module:GETFIELD("Hit"). Transforming the laser reading into a 3-D co-ordinate: The part model is designed such that emitter of the laser line is located exactly at the part's local transform origin position, aimed along the part's ``facing:vector`` unit vector, allowing you to get its 3D vector position from a script like so, *Provided you haven't bent the laser with the ``"Bend X"`` or ``"Bend Y"`` settings. If you have bent the laser, then you need to apply these offset angles yourself with an ANGLEAXIS rotation in kOS*: SET laser_module TO SHIP:MODULESNAMED("LaserDistModule")[0]. set dist to laser_module:GETFIELD("Distance"). set emitter_position to laser_module:part:position. set emitter_unit_vec to laser_module:part:facing:vector. set laser_hit_position to emitter_position + (dist * emitter_unit_vec). Laser_hit_position is now a 3D vector position of where the laser hit something To do the same general thing but when the ``Bend X`` and ``Bend Y`` fields are nonzero, rotate the vector around the part's facing unit vectors: SET laser_module TO SHIP:MODULESNAMED("LaserDistModule")[0]. set dist to laser_module:GETFIELD("Distance"). set emitter_position to laser_module:part:position. set emitter_center_vec to laser_module:part:facing:vector. set x_bend to laser_module:GETFIELD("Bend X"). set y_bend to laser_module:GETFIELD("Bend Y"). set bending_rotation to angleaxis(x_bend, laser_module:part:facing:topvector) * angleaxis(y_bend, laser_module:part:facing:starvector). set emitter_unit_vec to bending_rotation * emitter_center_vec. set laser_hit_position to emitter_position + (dist * emitter_unit_vec). . ### Part modeling help? I am aware that the artwork on the model isn't pretty. I'm a programmer, not a graphic artist, and I don't have experience with things like Maya and Blender. In fact I just made the model by slapping together some stretched Cube and Cylnder objects in Unity itself, without the aid of a modeling program. The model is good enough to work with, but I'd be happy to have someone better at art redesign the model. I included the model in the github directory if you want to have a look.
- 77 replies
-
- 14
-
I'm not a treekie really, but I was impressed from this project, https://hackaday.io/project/1395-open-source-science-tricorder , I was looking for a project to learn more electronics, and I'd like to have a suite of sensors, so this could be perfect. In fact I will try first to understand in completely, and then maybe even update it. The original autor is peterjansen In current state has this suite of sensors(c/p from the web of the project): Atmospheric Sensors Ambient Temperature and Humidity: Measurement Specialties HTU21D Ambient Pressure: Bosch Sensortec BMP180 Multi-gas sensor: SGX-Sensortech MICS-6814 Electromagnetic Sensors 3-Axis Magnetometer: Honeywell HMC5883L Lightning sensor: AMS AS3935 X-ray and Gamma Ray Detector: Radiation Watch Type 5 Low-resolution thermal camera: Melexis MLX90620 16×4 Home-built linear polarimeter: 2x TAOS TSL2561 UV: Silicon Labs Si1145 Spectrometer: Hamamatsu C12666MA micro-spectrometer, with NeoPixel light source Spatial Sensors Inertial Measurement Unit: Invensense MPU-9150 9-axis (3-axis accelerometer, gyro, and magnetometer) Other Sensors Microphone: Analog Devices ADMP401 For now I already have the pcbs from OSHpark (I have two spares if someone is interested we can talk), and some of the sensors and the microcontroller that I get in samples ( I would like to express my gratitude for the companies who give me the samples, could a mod concrete if this is permitted in this forum? is a form of advertising in some way) This fairly is not really a cheap project (I myself won't do the spectrometer and thermal camera board for now, because this both are more expensive than every else combined) but I could encourage it as an instrument to teach science to kids and curious people. If this goes well, I MAY sold them in little quantities to help pay me a master (I'm trying to change my career orientation), and try to make it more affordable. Tomorrow I will upload some of the first photos of the pcbs. What do you think about this project?