Python pybullet.removeBody() Examples
The following are 11
code examples of pybullet.removeBody().
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: ant_env.py From midlevel-reps with MIT License | 6 votes |
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
Example #2
Source File: environment.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
def setOrientation(self, orientation): p.removeBody(self.plane) self.__init__(self.path, self.position, orientation)
Example #3
Source File: environment.py From soccer-matlab with BSD 2-Clause "Simplified" License | 5 votes |
def setPosition(self, position): p.removeBody(self.plane) self.__init__(self.path, position, self.orientation)
Example #4
Source File: renderer.py From mvp_grasp with BSD 3-Clause "New" or "Revised" License | 5 votes |
def remove_object(self, o_id, update=True): pb.removeBody(o_id) if update: self.objects.remove(o_id)
Example #5
Source File: default.py From costar_plan with Apache License 2.0 | 5 votes |
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)
Example #6
Source File: ant_env.py From midlevel-reps with MIT License | 5 votes |
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_timeout = 3000 / self.scene.frame_skip 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]
Example #7
Source File: humanoid_env.py From midlevel-reps with MIT License | 5 votes |
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]
Example #8
Source File: husky_env.py From midlevel-reps with MIT License | 5 votes |
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]
Example #9
Source File: simulation_manager.py From qibullet with Apache License 2.0 | 5 votes |
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())
Example #10
Source File: icub_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def delete_simulated_robot(self): # Remove the robot from the simulation p.removeBody(self.robot_id, physicsClientId=self._physics_client_id)
Example #11
Source File: panda_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 5 votes |
def delete_simulated_robot(self): # Remove the robot from the simulation p.removeBody(self.robot_id, physicsClientId=self._physics_client_id)