Python pybullet.resetBaseVelocity() Examples
The following are 7
code examples of pybullet.resetBaseVelocity().
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: unittests.py From soccer-matlab with BSD 2-Clause "Simplified" License | 6 votes |
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()
Example #2
Source File: base_controller.py From qibullet with Apache License 2.0 | 6 votes |
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)
Example #3
Source File: bullet_physics_engine.py From NTP-vat-release with MIT License | 5 votes |
def set_body_linvel(body, linvel): p.resetBaseVelocity(body, linearVelocity=list(linvel))
Example #4
Source File: bullet_physics_engine.py From NTP-vat-release with MIT License | 5 votes |
def set_body_angvel(body): p.resetBaseVelocity(body, angularVelocity=list(angvel))
Example #5
Source File: robot_locomotors.py From GtS with MIT License | 5 votes |
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:])
Example #6
Source File: robot_locomotors.py From midlevel-reps with MIT License | 5 votes |
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:])
Example #7
Source File: base_controller.py From qibullet with Apache License 2.0 | 5 votes |
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)