<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13439" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2022-05-20T18:11:10+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/13439</id>

		<entry>
		<author><name><![CDATA[Herou]]></name></author>
		<updated>2022-05-20T18:11:10+00:00</updated>

		<published>2022-05-20T18:11:10+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44022#p44022</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44022#p44022"/>
		<title type="html"><![CDATA[Issues using Inverse Kinematics on Spherical Joints (DeepMimic Humanoid)]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=44022#p44022"><![CDATA[
Hi!<br>I am working on trying to apply Inverse Kinematics to DeepMimic's humanoid model (<a href="https://github.com/xbpeng/DeepMimic/blob/master/data/characters/humanoid3d.txt" class="postlink">https://github.com/xbpeng/DeepMimic/blo ... noid3d.txt</a>) in order to slightly alter the character's motion in real time.<br><br>In order to figure out how to do so I have reduced the problem into a small example - Trying to modify the Humanoid's left wrist position using Inverse Kinematics.<br>The humanoid has 8 Spherical Joints and 4 Revolute Joints<br><br>I wrote the following code in order to try to dynamically alter the humanoid's wrist position taking in new values from the user:<br><div class="codebox"><p>Code: </p><pre><code>endEffector = 14curPos = self._get_joint_pose(phys_model, endEffector)[0]if(self.first):self.first = False self.c = [self._pybullet_client.addUserDebugParameter("lWrist x", -2, 2, curPos[0]), self._pybullet_client.addUserDebugParameter("lWrist y", -2, 2, curPos[1]), self._pybullet_client.addUserDebugParameter("lWrist z", -2, 2, curPos[2])]targetPos = [self._pybullet_client.readUserDebugParameter(self.c[0]), self._pybullet_client.readUserDebugParameter(self.c[1]), self._pybullet_client.readUserDebugParameter(self.c[2])]jointPoses = self._pybullet_client.calculateInverseKinematics(phys_model, endEffector, targetPos)currentPointer = 0for i in range(s.num_joints):jtype = s.joint_types[i]if jtype is JointType.BASE: #Rootpass      elif jtype is JointType.FIXED: #R/L Wrist        pass      elif jtype is JointType.REVOLUTE: #R/L Knee ; R/L Elbow        self._pybullet_client.resetJointStateMultiDof(phys_model, i, [jointPoses[currentPointer]])       currentPointer += 1      elif jtype is JointType.SPHERE: #Chest ; Neck ; R/L Hip ; R/L Ankle ; R/L Shoulder        quat = self._pybullet_client.getQuaternionFromEuler([jointPoses[currentPointer], jointPoses[currentPointer+1], jointPoses[currentPointer+2]])        self._pybullet_client.resetJointStateMultiDof(phys_model, i, quat)        currentPointer += 3</code></pre></div>However, I am not getting the expected results as the final outcome appears distorted/incorrect. <br><br><img src="https://imgur.com/J62zUXJ.png" class="postimage" alt="Image"><br><img src="https://imgur.com/HgSsjFV.png" class="postimage" alt="Image"><br><br>I believe the issue has to do with me not really knowing what to do with the outcome of the CalculateInverseKinematics function. I have tried looking at other examples, but I couldn't find anyone else using a combination of InverseKinematics and Spherical Joints. Has anyone tried doing something similar (i.e using InverseKinematics on Spherical joints/the DeepMimic Humanoid.urdf)?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=14335">Herou</a> — Fri May 20, 2022 6:11 pm</p><hr />
]]></content>
	</entry>
	</feed>
