Page 1 of 1

Using Joint target position with Python Coppelia API binding

Posted: 28 Mar 2024, 20:45
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?

Re: Using Joint target position with Python Coppelia API binding

Posted: 28 Mar 2024, 23:46
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?

Re: Using Joint target position with Python Coppelia API binding

Posted: 02 Apr 2024, 07:59
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