9 from moveit_ros_planning_interface._moveit_move_group_interface
import (
12 from moveit_msgs.msg
import MoveItErrorCodes
16 PLANNING_GROUP =
"manipulator"
20 self.
group = MoveGroupInterface(
29 self.group.set_joint_value_target(target)
30 return self.group.
plan()
33 current = np.asarray(self.
group.get_current_joint_values())
35 target = current + np.random.uniform(-0.5, 0.5, size=current.shape)
37 error_code1, plan, time = self.
plan(target)
38 error_code = MoveItErrorCodes()
39 error_code.deserialize(error_code1)
40 if (error_code.val == MoveItErrorCodes.SUCCESS)
and self.
group.execute(
43 actual = np.asarray(self.
group.get_current_joint_values())
44 self.assertTrue(np.allclose(target, actual, atol=1e-4, rtol=0.0))
47 actual = np.asarray(self.
group.get_current_joint_values())
48 self.assertTrue(np.allclose(current, actual, atol=1e-4, rtol=0.0))
51 if __name__ ==
"__main__":
52 PKGNAME =
"moveit_ros_planning_interface"
53 NODENAME =
"moveit_test_robot_state_update"
54 rospy.init_node(NODENAME)
55 rostest.rosrun(PKGNAME, NODENAME, RobotStateUpdateTest)