Reduce calls to the physics engine

This commit is contained in:
Michel Breyer 2021-06-02 11:28:26 +02:00
parent e04361dd8c
commit 0cdeaa34f3
2 changed files with 6 additions and 1 deletions

View File

@ -105,7 +105,7 @@ class BtSimNode:
def handle_updates(self):
if self.step_cnt % int(self.sim.rate / self.controller_update_rate) == 0:
self.cartesian_pose_controller.update()
self.gripper_interface.update(1.0 / 60.0)
self.gripper_interface.update(1.0 / self.controller_update_rate)
if self.step_cnt % int(self.sim.rate / self.joint_state_publish_rate) == 0:
self.publish_joint_state()
if self.step_cnt % int(self.sim.rate / self.camera_publish_rate) == 0:

View File

@ -10,6 +10,11 @@ from robot_tools.utils import scan_dir_for_urdfs
class Simulation(BtManipulationSim):
def __init__(self, gui=True, sleep=True):
super().__init__(gui, sleep)
self.rate = 60
self.dt = 1.0 / self.rate
p.setPhysicsEngineParameter(fixedTimeStep=self.dt, numSubSteps=4)
p.configureDebugVisualizer(p.COV_ENABLE_GUI, 0)
p.resetDebugVisualizerCamera(1.4, 50, -35, [0.0, 0.0, 0.6])