Trufiadok

Inverse kinematics robotcontroller for Canadarm1, Canadarm2 and ANY

Recommended Posts

Lcb4yLr.png

downloadable newest version: GitHub / Trufiadok / IKRC-for-Kerbal

 

I make inverse kinematics robotcontroller plugin. I did the first step. I made a demo video of the current status.

https://youtu.be/ot6DlNYduIg

The inverse kinematics algorithm working with gradient descent. Fine-positioned movements are not perfect yet, I still have to work on it.

I use the Infernal Robotics API for moving servo motors. The plugin is tailored to the current robot arm (Canadarm2), but later it can be generalized.

Special thanks to:
- Alan Zucconi for the Gadient descent algorithm,
- Infernal Robotics plugin creators,
- DebugStuff plugin authors for DrawTools routines,
- DockingCam- and RasterPropMonitor plugin creators for camera management routines.

KCXchBa.png

Edited by Trufiadok

Share this post


Link to post
Share on other sites

Will this work only for the same vessel or with other vessels like capture a SpaceX-Dragon?

Share this post


Link to post
Share on other sites

I plan to achieve the capture of the Dragon capsule. I made an opening door with pdgf for Dragon. There are still some repairs and space tests.

osgp22P.png

Share this post


Link to post
Share on other sites

 Keep it up! I hope that you will solve all the mistakes. Tired of already using parts of infernal robotics because when I start moving everything starts to wobble! I don't understand how Hellbrazer made Canadarm stable using infernal robotics parts

 

Edited by Briso

Share this post


Link to post
Share on other sites

I uploaded the latest changes to github. https://github.com/Trufiadok/IKRC-for-Kerbal

The WireSnareLock plugin can disable TRF_CA2_LEE_wCam dockingNode and activate the wire-snare device to capture the PDGF.

WireSnareLock support a physical connection with the vessel, but don't make logic connection (like magnet).

I changed the IKRC control display. This is not the final display yet. If I have a little time, I'll write it, how to work.

The IKRC plugin expanded with Virtual EndEffector function (VEE).

I made a new video about the docking of the Dragon capsule. 

And the other video about Virtual EndEffector function. 

 

Share this post


Link to post
Share on other sites

I'm also mind-blown by this - could you maybe make a small written tutorial how to work with this ?

 

Edit: i got it "working" but for some reason the LEE always ends up positioned sideways to the PDGF, i am running KSP 1.5 and some mods but dunno what could be affecting this :/

Edited by Jasseji

Share this post


Link to post
Share on other sites
On 11/10/2018 at 4:50 PM, Jasseji said:

I'm also mind-blown by this - could you maybe make a small written tutorial how to work with this ?

 

Edit: i got it "working" but for some reason the LEE always ends up positioned sideways to the PDGF, i am running KSP 1.5 and some mods but dunno what could be affecting this :/

Which PDGF part do you use?  (Trufiadok/IKRC-for-Kerbal/Canadarm2/TRF_CA2_PDGF_wT/ ?)

How to use robotarm easily:

1. Turn on servoTRF -> this show transform of servos, transform of endeffector end transform of targets. White ball represent position of endeffector and yellow ball represent position of target. Red ball show the calculated inverse kinematics target.

2. Select the target -> move cursor over the target - highlighted to green the target - and push "LeftAlt" on keyboard -> yellow ball appears.

3. Activate IK target -> push "target" button on display-> red ball appears. In default case the offset of position [Vector3(0f, 0f, -0.6f)]. Over the yellow ball in Z direction with 0.6 unit.

If you turn on "Force Dist" toggle and "Force Roll" toggle then you set offset of target.

4. Push "IK active" toggle -> calculating inverse kinematics position and endeffector of Canadarm2 move to target.

The endeffector's target position and orientation calculation algorithm:

1. Plugin get "DockingNode transform" of target part.

2. Vngwc97.png

2. Orientation of IK-target (red ball) = Rotate Marked-target with  Euler(180f, 0f, -90f).

9oBt3Li.png

There will be endeffector the right direction.

jZ2gVvK.png

Orientation of white ball is same the orientation of red ball.

Returning to the original question may be that the problem is that used orientation of "DockingNode transform" of pdgf is not good.

