VR_Dev

Members
  • Content Count

    1,016
  • Joined

  • Last visited

Community Reputation

878 Excellent

About VR_Dev

Contact Methods

  • Website URL https://www.youtube.com/channel/UCx4Fn6LeGOW4cKUZ2iU79-g

Recent Profile Visitors

2,591 profile views
  1. VR_Dev

    [WIP] Unity Editor Plugin

    Hey guys I really appreciate all the insight in this thread. This week has been super busy at work so I haven't had time to keep up with all the questions. Also haven't had much time to put into the hexapod, but I do have it looking more like its old self though. Just like the first time around tuning is equally as important as the walking algorithm itself. The major improvements came from shortening up the stride length, and not changing targets til the foot has ground contact (Calculated from raycast). Also adding some more weight. Next big project is to set the steering PID to adjust stride length to keep it walking in a straight line. Even if you don't understand any of the code there is also lots of design options that could be testing for advantages/disadvantages. You can alter the design of the craft(including the legs) pretty substantially and the code will still work. I'm also in the process of making it easier to tune. In this video I have also added engines back into the feet. My plan is for this to fly as well, so the weight needs to be taken into account. I definitely need to implement something with more control over the speed of the two strides. I go into this more below. Oh boy I don't think I have a license specified yet. Whichever the free to use one is. PID controllers are used to control the speed of each servo based on the error between the mirror (ksp servo) and IK servo. A PID is also used to adjust the stride length to keep it walking in a straight line(not implemented yet). I go into it further below. Yeah the IK is sound, now its time to dive into the gait improvements. Yeah I have a two step gait, with 3 legs translating backwards while the other three arc forward to the target position. @Hooligan Labs thanks a lot for taking the time to look into my code, and type up such an in depth response. The stuff on the PID was exceptionally helpful. The code above actually adjusts the target IK point to get the base of the arm at the correct height. If the base is .5m below its target, the IK target gets placed .5m below the ground, so the arm will push itself up trying to get to the below ground target. You can see in some of my old videos how I can control the height and angle of the body by adjusting these base targets. You can see here I was only doing that when the foot was translating across the ground, but now it will adjust its height when it is at its target position as well. Part of the snapping problem is when the target snapped from 0m above the ground to -.5m below the ground. It would probably be better to lerp this as well. If you are referring to the box that is above the start position of the foot, that is left over from trying to use a target for the arc rotation. Now I just use a unity cheat to move the target in an arc. I just set the parent of the target at 0, and the target at the back or front position. The I lerp the parents rotation (factoring in walk speed) to get a nice arc that naturally slows as its nearing its target. The built in slow down of lerp doesn't seem to slow the foot enough however. I think the next step is to control the speed of the arc manually so that i can adjust when and by how much it slows as it gets closer to its target. This gets into what @ZodiusInfuser was saying about the time step. Right now I just try to manually adjust the speed of the rotation and translate so that the two groups of feet hit their target at the same time, but it would be much better to calculate the distance of both the straight line and arc, and set the speed accordingly, taking into account the slow down required on the rotation. One other thought about the rotation target is to have the target be slightly above the ground. Then the arm does a full rotation really fast to get to that point, then gently set itself down. Pretty embarrassed I pushed those values up. I usually start with .1f,0,0 and move around from there. The high D was just and experiment to see if that would slow the arm enough to keep the foot from exploding. I still don't have a super clear understanding of PID tuning (your explanation def helps) but I don't think I'm half bad. My f-22 racers use a bunch of them. So the PID loops are only controlling the speed of the servos, there is no PID that affects the gait (except for steering which shortens the gait as needed for turning. That isn't working in this version yet). Each servo has a PID which sets the speed according to the error between the mirror servo (KSP) and the IK leg servo. Mirror and IK arms are identical in the unity editor, the one lagging behind is always the mirror. I could just set the servo speed at max, but its nice to have the damping so it doesn't overshoot at the peak of the arc. The servos PID values should be different for the rotate and translate stride however. As I mentioned above, the gait probably has the most room for improvement, and I have a couple of different things to try. I'll definitely try out some of your suggestions. This is a problem I need to fix in the new System. If you watch the old videos, I used a sensor part to tell the system "this is the foot", and I shot a raycast straight down from that position to calculate ground clearance. The raycast ignored Parts and only looked for the layer that KSP considers the ground. In the new system I wanted the arm to calculate its endpoint automatically. So the wrist servo measures all the vertices in all the meshes attached to it, and uses the furthest Y distance to set the contact point. This worked really well, except for sometimes that point clips below the ground mesh and the value is wrong. Now I use the same raycast, but from the servo transform. Then I set the ground(white plane) that distance below the identical servo in Unity. I calculate the clearance by subtracting the clearance from the servo to the foot position from the servo to the ground position. This works ok but is definitely worse, especially on a gradient. This def needs to be improved. This is the api call that used to work as well. Not having any luck with it now though. bool GroundContact Whether this part is currently in contact with the solid surface of a CelestialBody.
  2. VR_Dev

    [WIP] Unity Editor Plugin

    https://github.com/carter-james89/KSP-Unity-Editor-Plugin alpha 6 - activates IK alpha 7 - begin walking Must be focused on Unity game window
  3. VR_Dev

    [WIP] Unity Editor Plugin

    @ZodiusInfuser hey thanks for all the cool examples. The bridge works pretty well now so I actually came back to this project hoping to focus solely on making the hexapod as advanced as possible. Part of that being it's gait. Looking back on the old videos I'm actually amazed how fast I got this thing moving. I have rebuilt the gait system to be more reliable as well as built in a simple gait sequencer. You can now add target positions to a gait list and have the hexapod execute them. If the new position is in front of the current(relative to the vessel) the foot will arc to the new position. If the new position is behind the current, it will translate across the ground. Pretty much exactly like the example you posted above. groupLeft.limb0.AddGaitTarget(groupLeft.limb0.limbIK.pointBack); groupLeft.limb0.AddGaitTarget(groupLeft.limb0.limbIK.pointFront); groupLeft.limb0.RunGait(); The problem I am currently experiencing is having the foot explode on ground contact. I solved this in Gen 1 by using a PID controller to control the speed for each individual servo. By setting a high D value the servos would slow as they got to their target. A main difference between the old and new gait is that I now use lerp to move the target position, so the target position itself slows as it gets to its destination. I thought this would be even better than the old gait where the target moved with a constant speed, but that doesn't seem to be the case. The problem here is the leg will switch from an arc to translate when the actual foot position gets within .1m of the target position. When that happens the foot is still above the ground, so it comes in slowly, the target changes, and it then slams into the ground. In translate mode I also adjust the gait y position to get the hip/base of the arm to the proper height. So as soon as the mode switches, the new target may be under the ground, which doesn't help with the exploding feet. I tried getting servo.HostPart.GroundPosition to know when the foot is actually on the ground, but it only returns false (I may be doing this wrong still, because I've gotten it to work before.) I am now keeping the repo up to date so anyone can take a crack at adjusting my code or implementing your own. The repo has the code for the KSP plugin, the Unity project, the hexapod ship, and the GameData folder. You should only need IR next to make it work. Basically there is a RoboticController class. This has two groups of LegControllers. A LegController class contains both references to the RoboticLimbIK and RoboticLimbMirror classes, which control the Ik and KSP mirror leg. If you really want to take a crack at it let me know and i can explain in more detail. This is a project I do in what freetime I have, so the code could be cleaned up and streamlined(also some comments might help). Right now everything is basically in prototype form.
  4. VR_Dev

    [WIP] Unity Editor Plugin

    I appreciate the help but I actually got it to work by using the IRWrapper from the IR sequencer instead of from kOS. (Which may even be identical to the old one, not sure). When I left this project I was in the process of trying to rig any IR arm with IK, which I think is still possible, but pretty ambitious. First off I'm just going to get the hexapod up and running, then go from there. There is a jerky-ness to the servos that wasn't there before, not sure if its an IR Next issue or something in my IK code.
  5. VR_Dev

    [WIP] Unity Editor Plugin

    So I'm trying to get this project up and running again in 1.6. Unfortunately IR doesn't work in 1.6, so I have committed to switching to IR next. It looks like I can use the IR Wrapper in the same way (because kOS does), but it is failing with the error. [LOG 19:40:32.595] 1/12/2019 7:40:32 PM,MemoryBridgeServer-IR3Wrapper,[IR3 Wrapper] Failed to grab Mechanism Type If anyone has gotten the wrapper to work with IR next in 1.6 please let me know. I'm still working on getting the plugin to work without IR so it could still be useful without robotics. @Stone Blue & @Hooligan Labs were curious about the workflow. Essentially you can use : MemoryBridge.GetVector3(); MemoryBridge.SetVector3(); Get/SetFloat, Get/SetBool to get and set any variable I have included in the API (Most of vessel and some other classes). If you want to send custom values, you need to compile a plugin that provides the variable you are looking for. //Server side in a custom dll Update() { //Set a value to be read by Unity Client MemoryBridge.SetVector3("Custom String Name", Vessel.GetObtVelocity()); //Get a value from Unity Client and apply it in game Vessel.FlightCTRLState.Roll = MemoryBridge.GetFloat("Custom Throttle String"); } //Client side (Unity) Update(){ //Get the orbital velocity from KSP var orbitVel = MemoryBridge.GetVector3("Custom String Name"); //Set throttle based on some custom code like a PID //You can test code here quickly without having to reload KSP each time MemoryBridge.SetFloat("Custom Throttle String", calculatedThrottle); } Edit : and for anyone curious about my earlier post. I have my quadcopter autopilot at a pretty good place, which is why I'm returning to this project. Still needs a lot of PID tuning so if someone is good at that and has 70 bucks to buy a DJI Tello let me know.
  6. VR_Dev

    [WIP] Infernal Robotics - Next

    Tried this but it is failing with : [LOG 19:40:32.595] 1/12/2019 7:40:32 PM,MemoryBridgeServer-IR3Wrapper,[IR3 Wrapper] Failed to grab Mechanism Type Any help would be appreciated.
  7. VR_Dev

    F-22 Raptor MRK VIII

    I'm trying to replicate my f-22 racers irl. First step is tracking. https://tellopilots.com/threads/unity-controller-for-tello-3d-tracking-tello-simulator-flight-stick-support.2288/
  8. VR_Dev

    [WIP] Unity Editor Plugin

    hey @Stone Blue and @Hooligan Labs, I am still working on this, but it has been sidelined for my new project. I'll respond to all your questions later today. With the end goal being automated flying, something like this.
  9. VR_Dev

    [WIP] Infernal Robotics - Next

    I can now auto rig any design with a skeleton based on this simple naming structure. The servos group themselves based on angle axis, regardless of the random way they are positioned by the user. If anyone wants to see their creations loaded up you can organize/name the limbs, and send them my way. Next is figuring out auto -generated IK, then I'd be happy to help incorporate it into the mod if you're interested Rudolf.
  10. VR_Dev

    [WIP] Unity Editor Plugin

    I can now auto generate a skeleton on any IK structure based on this simple naming convention. The limb has to be its own group, which includes "ik" somewhere in the title. The base (1st) joint needs to include "base", and the last joint needs to include "wrist". Anything you want to skip, and any extentrons need to include "skip". Feel free to rig up your mechs and send them my way for testing. These skeletons are auto generated, and the servos grouped by their pivot axis. The sections with the same color will move the leg along the same axis. I have also taken rotation into account, so servos that are 180 of their group will be adjusted.This is all the groundwork needed to attempt autogenerating the IK.
  11. VR_Dev

    F-22 Raptor MRK VIII

    Couple videos testing my new KSP Unity editor plugin. Second video is incorporating the autopilot from the video above.
  12. VR_Dev

    [WIP] Infernal Robotics - Next

    Imagine if you could tweak those values from the unity editor...
  13. VR_Dev

    Work-in-Progress [WIP] Design Thread

    This thread has me reminiscent of my old f-16 https://gfycat.com/DefinitiveFittingHamadryad Follow up to my hexapod. Wanted to make something walk on all fours, with the option for upright locomotion. Finally happy with the design, so its time to make it walk and fly.
  14. VR_Dev

    [WIP] Infernal Robotics - Next

    Hey man, glad to see all is going well with the Mod. I've been super busy with the groundwork for my mech project, but am finally getting back into construction. I downloaded the latest beta and am going to build my new mech with your parts. My biggest request for IR right now is for joints that have a range larger than 180 degrees. Right now there is only one part that can do this, and it's not very compact. I'm also curious if you've done any research into multiaxis joints, or was that a dead end? I'm gonna take a look at the source code over the long weekend so I have a better understanding of if this is possible or not. Are there any plans for new models?
  15. VR_Dev

    [WIP] Unity Editor Plugin

    Still hard at work at this. Didn't have much to show on the bridge rework but I've finally optimized it to be as fast as possible, and have begun adding features into the platform. First off is the autopilot from my f-22 drone race. (https://www.youtube.com/watch?v=HEbhV4tjA8E&t=27s). You can input raw steering data or have it match a target. My joystick has never worked in KSP but now I am able to use it through unity. This video is raw control, but soon you will be able to position the second target vessel, and have the real one match its rotation. GenerateCamera() will automatically place a camera in the ksp scene and a render texture in the unity scene. You can also move the camera in unity and it will move in ksp. Render textures can now be sent at 60fps as well. Still need to remove the UI layers from the created camera however. This will be necessary to control the bots in VR, and still see whats happening in the game. As shown in the examples above I can also send the meshes over the bridge to unity. This will be helpful for a visual reference on top of the line skeletons. I have to figure out a way to get the manipulated IR components to look correct however. My next big project is writing a component that will automatically map any IR arm, and automatically calculate it's IK. This will most likely not be easy, but I believe it is doable, and would be the most useful feature to other people. I plan on rebuilding the hexapod with this system, but am also trying to build this. I want a mech that can walk, as well as have VTOL short to medium range capabilities. Also seems like a good stepping stone towards an upright, bidepal mech.