2 from math
import log10, floor
3 from unittest
import TestCase
6 from sr_robot_msgs.srv
import GetFastGraspFromBoundingBox \
8 from shape_msgs.msg
import SolidPrimitive
9 from geometry_msgs.msg
import PoseStamped
13 return round(x, sig-int(floor(log10(x)))-1)
19 '/grasp_from_bounding_box', GetGrasp)
33 pose.pose.position.x = 0.5
34 pose.pose.position.y = 0.5
35 pose.pose.position.z = 0.7
37 pose.pose.orientation.x = 0
38 pose.pose.orientation.y = 0
39 pose.pose.orientation.z = 0
40 pose.pose.orientation.w = 0
41 pose.header.frame_id =
'world' 43 box = SolidPrimitive()
45 box.dimensions = [0.05, 0.05, 0.05]
52 self.assertEqual(grasp.id,
"super_amazing_grasp")
54 self.assertEqual(grasp.grasp_pose.pose.position.x, 0.5)
55 self.assertEqual(grasp.grasp_pose.pose.position.y, 0.5)
56 self.assertEqual(grasp.grasp_pose.pose.position.z, 0.7)
58 self.assertEqual(
round_sig(grasp.grasp_pose.pose.orientation.x, 5),
60 self.assertEqual(
round_sig(grasp.grasp_pose.pose.orientation.y, 5),
62 self.assertEqual(
round_sig(grasp.grasp_pose.pose.orientation.z, 5),
64 self.assertEqual(
round_sig(grasp.grasp_pose.pose.orientation.w, 5),
67 self.assertEqual(1, 1)
70 if __name__ ==
'__main__':
79 rostest.rosrun(
"test_grasp_selection",
80 'test_fast_grasp_planner',
def make_box_and_pose(self)