Python pybullet.TORQUE_CONTROL Examples

The following are 8 code examples of pybullet.TORQUE_CONTROL(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pybullet , or try the search function .
Example #1
Source File: robot_bases.py    From soccer-matlab with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def set_torque(self, torque):
		self._p.setJointMotorControl2(bodyIndex=self.bodies[self.bodyIndex], jointIndex=self.jointIndex, controlMode=pybullet.TORQUE_CONTROL, force=torque) #, positionGain=0.1, velocityGain=0.1) 
Example #2
Source File: bullet_physics_engine.py    From NTP-vat-release with MIT License 5 votes vote down vote up
def control_joint_torque(body, joint, torque):
        p.setJointMotorControl2(
                bodyIndex=body,
                jointIndex=joint,
                controlMode=p.TORQUE_CONTROL,
                force=torque) 
Example #3
Source File: ur5_robotiq.py    From costar_plan with Apache License 2.0 5 votes vote down vote up
def gripper(self, cmd, mode=pb.POSITION_CONTROL):
        '''
        Gripper commands need to be mirrored to simulate behavior of the actual
        UR5. Converts one command input to 6 joint positions, used for the
        robotiq gripper. This is a rough simulation of the way the robotiq
        gripper works in practice, in the absence of a plugin like the one we
        use in Gazebo.

        Parameters:
        -----------
        cmd: 1x1 array of floating point position commands in [-0.8, 0]
        mode: PyBullet control mode
        '''

        cmd = cmd[0]
        # This is actually only a 1-DOF gripper
        if cmd < -0.1:
            cmd_array = [-cmd + 0.1, -cmd + 0.1, cmd + 0.15,
                    -cmd + 0.1, -cmd + 0.1, cmd + 0.15]
        else:
            cmd_array = [-cmd , -cmd, cmd, -cmd, -cmd, cmd]
        forces = [25., 25., 25., 25., 25., 25.]
        gains = [0.1, 0.1, 0.15, 0.1, 0.1, 0.15]
        #if abs(cmd) < -0.01:
        #    mode = pb.TORQUE_CONTROL
        #    forces = [0.] * len(cmd_array)
        #else:

        #gripper_indices = [left_knuckle, left_inner_knuckle,
        #               left_fingertip, right_knuckle, right_inner_knuckle,
        #               right_fingertip]

        pb.setJointMotorControlArray(self.handle, self.gripper_indices, mode,
                                     cmd_array,
                                     forces=forces,
                                     positionGains=gains) 
Example #4
Source File: robot_bases.py    From GtS with MIT License 5 votes vote down vote up
def set_torque(self, torque):
        p.setJointMotorControl2(bodyIndex=self.bodies[self.bodyIndex], jointIndex=self.jointIndex, controlMode=p.TORQUE_CONTROL, force=torque) #, positionGain=0.1, velocityGain=0.1) 
Example #5
Source File: minitaur.py    From midlevel-reps with MIT License 5 votes vote down vote up
def _SetMotorTorqueById(self, motor_id, torque):
        p.setJointMotorControl2(bodyIndex=self.minitaur,
                                jointIndex=motor_id,
                                controlMode=p.TORQUE_CONTROL,
                                force=torque) 
Example #6
Source File: robot_bases.py    From midlevel-reps with MIT License 5 votes vote down vote up
def set_torque(self, torque):
        p.setJointMotorControl2(bodyIndex=self.bodies[self.bodyIndex], jointIndex=self.jointIndex, controlMode=p.TORQUE_CONTROL, force=torque) #, positionGain=0.1, velocityGain=0.1) 
Example #7
Source File: gym_mujoco_xml_env.py    From bullet-gym with MIT License 5 votes vote down vote up
def set_torque(self, torque):
		p.setJointMotorControl2(bodyIndex=self.bodies[self.bodyIndex], jointIndex=self.jointIndex, controlMode=p.TORQUE_CONTROL, force=torque) #, positionGain=0.1, velocityGain=0.1) 
Example #8
Source File: MJCFCommon.py    From bullet-gym with MIT License 5 votes vote down vote up
def set_torque(self, torque):
        p.setJointMotorControl2(self.bodies[self.bodyIndex],self.jointIndex,p.TORQUE_CONTROL, force=torque)