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


Python pybullet.removeBody方法代碼示例

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


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

示例1: _flag_reposition

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def _flag_reposition(self):
        self.walk_target_x = self.np_random.uniform(low=-self.scene.stadium_halflen,
                                                    high=+self.scene.stadium_halflen)
        self.walk_target_y = self.np_random.uniform(low=-self.scene.stadium_halfwidth,
                                                    high=+self.scene.stadium_halfwidth)

        more_compact = 0.5  # set to 1.0 whole football field
        self.walk_target_x *= more_compact / self.robot.mjcf_scaling
        self.walk_target_y *= more_compact / self.robot.mjcf_scaling

        self.flag = None
        #self.flag = self.scene.cpp_world.debug_sphere(self.walk_target_x, self.walk_target_y, 0.2, 0.2, 0xFF8080)
        self.flag_timeout = 3000 / self.scene.frame_skip
        #print('targetxy', self.flagid, self.walk_target_x, self.walk_target_y, p.getBasePositionAndOrientation(self.flagid))
        #p.resetBasePositionAndOrientation(self.flagid, posObj = [self.walk_target_x, self.walk_target_y, 0.5], ornObj = [0,0,0,0])
        if self.gui:
            if self.lastid:
                p.removeBody(self.lastid)

            self.lastid = p.createMultiBody(baseVisualShapeIndex=self.visualid, baseCollisionShapeIndex=-1, basePosition=[self.walk_target_x, self.walk_target_y, 0.5])

        self.robot.walk_target_x = self.walk_target_x
        self.robot.walk_target_y = self.walk_target_y 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:25,代碼來源:ant_env.py

示例2: setOrientation

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def setOrientation(self, orientation):
        p.removeBody(self.plane)
        self.__init__(self.path, self.position, orientation) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:5,代碼來源:environment.py

示例3: setPosition

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def setPosition(self, position):
        p.removeBody(self.plane)
        self.__init__(self.path, position, self.orientation) 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:5,代碼來源:environment.py

示例4: remove_object

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def remove_object(self, o_id, update=True):
        pb.removeBody(o_id)
        if update:
            self.objects.remove(o_id) 
開發者ID:dougsm,項目名稱:mvp_grasp,代碼行數:6,代碼來源:renderer.py

示例5: reset

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def reset(self):
        '''
        Basic reset needs to reconfigure the world state -- set things back to
        the way they should be.
        '''
        for obj in self.objs:
            pb.removeBody(obj)
        self._setup()
        self._setupRobot(self.robot.handle) 
開發者ID:jhu-lcsr,項目名稱:costar_plan,代碼行數:11,代碼來源:default.py

示例6: _flag_reposition

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def _flag_reposition(self):
        # self.walk_target_x = self.np_random.uniform(low=-self.scene.stadium_halflen,
        #                                            high=+self.scene.stadium_halflen)
        # self.walk_target_y = self.np_random.uniform(low=-self.scene.stadium_halfwidth,
        #                                            high=+self.scene.stadium_halfwidth)
        force_x = self.np_random.uniform(-300, 300)
        force_y = self.np_random.uniform(-300, 300)

        more_compact = 0.5  # set to 1.0 whole football field
        # self.walk_target_x *= more_compact
        # self.walk_target_y *= more_compact

        startx, starty, _ = self.robot.body_xyz

        self.flag = None
        # self.flag = self.scene.cpp_world.debug_sphere(self.walk_target_x, self.walk_target_y, 0.2, 0.2, 0xFF8080)
        self.flag_timeout = 3000 / self.scene.frame_skip
        # print('targetxy', self.flagid, self.walk_target_x, self.walk_target_y, p.getBasePositionAndOrientation(self.flagid))
        # p.resetBasePositionAndOrientation(self.flagid, posObj = [self.walk_target_x, self.walk_target_y, 0.5], ornObj = [0,0,0,0])
        if self.lastid:
            p.removeBody(self.lastid)

        self.lastid = p.createMultiBody(baseMass=1, baseVisualShapeIndex=self.visualid,
                                        baseCollisionShapeIndex=self.colisionid, basePosition=[startx, starty, 0.5])
        p.applyExternalForce(self.lastid, -1, [force_x, force_y, 50], [0, 0, 0], p.LINK_FRAME)

        ball_xyz, _ = p.getBasePositionAndOrientation(self.lastid)

        self.robot.walk_target_x = ball_xyz[0]
        self.robot.walk_target_y = ball_xyz[1] 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:32,代碼來源:humanoid_env.py

示例7: _flag_reposition

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def _flag_reposition(self):
        #self.walk_target_x = self.np_random.uniform(low=-self.scene.stadium_halflen,
        #                                            high=+self.scene.stadium_halflen)
        #self.walk_target_y = self.np_random.uniform(low=-self.scene.stadium_halfwidth,
        #                                            high=+self.scene.stadium_halfwidth)
        force_x = self.np_random.uniform(-300,300)
        force_y = self.np_random.uniform(-300, 300)

        more_compact = 0.5  # set to 1.0 whole football field
        #self.walk_target_x *= more_compact
        #self.walk_target_y *= more_compact

        startx, starty, _ = self.robot.get_position()


        self.flag = None
        #self.flag = self.scene.cpp_world.debug_sphere(self.walk_target_x, self.walk_target_y, 0.2, 0.2, 0xFF8080)
        self.flag_timeout = 3000 / self.scene.frame_skip
        #print('targetxy', self.flagid, self.walk_target_x, self.walk_target_y, p.getBasePositionAndOrientation(self.flagid))
        #p.resetBasePositionAndOrientation(self.flagid, posObj = [self.walk_target_x, self.walk_target_y, 0.5], ornObj = [0,0,0,0])
        if self.lastid:
            p.removeBody(self.lastid)

        self.lastid = p.createMultiBody(baseMass = 1, baseVisualShapeIndex=self.visualid, baseCollisionShapeIndex=self.colisionid, basePosition=[startx, starty, 0.5])
        p.applyExternalForce(self.lastid, -1, [force_x,force_y,50], [0,0,0], p.LINK_FRAME)

        ball_xyz, _ = p.getBasePositionAndOrientation(self.lastid)

        self.robot.walk_target_x = ball_xyz[0]
        self.robot.walk_target_y = ball_xyz[1] 
開發者ID:alexsax,項目名稱:midlevel-reps,代碼行數:32,代碼來源:husky_env.py

示例8: _removeRobot

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def _removeRobot(self, robot_virtual):
        """
        Removes a Virtual robot (Robot inheriting from RobotVirtual) from a
        simulated instance

        Parameters:
            robot_virtual - The virtual robot to be removed
        """
        for camera in robot_virtual.camera_dict.values():
            if id(camera) in Camera._getCameraHandlesDict():
                camera.unsubscribe()

        pybullet.removeBody(robot_virtual.getRobotModel()) 
開發者ID:softbankrobotics-research,項目名稱:qibullet,代碼行數:15,代碼來源:simulation_manager.py

示例9: delete_simulated_robot

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import removeBody [as 別名]
def delete_simulated_robot(self):
        # Remove the robot from the simulation
        p.removeBody(self.robot_id, physicsClientId=self._physics_client_id) 
開發者ID:robotology-playground,項目名稱:pybullet-robot-envs,代碼行數:5,代碼來源:icub_env.py


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