当前位置: 首页>>代码示例>>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;未经允许,请勿转载。