<?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/13058" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2020-08-27T11:30:57+00:00</updated>

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

		<entry>
		<author><name><![CDATA[anshul96]]></name></author>
		<updated>2020-08-27T11:30:57+00:00</updated>

		<published>2020-08-27T11:30:57+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43086#p43086</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43086#p43086"/>
		<title type="html"><![CDATA[Torque control issue]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=43086#p43086"><![CDATA[
Hello, I am trying to control UR5 with Torque control but it doesn't seem to work, I have gone through tutorial and Example and used the same process but the result are not good. Please explain why?<br>I used follwoing code:<br><br>INTILIZATION<br>***************************************************************************<br><br>import pybullet as p<br>import time<br>import pybullet_data<br>import math<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br>physicsClient = p.connect(p.GUI)  # or p.DIRECT for non-graphical version<br>p.setAdditionalSearchPath(pybullet_data.getDataPath())  # optionally<br>p.setGravity(0, 0, -10)  # describe gravity in (x,y,z)<br>planeId = p.loadURDF("plane.urdf")<br>base_Position = [0, 0, 1]<br>UR5Id = p.loadURDF(<br>   ## PUT THE URDF FILE PATH HERE, IN MY CASE = /home/anshul/Documents/pybulletproject/robot_movement_interface/dependencies/ur_description/urdf/ur5_robot.urdf<br>    "/home/anshul/Documents/pybulletproject/robot_movement_interface/dependencies/ur_description/urdf/ur5_robot.urdf",<br>    useFixedBase=1, basePosition=base_Position)<br><br><br>p.setRealTimeSimulation(0)<br>target_ori_euler = [-math.pi / 2, -math.pi / 2, 0]<br>target_ori_quaternion = p.getQuaternionFromEuler(target_ori_euler)   <br><br>*********************************************************************************<br><br>PART WHERE I USED - setJointMotorControlArray COMMAND:<br><br>for i in range(1,7):<br>    p.setJointMotorControl2(UR5Id, i,controlMode=p.VELOCITY_CONTROL, force=0)  ##To disable the default Velocity/position control<br>    print(p.getJointState(UR5Id, i))<br><br>p.setJointMotorControlArray(UR5Id,range(1,7) ,controlMode=p.TORQUE_CONTROL, forces=[240]*6)<br>p.stepSimulation())<br><br><br><br>OR -----<br>for i in range(1,7):<br>    p.setJointMotorControl2(UR5Id, i,controlMode=p.VELOCITY_CONTROL, force=0)  ####To disable the default Velocity/position control<br>    print(p.getJointState(UR5Id, i))<br><br>for i in range(1,7):<br>    p.setJointMotorControlArray(UR5Id,i ,controlMode=p.TORQUE_CONTROL, forces=[240 ]*6)  <em class="text-italics"><br>    p.stepSimulation()<br>    p.setTimeStep(1/240)<br>    print(p.getJointStates(UR5Id, i))<br><br><br>WHEN I CHECK THE JOINT TORQUE APPLIED IT SHOWS THE FORCEs I APPLY IN VELOCITY CONTROL. Thanks for the help.<br>Anshul</em><p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13707">anshul96</a> — Thu Aug 27, 2020 11:30 am</p><hr />
]]></content>
	</entry>
	</feed>