If you turn on "servoTRF", it is similar to the orientation show on the picture? Can you upload an image or video?

 

I know the description isn't complete, I'll continue.

(Sorry for my english...)

Edited by Trufiadok

Share this post


Link to post
Share on other sites

There are two ways to control the robot arm: inverse kinematics control or manual control.

In case of Inverse kinematics control: target selection and turn on "IK active". Collisiondetection and avoidance is not solved.

In case of manual control: you can moving and rotating the endeffector.

liMs4B5.png

Share this post


Link to post
Share on other sites
1 hour ago, JohnMcLane said:

Does the robotcontroller works for every canadarm i construct or just the on you use in your videos?

I'm sorry, but IKRC working with dedicated Canadarm2 (store on myGitHub).

I hope IKRC will working with general robotics arm, in the future.

The biggest problem, i must make an InfernalRobotics plugin mod because the didn't always rotate the servos the shortest way.

Share this post


Link to post
Share on other sites

Hi, i just got back from a Business Trip, i did the same as you describe, from the screenshots the target looks exactly the same, although i just noticed i dont see the InfernalRobotics menu anywhere - maybe there lies the problem

Screenshots:

https://imgur.com/a/hTbjETm

 

 

 

 

Share this post


Link to post
Share on other sites
5 hours ago, Jasseji said:

Hi, i just got back from a Business Trip, i did the same as you describe, from the screenshots the target looks exactly the same, although i just noticed i dont see the InfernalRobotics menu anywhere - maybe there lies the problem

Screenshots:

https://imgur.com/a/hTbjETm

 

 

 

 

I think the InfernalRobotics plugin works, because the robot arm move. The problem is that I can't see the "transform" of the end effector in position of white ball on your picture. 

xqPXdYs.png

I made a picture with your position of servo setup.

Iy13PMp.png

Could you send ksp.log file? (e.g. path -> c:\Program Files (x86)\Steam\steamapps\common\Kerbal Space Program\ksp.log)

