3 from __future__
import print_function
15 from fiducial_msgs.msg
import FiducialMapEntryArray
16 from geometry_msgs.msg
import PoseWithCovarianceStamped
22 A node to verify the map created by fiducial_slam. It will verify 23 that the specified map file contains at least min_lines lines, 24 and if the expect parameter is also given, it will check that 25 the position of the specfied fiducial. In addition, the pose 26 specified in expected_pose is verified 30 return rad * 180.0 / math.pi
41 for fid
in msg.fiducials:
42 self.
map[fid.fiducial_id] = (fid.x, fid.y, fid.z,
46 position = msg.pose.pose.position
47 orientation = msg.pose.pose.orientation
48 self.
pose = (position.x, position.y, position.z,
49 orientation.x, orientation.y, orientation.z, orientation.w)
52 rospy.init_node(
'test_map')
53 minLines = rospy.get_param(
"~min_lines", 1)
54 expect = rospy.get_param(
"~expect",
"")
55 expectedPose = rospy.get_param(
"~expected_pose",
"")
57 rospy.Subscriber(
"/fiducial_map", FiducialMapEntryArray,
59 rospy.Subscriber(
"/fiducial_pose", PoseWithCovarianceStamped,
66 if expectedPose !=
"":
67 ep = expectedPose.split()
68 for i
in range(len(ep)):
69 if abs(float(ep[i]) - float(self.
pose[i])) > EPSILON:
70 self.fail(
"pose %s" % (self.
pose,))
72 lines = expect.split(
',')
77 if not self.map.has_key(fid):
78 self.fail(
"Fiducial %d not in map" % fid)
79 fiducial = self.
map[fid]
80 for i
in range(len(ex)):
81 if abs(float(ex[i]) - float(fiducial[i])) > EPSILON:
82 self.fail(
"fiducial %d %s expected %s" % \
87 if __name__ ==
'__main__':
89 rostest.run(
'rostest', NAME, MapTest, sys.argv)
90 except KeyboardInterrupt:
def mapCallback(self, msg)
def poseCallback(self, msg)