How can I instantly change the current value of a joint in Moveit?
Hi.
I'm working in Ubuntu 18 / ROS Melodic. I'm programming in Python and I would like first move the manipulator to a point and then change the position of the joints instantly in order to make another movement from a new position. Is this possible?
I have read other post that says that by modifying the start status, the planner uses this new position to plan the trace, however I can not execute this plan because the manipulator has not changed its current state.
def main():
try:
robot = MoveGroupInterface()
rospy.sleep(2)
joints = robot.move_group.get_current_joint_values()
joint_goal = [pi, pi/2, 3.1241, pi, 3.1241, 0]
plan = robot.move_group.plan(joint_goal)
robot.move_group.execute(plan)
robot.move_group.stop()
joint_names = robot.robot.get_joint_names()
joint_state = JointState()
joint_state.header = Header()
joint_state.header.stamp = rospy.Time.now()
joint_state.name = joint_names[1:7]
joint_state.position = joints
moveit_robot_state = RobotState()
moveit_robot_state.joint_state=joint_state
robot.move_group.set_start_state(moveit_robot_state)
joint_goal = [pi, pi / 2, 3.1241, pi, pi/2, 0])
plan = robot.move_group.plan(joint_goal)
robot.move_group.execute(plan)
robot.move_group.stop()
except rospy.ROSInterruptException:
return
except KeyboardInterrupt:
return
Thanks in advance