Add random offset to q0

This commit is contained in:
Michel Breyer 2021-12-06 18:08:50 +01:00
parent ee16fca0a6
commit 518fa68252

View File

@ -41,7 +41,8 @@ class HwNode:
rospy.Service("reset", Reset, self.reset) rospy.Service("reset", Reset, self.reset)
def seed(self, req): def seed(self, req):
# Nothing to do self.rng = np.random.default_rng(req.seed)
rospy.loginfo(f"Seeded the rng with {req.seed}.")
return SeedResponse() return SeedResponse()
def reset(self, req): def reset(self, req):
@ -49,6 +50,7 @@ class HwNode:
# Move to the initial configuration # Move to the initial configuration
self.switch_to_joint_trajectory_controller() self.switch_to_joint_trajectory_controller()
q0 += self.rng.uniform(-0.069, 0.069, 7)
self.moveit.goto(q0, velocity_scaling=0.4) self.moveit.goto(q0, velocity_scaling=0.4)
self.gripper.move(0.08) self.gripper.move(0.08)