當前位置: 首頁>>代碼示例>>Python>>正文


Python pybullet.resetBaseVelocity方法代碼示例

本文整理匯總了Python中pybullet.resetBaseVelocity方法的典型用法代碼示例。如果您正苦於以下問題:Python pybullet.resetBaseVelocity方法的具體用法?Python pybullet.resetBaseVelocity怎麽用?Python pybullet.resetBaseVelocity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pybullet的用法示例。


在下文中一共展示了pybullet.resetBaseVelocity方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_rolling_friction

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import resetBaseVelocity [as 別名]
def test_rolling_friction(self):
        import pybullet as p
        p.connect(p.DIRECT)
        p.loadURDF("plane.urdf")
        sphere = p.loadURDF("sphere2.urdf",[0,0,1])
        p.resetBaseVelocity(sphere,linearVelocity=[1,0,0])
        p.changeDynamics(sphere,-1,linearDamping=0,angularDamping=0)
        #p.changeDynamics(sphere,-1,rollingFriction=0)
        p.setGravity(0,0,-10)
        for i in range (1000):
          p.stepSimulation()
        vel = p.getBaseVelocity(sphere)
        self.assertLess(vel[0][0],1e-10)
        self.assertLess(vel[0][1],1e-10)
        self.assertLess(vel[0][2],1e-10)
        self.assertLess(vel[1][0],1e-10)
        self.assertLess(vel[1][1],1e-10)
        self.assertLess(vel[1][2],1e-10)
        p.disconnect() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:21,代碼來源:unittests.py

示例2: _endProcess

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import resetBaseVelocity [as 別名]
def _endProcess(self):
        """
        INTERNAL METHOD, stop the robot movement.
        """
        # Change the constraint to the actual position and orientation in
        # order to stop the robot's motion. The force applied is purposely huge
        # to avoid oscillations.
        actual_pos, actual_orn = pybullet.getBasePositionAndOrientation(
            self.robot_model,
            physicsClientId=self.physics_client)
        pybullet.changeConstraint(
            self.motion_constraint,
            actual_pos,
            jointChildFrameOrientation=actual_orn,
            maxForce=self.force * 10,
            physicsClientId=self.physics_client)
        pybullet.resetBaseVelocity(
            self.robot_model,
            [0, 0, 0],
            [0, 0, 0],
            physicsClientId=self.physics_client) 
開發者ID:softbankrobotics-research,項目名稱:qibullet,代碼行數:23,代碼來源:base_controller.py

示例3: set_body_linvel

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import resetBaseVelocity [as 別名]
def set_body_linvel(body, linvel):
        p.resetBaseVelocity(body, linearVelocity=list(linvel)) 
開發者ID:StanfordVL,項目名稱:NTP-vat-release,代碼行數:4,代碼來源:bullet_physics_engine.py

示例4: set_body_angvel

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import resetBaseVelocity [as 別名]
def set_body_angvel(body):
        p.resetBaseVelocity(body, angularVelocity=list(angvel)) 
開發者ID:StanfordVL,項目名稱:NTP-vat-release,代碼行數:4,代碼來源:bullet_physics_engine.py

示例5: apply_action

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import resetBaseVelocity [as 別名]
def apply_action(self, action):
        if self.is_discrete:
            realaction = self.action_list[action]
        else:
            realaction = action

        p.setGravity(0, 0, 0)
        p.resetBaseVelocity(self.robot_ids[0], realaction[:3], realaction[3:]) 
開發者ID:gkahn13,項目名稱:GtS,代碼行數:10,代碼來源:robot_locomotors.py

示例6: move

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import resetBaseVelocity [as 別名]
def move(self, x, y, theta):
        """
        Apply a speed on the robot's base.

        Parameters:
            x - Speed on the x axis, in m/s
            y - Speed on the y axis, in m/s
            theta - Rotational speed around the z axis, in rad/s
        """
        # Kill any previous moveTo process running
        self.moveTo(0, 0, 0, frame=BaseController.FRAME_ROBOT, _async=True)

        # Bound the velocity. The max acceleration is not taken into account
        # here, this is a potential improvment
        if abs(x) > PepperBaseController.MAX_LINEAR_VELOCITY:
            x = PepperBaseController.MAX_LINEAR_VELOCITY * (x/abs(x))
        if abs(y) > PepperBaseController.MAX_LINEAR_VELOCITY:
            y = PepperBaseController.MAX_LINEAR_VELOCITY * (y/abs(y))
        if abs(theta) > PepperBaseController.MAX_ANGULAR_VELOCITY:
            theta = PepperBaseController.MAX_ANGULAR_VELOCITY *\
                (theta/abs(theta))

        actual_pos, actual_orn = pybullet.getBasePositionAndOrientation(
            self.robot_model,
            physicsClientId=self.physics_client)

        # convert actual_orn into euler
        actual_orn = pybullet.getEulerFromQuaternion(actual_orn)

        linear_world_velocity = [
            x * math.cos(actual_orn[2]) - y * math.sin(actual_orn[2]),
            x * math.sin(actual_orn[2]) + y * math.cos(actual_orn[2]),
            0]

        time.sleep(0.02)
        pybullet.resetBaseVelocity(
            self.robot_model,
            linear_world_velocity,
            [0, 0, theta],
            physicsClientId=self.physics_client) 
開發者ID:softbankrobotics-research,項目名稱:qibullet,代碼行數:42,代碼來源:base_controller.py


注:本文中的pybullet.resetBaseVelocity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。