Do you use this robot arm? (https://github.com/Trufiadok/IKRC-for-Kerbal/blob/master/Canadarm2/Subassemblies/CA2 Canadarm2 for IKRC.craft)

For the sake of safety, I check the robot arm on the GitHub.

 

Share this post


Link to post
Share on other sites

I found a little difference in the .craft file so I refreshed it.  (https://github.com/Trufiadok/IKRC-for-Kerbal/blob/master/Canadarm2/Subassemblies/CA2 Canadarm2 for IKRC.craft)

The EndEffector was TRF_CA2_LEE but must be TRF_CA2_LEE_wCam.

I don't know if this solves the problem?

I'm continually repairing the bugs, always try the latest version.

Edited by Trufiadok

Share this post


Link to post
Share on other sites

hm, the moment i push "target", the transform disappears from the white ball and appears in front of the target only, i will check without any mods just to be sure (KSP version 1.5.1)

Share this post


Link to post
Share on other sites

hm, the moment i push "target", the transform disappears from the white ball and appears in front of the target only, i will check without any mods just to be sure (KSP version 1.5.1)

 

Edit:

Re-Downloaded all from github, including subassembly tried with stripped-down KSP, here are the screenshots:

https://imgur.com/a/xkgUeLL

Strangely, pushing "0st" returns the arm to the proper "0" position

 

I cant find the option to attach the KSP.log but i can mail it to you.

 

Here is what i see in the log tho:

[EXC 10:43:02.331] NullReferenceException: Object reference not set to an instance of an object
    InfernalRobotics.Gui.UIAssetsLoader.LoadBundleAssets ()
    InfernalRobotics.Gui.UIAssetsLoader+<LoadBundle>d__14.MoveNext ()
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)

[ERR 10:44:26.806] Exception handling event onGUIEditorToolbarReady in class IREditorCategory:System.NullReferenceException: Object reference not set to an instance of an object
  at InfernalRobotics.Gui.IREditorCategory.IRCustomFilter () [0x00000] in <filename unknown>:0 
  at EventVoid.Fire () [0x00000] in <filename unknown>:0 

[EXC 10:44:26.807] NullReferenceException: Object reference not set to an instance of an object
    InfernalRobotics.Gui.IREditorCategory.IRCustomFilter ()
    EventVoid.Fire ()
    UnityEngine.Debug:LogException(Exception)
    EventVoid:Fire()
    KSP.UI.Screens.<SetInitialState>c__Iterator1:MoveNext()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    KSP.UI.Screens.PartCategorizer:Setup()
    EventVoid:Fire()
    KSP.UI.Screens.EditorPanels:ShowPartsList(Action)
    EditorLogic:SelectPanelParts(Boolean)
    EditorLogic:StartEditor(Boolean)
    <Start>c__Iterator0:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

 

[EXC 10:45:20.360] NullReferenceException: Object reference not set to an instance of an object
    IkRobotController.IkRobotController.CheckExistArm ()
    IkRobotController.IkRobotController.Start ()
[LOG 10:45:20.360] [TRF112] 0 Start() part == null
[EXC 10:45:20.360] NullReferenceException: Object reference not set to an instance of an object
    IkRobotController.IkRobotController.CheckExistArm ()
    IkRobotController.IkRobotController.Start ()
[LOG 10:45:20.360] [TRF114] 0 Start() part == null
[EXC 10:45:20.360] NullReferenceException: Object reference not set to an instance of an object
    IkRobotController.IkRobotController.CheckExistArm ()
    IkRobotController.IkRobotController.Start ()
[EXC 10:45:20.361] NullReferenceException: Object reference not set to an instance of an object
    WireSnareLock.WireSnareLock.Start ()

 

 

Share this post


Link to post
Share on other sites
2 hours ago, Jasseji said:

hm, the moment i push "target", the transform disappears from the white ball and appears in front of the target only, i will check without any mods just to be sure (KSP version 1.5.1)

This is, because EndEffector doesn't have the transform. What we see is that transform of red ball. It is transform of "IKtarget". 

It still seems to lack the endeffector's transform.

Edit:

Re-Downloaded all from github, including subassembly tried with stripped-down KSP, here are the screenshots:

https://imgur.com/a/xkgUeLL

Strangely, pushing "0st" returns the arm to the proper "0" position

This is the correct operation. This function resets the robot arm.

I cant find the option to attach the KSP.log but i can mail it to you.

I need the whole log file because it has the IKRC log entries. I sent a message with my email address, you can send the ksp.log file.

Here is what i see in the log tho:

[EXC 10:43:02.331] NullReferenceException: Object reference not set to an instance of an object
    InfernalRobotics.Gui.UIAssetsLoader.LoadBundleAssets ()
    InfernalRobotics.Gui.UIAssetsLoader+<LoadBundle>d__14.MoveNext ()
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress)

   ....

The InfernalRobotics package on GitHub is incomplete. It may be necessary to work perfectly. I upload the package I use.

GitHub:MagicSmokeIndustries

 

 

 

Share this post


Link to post
Share on other sites

tried it with you IR packages - still no luck, cant get the IR menu to show even (not even the icon is present) although IKRC works quite well apart from the misaligne automatic placement

 

Sent you my KSP.log

Edited by Jasseji

Share this post


Link to post
Share on other sites
46 minutes ago, Jasseji said:

tried it with you IR packages - still no luck, cant get the IR menu to show even (not even the icon is present) although IKRC works quite well apart from the misaligne automatic placement

 

Sent you my KSP.log

I found the cause of the problem and the solution.

The config.xml for the IKRC plugin was defective. I uploaded the good.

There are two options for fixing:
1. Replace defective config.xml.
2. Use the "Dump SevoStructure" function as shown below.

     - Move robot arm in base position - press "0St".

     - Close IKRC Window.

     - Activate "Dump SevoStructure" on part popup menu.

"Dump SevoStructure" maps the positions and orientations of the robot arm servos - in the basic position of servo motors.

This is not required because the data is available in the config.xml file of the plugin. (Unless config.xml file is faulty :) )

Share this post


Link to post
Share on other sites

Yesss, it's working now, 100 times better than the IR control :D

Now, what is the secret behind the Dragon docking ?

Did you add something to the Docking port cfg itself for it to have a transform as the EndEffector ? (meaning in you video the white ball switches from the LEE w Cam to the Docking Port on the Nose of the Dragon - HOW ? :D)

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.