My code throws this error when I try to create objects in the planning scene. What can be the possible solution?
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 Can anyone suggest a solution for the above error.
Thanks
Asked by Adwait_Naik on 2019-10-15 01:57:28 UTC
Answers
Hey, Are you able to run the node by itself and investigate its behavior?
$ rosrun moveit_ros_move_group move_group
Asked by lukashou-rabbit on 2019-11-25 06:37:16 UTC
Comments