Skip to content

Commit

Permalink
Added tests for speedl rotation and limit exceeding motion calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
androst committed Feb 5, 2024
1 parent 5e079a7 commit 5bf70f5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions source/pyromocc/tests/pyromocc/test_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from pyromocc import Robot

np.set_printoptions(precision=2, suppress=True)


class TestRobot(TestCase):
def setUp(self) -> None:
Expand Down Expand Up @@ -33,6 +35,10 @@ def test_robot_speedl(self):
target_speed = [10, 0, 0, 0, 0, 0]
self.robot.speedl(target_speed, 100, 3)

def test_robot_speedl_rx(self):
target_speed = [0, 0, 0, -np.pi/4, 0, 0]
self.robot.speedl(target_speed, 100, 3)

def test_robot_speedj(self):
target_speed_joints = [-np.pi/2, 0, 0, 0, 0, 0]
self.robot.speedj(target_speed_joints, np.pi, time=1)
Expand All @@ -50,3 +56,27 @@ def test_robot_speedj_stopj(self):
self.robot.speedj(target_speed_joints, np.pi, time=1)
time.sleep(2)
self.robot.stopj()

def test_robot_movep_exceed_limit(self):
target_pose_aa = [1000, 0, 0, 0, 0, 0]
self.robot.operational_config_limit = (1000, 1000, 1000, 1000, 1000, 1000)
with self.assertRaises(ValueError):
self.robot.movep(target_pose_aa, 100, 100, wait=True)

def test_robot_speedj_exceed_limit(self):
target_speed_joints = [np.pi/2, 0, 0, 0, 0, 0]
self.robot.joint_velocity_limit = np.pi/4
with self.assertRaises(ValueError):
self.robot.speedj(target_speed_joints, np.pi, time=1)

def test_robot_speedl_exceed_limit(self):
target_speed = [0, 0, 150, 2*np.pi, 0, 0]
self.robot.operational_velocity_limit = (100, np.pi)
with self.assertRaises(ValueError):
self.robot.speedl(target_speed, 500, 5)

def test_loop_stopj(self):
for i in range(125):
self.robot.stopj()
time.sleep(1/125.0)

0 comments on commit 5bf70f5

Please sign in to comment.