cubeStartOrientation, useFixedBase=1) print("Number of joints in the Frankenstein: " + str(p.getNumJoints(TheArm))) for joint_index in range(0, p.getNumJoints(TheArm)): print() info = p.getJointInfo(TheArm, joint_index) print("Joint index: " + str(info[0])) print("Joint name: " + str(info[1])) print("Joint type: " + str(info[2])) print() #G = Grasp(p,TheArm) #G.stiffFingerClosePosition(90) G = Grasp(p, TheArm) G.spreadFingers(45) #'closing hand' #p.setJointMotorControl2(bodyUniqueId=TheArm, jointIndex=11, controlMode=p.POSITION_CONTROL, targetPosition = 3,maxVelocity = 1) #p.setJointMotorControl2(bodyUniqueId=TheArm, jointIndex=17, controlMode=p.POSITION_CONTROL, targetPosition = 3,maxVelocity = 1) #p.setJointMotorControl2(bodyUniqueId=TheArm, jointIndex=22, controlMode=p.POSITION_CONTROL, targetPosition = 3,maxVelocity = 1) #'spreading fingers' #p.setJointMotorControl2(bodyUniqueId=TheArm, jointIndex=10, controlMode=p.POSITION_CONTROL, targetPosition = 3,maxVelocity = 1) #p.setJointMotorControl2(bodyUniqueId=TheArm, jointIndex=16, controlMode=p.POSITION_CONTROL, targetPosition = 3,maxVelocity = 1) p.setRealTimeSimulation(1) time.sleep(10)
#Load-in a plane planeId = p.loadURDF("plane.urdf") cubeStartPos = [0,0,0] cubeStartOrientation = p.getQuaternionFromEuler([0,0,0]) #TheArm = p.loadURDF("Models/Frankenstein/FrankensteinV2.urdf",cubeStartPos, cubeStartOrientation,useFixedBase = 1) TheArm = p.loadURDF("Models/Frankenstein/new/FrankensteinV3.urdf",cubeStartPos, cubeStartOrientation, useFixedBase = 1) cubeStartPos = [0.5, 0, 0.2] cubeStartOrientation = p.getQuaternionFromEuler([0,0,0]) Obj4 = p.loadURDF("Models/PhysicsTesting/small_sphere.urdf",cubeStartPos, cubeStartOrientation, useFixedBase = 1) #Grasping class G = Grasp(p,TheArm) I = Interface.Interface() AC = ArmController(p,TheArm) #Run the simulation for i in range (0,200000): if i % 100 == 0: print("Step" + str(i)) AC.IKiteration([0.5,0.3,0.5], p.getQuaternionFromEuler([1.57,0,0]), i, 0,500) AC.IKiteration([0.7,0.3,0.2], p.getQuaternionFromEuler([1.57,0,0]), i, 500,1000) AC.IKiteration([0.5,0.2,0.2], p.getQuaternionFromEuler([1.57,0,0]), i, 1000,1500) AC.IKiteration([0.5,0.1,0.2], p.getQuaternionFromEuler([1.57,0,0]), i, 1500,2000) AC.IKiteration([0.5,0.02,0.2], p.getQuaternionFromEuler([1.57,0,0]), i, 2000,2500) if i == 2500: AC.frankaJointsLock()
useFixedBase=1) cubeStartPos = [0.5, 0, 0] cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0]) table = p.loadURDF("Models/PhysicsTesting/table.urdf", cubeStartPos, cubeStartOrientation, useFixedBase=1) cubeStartPos = [0.5, 0, 0.27] cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0]) payload = p.loadURDF("Models/PhysicsTesting/cylinder.urdf", cubeStartPos, cubeStartOrientation) #Grasping class G = Grasp(p, TheArm) I = Interface.Interface() AC = ArmController(p, TheArm) S = Stats() G.lockSpreadFingersJoints() #Run the simulation for i in range(0, 24000): if i % 100 == 0: print("Step" + str(i)) AC.GrabbingSequence(i, 0, G) AC.runSeriesOfIKTasks(i, task) allStatsHandling() p.stepSimulation()
cubeStartPos = [0.5, 0, 0] cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0]) #TheArm = p.loadURDF("Models/Frankenstein/FrankensteinV2.urdf",cubeStartPos, cubeStartOrientation,useFixedBase = 1) table = p.loadURDF("Models/PhysicsTesting/table.urdf", cubeStartPos, cubeStartOrientation, useFixedBase=1) cubeStartPos = [0.5, 0, 0.27] cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0]) #TheArm = p.loadURDF("Models/Frankenstein/FrankensteinV2.urdf",cubeStartPos, cubeStartOrientation,useFixedBase = 1) payload = p.loadURDF("Models/PhysicsTesting/cylinder.urdf", cubeStartPos, cubeStartOrientation) #Grasping class G = Grasp(p, TheArm) I = Interface.Interface() AC = ArmController(p, TheArm) S = Stats() G.lockSpreadFingersJoints() #Run the simulation for i in range(0, 240000): if i % 100 == 0: print("Step" + str(i)) AC.IKiteration([0.5, 0.3, 0.5], p.getQuaternionFromEuler([1.57, 0, 0]), i, 0, 500) AC.IKiteration([0.7, 0.3, 0.3], p.getQuaternionFromEuler([1.57, 0, 0]), i, 500, 1000) AC.IKiteration([0.5, 0.2, 0.3], p.getQuaternionFromEuler([1.57, 0, 0]), i, 1000, 1500)
useFixedBase=1) cubeStartPos = [0.5, 0, -0.1] cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0]) table = p.loadURDF("Models/PhysicsTesting/table.urdf", cubeStartPos, cubeStartOrientation, useFixedBase=1) cubeStartPos = [0.5, 0, 0.17] cubeStartOrientation = p.getQuaternionFromEuler([0, 0, 0]) payload = p.loadURDF("Models/PhysicsTesting/cylinder.urdf", cubeStartPos, cubeStartOrientation) #Grasping class G = Grasp(p, TheArm) #I = Interface.Interface() AC = ArmController(p, TheArm) S = Stats() G.lockSpreadFingersJoints() czas = KC() i = 0 iteration = 0 #logging = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4,"rec.MP4") #Run the simulation while (i in range(0, 24000)): if i % 1000 == 0: print("Iteration: " + str(iteration) + ", Step: " + str(i)) AC.GrabbingSequence(i, 0, G)