ljvmiranda921 / comments.ljvmiranda921.github.io

Blog comments for my personal blog: ljvmiranda921.github.io
1 stars 0 forks source link

Solving the Inverse Kinematics problem using Particle Swarm Optimization #1

Open ljvmiranda921 opened 3 years ago

ljvmiranda921 commented 3 years ago

Written on 02/05/2017 03:31:02

URL: https://ljvmiranda921.github.io/notebook/2017/02/04/inverse-kinematics-pso/

ljvmiranda921 commented 3 years ago

Comment written by Roger on 03/13/2018 07:41:51

Sorry I'm python beginner, I have question in using pso. How to run you's example . I'm testing the running time.
Thank'you.

ljvmiranda921 commented 3 years ago

Comment written by Lj Miranda on 03/13/2018 09:02:05

Hi Roger,

First, we create objects of the PSO class and the robotic arm, then call the `runOptimizer ` function while treating the `forwardKinematics` method as the objective function (this computes the cost, or the L2 distance between the target and the current location).



# Import modules
from particleSwarmOptimization import ParticleSwarmOptimization
from roboticArm import RoboticArm

# Initialize arm with distances
# Say, d1=5, d2=4, d4=7, d6=8

arm = RoboticArm(d1=5,d2=4,d4=7,d6=8)
opt = ParticleSwarmOptimization()

# Run optimizer with your parameters and arm.forwardKinematics as the
# objective function. Be sure to define your variables first (i.e. target, params, etc)
# before passing them to the function.

opt.runOptimizer(arm.forwardKinematics, target, params, iterations, options)

Hopefully this clears things up. The PSO API is very clunky and un-pythonic. You can use Pyswarms (https://github.com/ljvmiran... as your optimizer. Just define your roboticArm as an objective function.

ljvmiranda921 commented 3 years ago

Comment written by Lj Miranda on 05/23/2018 05:45:08

Hello, sorry for the very late reply, I didn't receive a notification from this.

If you wish to measure the running time, I'd recommend using the library I've built instead . It's
well-tested and much more stable. The link is here (https://github.com/ljvmiran...
and you can find some docs here (http://pyswarms.readthedocs...

Here, you need to define your objective function. For Inverse Kinematics PSO, this can
be the distance between your target end-point to the current end-point your forward kinematics
have.

Hope it helps a bit

ozgee96 commented 2 years ago

Although it does not give an error not work, what could be the reason?

ljvmiranda921 commented 2 years ago

Hi I'm not sure what you meant?

ozgee96 commented 2 years ago

Hi, The codes you shared on Github work without any errors in my 3.9 spyder console. But it doesn't show me a figure screen. Help me please.

Windows için Postahttps://go.microsoft.com/fwlink/?LinkId=550986 ile gönderildi

Kimden: Lj @.> Gönderilme: 14 Ocak 2022 Cuma 05:13 Kime: @.> Bilgi: @.>; @.> Konu: Re: [ljvmiranda921/comments.ljvmiranda921.github.io] Solving the Inverse Kinematics problem using Particle Swarm Optimization (#1)

Hi I'm not sure what you meant?

— Reply to this email directly, view it on GitHubhttps://github.com/ljvmiranda921/comments.ljvmiranda921.github.io/issues/1#issuecomment-1012685749, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AW2M63QZQVKBOUFIYI75I2DUV6BDXANCNFSM4Z2X4ZCQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>