I have a robotic arm simulation, but it opens with errors

asked 2023-03-25 16:19:17 -0600

Speedtail765 gravatar image

updated 2023-03-28 09:04:34 -0600

https://github.com/EuropeanRoverChall...

Using this link, I installed a robotic arm simulation, when I run "roslaunch ur3_sim simulation.launch" it throws errors:

Traceback (most recent call last): File "/home/leopard/catkin_ws/src/UR3_sim/ur3_sim/scripts/gripper.py", line 69, in <module> main() File "/home/leopard/catkin_ws/src/UR3_sim/ur3_sim/scripts/gripper.py", line 58, in main gripper = GripperController() File "/home/leopard/catkin_ws/src/UR3_sim/ur3_sim/scripts/gripper.py", line 34, in __init__ self.move_group = MoveGroupPythonInteface() File "/home/leopard/catkin_ws/src/UR3_sim/ur3_sim/scripts/gripper.py", line 17, in __init__ move_group = moveit_commander.MoveGroupCommander("gripper") File "/opt/ros/noetic/lib/python3/dist-packages/moveit_commander/move_group.py", line 66, in __init__ self._g = _moveit_move_group_interface.MoveGroupInterface( RuntimeError: Unable to connect to move_group action server 'move_group' within allotted time (5s)

and

[gripper_control-12] process has died [pid 8523, exit code 1, cmd /home/leopard/catkin_ws/src/UR3_sim/ur3_sim/scripts/gripper.py __name:=gripper_control __log:=/home/leopard/.ros/log/726b466a-cb52-11ed-b804-2d1e17af91e0/gripper_control-12.log]. log file: /home/leopard/.ros/log/726b466a-cb52-11ed-b804-2d1e17af91e0/gripper_control-12*.log

How can I solve those issues? My gripper.py file:

> #!/usr/bin/env python3 import sys import rospy from std_msgs.msg import String import moveit_commander from math import pi import actionlib from control_msgs.msg import FollowJointTrajectoryAction class MoveGroupPythonInteface(object): def
__init__(self):
    super(MoveGroupPythonInteface, self).__init__()

    moveit_commander.roscpp_initialize(sys.argv)
    rospy.init_node('gripper_control', anonymous=True)
    #self.client = actionlib.SimpleActionClient('/arm_controller/follow_joint_trajectory', FollowJointTrajectoryAction)

    move_group = moveit_commander.MoveGroupCommander("gripper")
    move_group.set_planning_time(15.0)
    #move_group.wait_for_server(timeout=rospy.Duration(15))
    self.move_group = move_group
    rospy.sleep(10)

def go_to_joint_state(self, j0):
    joint_goal = self.move_group.get_current_joint_values()
    joint_goal[0] = j0 * pi / 180

    self.move_group.go(joint_goal, wait=True)
    self.move_group.stop()


class GripperController: def
__init__(self):
    rospy.Subscriber("/gripper_command", String, self.callback)
    self.move_group = MoveGroupPythonInteface()
    self.rate = rospy.Rate(10)  # 10hz

def callback(self, data):
    print("Pose: ", data.data)
    if data.data == 'close':
        self.move_group.go_to_joint_state(76)
    if data.data == 'open':
        self.move_group.go_to_joint_state(0)
    if data.data == 'semi_close':
        self.move_group.go_to_joint_state(52)
    if data.data == 'semi_open':
        self.move_group.go_to_joint_state(39)

def loop(self):
    while not rospy.is_shutdown():
        self.rate.sleep()
        if 0xFF == ord('q'):
            break


def main():
        try:
        print("Start")
        gripper = GripperController()
        gripper.loop()

        print("Complete")
    except rospy.ROSInterruptException:
        return
    except KeyboardInterrupt:
        return


if __name__ == '__main__':
    main()
edit retag flag offensive close merge delete

Comments

Did you use the MoveIt! setup assistant?

tokyoUR10 gravatar image tokyoUR10  ( 2023-03-27 01:19:03 -0600 )edit

@tokyoUR10 I guess no, only thing I did is to cloning GÄ°tHub repostory and try to launch it.

Speedtail765 gravatar image Speedtail765  ( 2023-03-27 03:58:40 -0600 )edit