33 from nav_msgs.msg
import Odometry
34 from std_srvs.srv
import Empty
35 from tf.transformations
import euler_from_quaternion
42 rospy.init_node(
'test_initial_pose', anonymous=
True)
46 p = msg.pose.pose.position
47 r = msg.pose.pose.orientation
49 rot = euler_from_quaternion([r.x, r.y, r.z, r.w])
51 rospy.loginfo(
"pos: {:6.3f} {:6.3f} {:6.3f} - ".format(pos[0], pos[1], pos[2]) +
52 "rot: {:6.3f} {:6.3f} {:6.3f}".format(rot[0], rot[1], rot[2]))
55 if (abs(pos[0]) < 1.0
and abs(pos[1]) < 1.0
and abs(pos[2]) < 1.0
and 56 abs(rot[0]) < 0.5
and abs(rot[1]) < 0.5
and abs(rot[2]) < 0.5):
60 rospy.Subscriber(
"/base_link_ground_truth", Odometry, self.
base_link_cb)
61 timeout_t = time.time() + 15
62 while not rospy.is_shutdown()
and not self.
base_success and time.time() < timeout_t:
67 if __name__ ==
'__main__':
69 rostest.rosrun(
'gundam_rx78_gazebo',
'test_initial_pose', TestInitialPose)
def test_initial_pose(self)
def base_link_cb(self, msg)