ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

My code throws this error when I try to create objects in the planning scene. What can be the possible solution?

asked 2019-10-15 01:57:28 -0500

Adwait_Naik gravatar image

updated 2019-10-15 02:51:37 -0500

pavel92 gravatar image

The Code is

import sys
import copy
import rospy
from moveit_commander import RobotCommander, PlanningSceneInterface
import moveit_msgs.msg
import geometry_msgs.msg

rospy.init_node("create")

robot = RobotCommander()
scene = PlanningSceneInterface()
move_group = moveit_commander.MoveGroupCommander("manipulator")

#class for creating shape
class PlanningScene(object):

def addCylinder(self, name, height, radius, x,y,z,use_service=True):
        s = SolidPrimitive()
        s.dimensions = [height, radius]
        s.type = s.CYLINDER

        ps = PoseStamped()
        ps.pose.position.x = 0.5
        ps.pose.position.y = 0.5
        ps.pose.position.z = 0.5
        ps.pose.orientation.w = 1.0
        ps.pose.orientation.x = 2.0
        ps.pose.orientation.y = 3.0
        ps.pose.orientation.z = 2.0



    #Function to add a Box
def addBox(self, name, size_x, size_y, size_z, x,y,z, use_service=True):
    s = SolidPrimitive()
    s.dimensions = [size_x, size_y, size_z]
    s.type = s.BOX

    ps = PoseStamped()
    ps.pose.position.x = 2.5
    ps.pose.position.y = 2.5
    ps.pose.position.z = 2.5
    ps.pose.orientation.w = 1.0
    ps.pose.orientation.x = 2.0
    ps.pose.orientation.y = 3.0
    ps.pose.orientation.z = 2.0



    #Function to add Cube
def addCube(self, name, size, x,y,z, use_service=True):
    s = SolidPrimitive()
    s.dimensions = [size]
    s.type = s.CUBE

    ps = PoseStamped()
    ps.pose.position.x = 4.5
    ps.pose.position.y = 4.5
    ps.pose.position.z = 4.5
    ps.pose.orientation.w = 1.0
    ps.pose.orientation.x = 2.0
    ps.pose.orientation.y = 3.0
    ps.pose.orientation.z = 2.0




    #Function to add Sphere
def addSphere(self, name, radius, x,y,z, use_service=True):
    s = SolidPrimitive()
    s.dimensions = [radius]
    s.type = s.SPHERE

    ps = PoseStamped()
    ps.pose.position.x = 3.5
    ps.pose.position.y = 1.5
    ps.pose.position.z = 4.5
    ps.pose.orientation.w = 1.0
    ps.pose.orientation.x = 2.0
    ps.pose.orientation.y = 3.0
    ps.pose.orientation.z = 2.0



    #Function to add Cone
def addCone(self, name, height, radius, x,y,z, use_service=True):
    s = SolidPrimitive()
    s.dimensions = [height, radius]
    s.type = s.CONE

    ps = PoseStamped()
    ps.pose.position.x = 1.5
    ps.pose.position.y = 2.5
    ps.pose.position.z = 3.5
    ps.pose.orientation.w = 1.0
    ps.pose.orientation.x = 2.0
    ps.pose.orientation.y = 3.0
    ps.pose.orientation.z = 2.0


p = PlanningScene()

p.addCylinder("name1", 0.35, 0.35, 0.5, 0.5, 0.5, True)
p.addSphere( "name3", 2.5, 3.5, 1.5, 4.5, use_service=True)
p.addBox( "name5", 0.2, 0.2, 0.4, 2.5, 2.5, 2.5, use_service=True)

The error is

/opt/ros/kinetic/lib/python2.7/dist-packages/moveit_commander/move_group.pyc in __init__(self, name, robot_description, ns)
     50     def __init__(self, name, robot_description="robot_description", ns=""):
     51         """ Specify the group name for which to construct this commander instance. Throws an exception if there is an initialization error. """
---> 52         self._g = _moveit_move_group_interface.MoveGroupInterface(name, robot_description, ns)
     53 
     54     def get_name(self):

RuntimeError: Unable to connect to move_group action server 'move_group' within allotted time (5s)

Please ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-25 05:37:16 -0500

Hey, Are you able to run the node by itself and investigate its behavior?

$ rosrun moveit_ros_move_group move_group
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-10-15 01:57:28 -0500

Seen: 488 times

Last updated: Nov 25 '19