Skip to content

Commit

Permalink
Making the python objects pub synchronously when ever commanded
Browse files Browse the repository at this point in the history
This makes the publishers faster, we somehow don't have the benefits of async pub speeds here as we do on C++ side
  • Loading branch information
adnanmunawar committed Feb 9, 2018
1 parent 22b3065 commit 6627a73
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/chai_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self):
self.chai_client.create_objs_from_rostopics()
# self.chai_client.print_summary()
self.n_skip_steps = 5
self.chai_client.start()
# self.chai_client.start()
self.enable_step_throttling = True
self.obs = Observation()
self.action_lims = np.array([30, 30, 30, 2, 2, 2])
Expand Down
1 change: 1 addition & 0 deletions scripts/chai_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def command(self, fx, fy, fz, nx, ny, nz, *jnt_cmds):
self.cmd.header.stamp = rospy.Time.now()

self.sim_step_pre_update = self.sim_step_cur
self.pub.publish(self.cmd)
self.acknowledge_wd()

def get_cur_sim_step(self):
Expand Down
1 change: 1 addition & 0 deletions scripts/chai_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def ros_cb(self, data):

def update(self):
self.cmd.step_clock = not self.cmd.step_clock
self.pub.publish(self.cmd)
self.acknowledge_wd()

def clear_cmd(self):
Expand Down
1 change: 1 addition & 0 deletions scripts/tests/env_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
env = ChaiEnv()
action = env.action_space
env.make('Torus')
env.skip_sim_steps(1)
time.sleep(1)
env.reset()
total = 5000
Expand Down

0 comments on commit 6627a73

Please sign in to comment.