Using Joint target position with Python Coppelia API binding

Typically: "How do I... ", "How can I... " questions
Post Reply
OsayandeEsosa
Posts: 2
Joined: 27 Mar 2024, 18:35

Using Joint target position with Python Coppelia API binding

Post by OsayandeEsosa »

Good afternoon. How do I use sim.setJointTargetposition to control the joint of a robot arm on Coppelia Python script such that the joint bends to the location I desire?

OsayandeEsosa
Posts: 2
Joined: 27 Mar 2024, 18:35

Re: Using Joint target position with Python Coppelia API binding

Post by OsayandeEsosa »

I was able to figure out how to do it using angular positioning: 'sim.setJointTargetPosition(fulcrumJoint,300*math.pi/360)' but how do I do so linearly, setting specific x,y,z coordinates?

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Using Joint target position with Python Coppelia API binding

Post by coppelia »

Hello,

if you want to control a joint or kinematic chain in 3D space instead of joint space, then you should use inverse kinematics (IK).

In your case, if you want a joint to follows a specific 3D point, try with this exercise:
  • Make sure your joint (for now) is in kinematics mode
  • attach it to an object that you then mark as model base
  • Add a dummy to the scene, and attach it to your joint. Rename that dummy to tip
  • Copy-paste that dummy and rename it to target. Attach it to the model base.
  • Select the model base
  • Go to [Menu bar > Modules > Kinematics > Inverse kinematics generator...]
  • Uncheck Alpha+Beta and Gamma
  • Set the Damping factor to e.g. 2
  • Click Generate
Now move the target dummy around, and you will see the tip dummy follow (because the joint is now controlled in IK).

Cheers

Post Reply