Skip to content

Commit

Permalink
added tests for hold conditions of expression monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
ichumuh committed Jun 19, 2024
1 parent e3a24cd commit c94d1d5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/test_integration_pr2.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,35 @@ def test_hold_monitors2(self, zero_pose: PR2TestWrapper):
zero_pose.set_max_traj_length(30)
zero_pose.execute(add_local_minimum_reached=False)

def test_hold_condition_of_monitor(self, zero_pose: PR2TestWrapper):
sleep = zero_pose.monitors.add_sleep(2, name='sleep')
joint_goal = zero_pose.monitors.add_joint_position(name='joint reached',
goal_state=zero_pose.better_pose,
hold_condition=f'not {sleep}')

zero_pose.motion_goals.add_joint_position(goal_state=zero_pose.better_pose)
zero_pose.monitors.add_end_motion(start_condition=joint_goal)
zero_pose.execute(add_local_minimum_reached=False)

def test_hold_condition_of_monitor2(self, zero_pose: PR2TestWrapper):
sleep = zero_pose.monitors.add_sleep(1, name='sleep')
sleep2 = zero_pose.monitors.add_sleep(1, name='sleep2', start_condition=sleep)
joint_goal = zero_pose.monitors.add_joint_position(name='joint reached',
goal_state=zero_pose.better_pose)
teleport = zero_pose.monitors.add_set_seed_configuration(seed_configuration=zero_pose.default_pose)
joint_goal2 = zero_pose.monitors.add_joint_position(name='joint reached2',
goal_state=zero_pose.default_pose,
threshold=0.03,
start_condition=teleport,
hold_condition=f'{sleep}',
end_condition='')

zero_pose.motion_goals.add_joint_position(goal_state=zero_pose.better_pose,
start_condition=sleep2)
zero_pose.monitors.add_end_motion(start_condition=joint_goal)
zero_pose.monitors.add_cancel_motion(start_condition=f'not {joint_goal2} and {sleep2}', error_message='fail')
zero_pose.execute(add_local_minimum_reached=False)

def test_only_payload_monitors(self, zero_pose: PR2TestWrapper):
sleep = zero_pose.monitors.add_sleep(5)
zero_pose.monitors.add_cancel_motion(start_condition=sleep, error_message='time up',
Expand Down

0 comments on commit c94d1d5

Please sign in to comment.