Robot does not follow simulated trajectory

asked 2023-08-03 05:32:31 -0500

c.oe gravatar image

I am using ROS Noetic to control a Kinova Gen3 robotic arm. I've downloaded and built ros_kortex and running the kortex_driver with the appropriate flags:

roslaunch kortex_driver kortex_driver.launch ip_address:=10.163.18.200 gripper:=robotiq_2f_140 dof:=6 robot_name:=mygen3

Then, following the Move Group Python Interface guide, I wrote a program that

(1) initializes the required objects

moveit_commander.roscpp_initialize(sys.argv)  # __ns:=mygen3
move_group : moveit_commander.MoveGroupCommander.MoveGroupCommander = moveit_commander.MoveGroupCommander("arm")
robot : moveit_commander.RobotCommander.RobotCommander = moveit_commander.RobotCommander()
scene : moveit_commander.PlanningSceneInterface.PlanningSceneInterface = moveit_commander.PlanningSceneInterface()

(2) sets boundaries to the scene

wall_box = geometry_msgs.msg.PoseStamped()
wall_box.pose.position.y = 0.58
wall_box.pose.position.z = 0.7
wall_box.pose.orientation.w = 1
wall_box.header.frame_id = robot.get_planning_frame()
scene.add_box("wall", wall_box, (2,0.2,2))

(3) gets the current robot pose and saves it to a list

res = move_group.get_current_pose().pose
waypoints.append(copy.deepcopy(res))

(4) calculates the cartesian path

(plan, fraction) = self.move_group.compute_cartesian_path(waypoints, 0.01, 0.0)

(5) simulates the resulting plan

display_trajectory = moveit_msgs.msg.DisplayTrajectory()
display_trajectory.trajectory_start = robot.get_current_state()
display_trajectory.trajectory.append(plan)
display.publish(display_trajectory)

(6) and attempts to execute the plan with the actual arm.

move_group.execute(plan)

I manually move the arm to the desired waypoints and repeat step 2 accordingly. Everything goes mostly fine, the trajectory is displayed in Rviz, where the robot does what it should and stays within bounds. However, when I want to finally execute the trajectory (step 6), the robot does completely random things and crashes into a wall.

What am I doing wrong here? I've been stuck with this for days.

I would upload a Video showing the robot deriving from the simulation, but I'm not allowed to.

edit retag flag offensive close merge delete