Ask Your Question

UR5 - Gazebo 5 - Simulation not moving

asked 2017-04-18 21:08:22 -0500

Biv gravatar image

updated 2017-04-24 10:04:01 -0500

gvdhoorn gravatar image

I am new to this so forgive me if I ask a dumb question.

I am running a Gazebo simulation of UR5 and the robot appears but I can not get it to move without moveit. I tried standard ROS topic calls with no luck

#!/usr/bin/env python
# 05 Apr 2017 - WOPA5X - Initial Development
import rospy
import math
from std_msgs.msg import Float32
from control_msgs.msg import FollowJointTrajectoryActionGoal
from trajectory_msgs.msg import JointTrajectoryPoint

#TORAD = math.pi / 180.0
#TODEG = 1.0 / TORAD

def finalization(self):"Shutting down ROS node...")
        rospy.signal_shutdown("User exited simulation")
        return True

def move_to_position(Arm): 



def up():
   Arm = [2.75, 2.75, 2.75, -2.75, 2.75, 2.75]
   print "Winston_wave -- moving arm up"  

def down():
   Arm = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
   print "Winston_wave -- moving arm down"  

if __name__ == '__main__':
        arm_joints = ["shoulder_pan_joint", "shoulder_lift_joint", "elbow_joint", "wrist_1_joint", "wrist_2_joint", "wrist_3_joint"]

        Arm_Names_Goals = []
        Arm_Names_Trajectory = []
        Pub = []
        for i in range(len(arm_joints)):
            Arm_Names_Goals.append("arm_controller/constraints/" + arm_joints[i] + "/goal")
            Arm_Names_Trajectory.append("arm_controller/constraints/" + arm_joints[i] + "/trajectory")

        Pub1_G = rospy.Publisher(Arm_Names_Goals[0], Float32, queue_size = 1)
        Pub2_G = rospy.Publisher(Arm_Names_Goals[1], Float32, queue_size = 1)
        Pub3_G = rospy.Publisher(Arm_Names_Goals[2], Float32, queue_size = 1)
        Pub4_G = rospy.Publisher(Arm_Names_Goals[3], Float32, queue_size = 1)
        Pub5_G = rospy.Publisher(Arm_Names_Goals[4], Float32, queue_size = 1)
        Pub6_G = rospy.Publisher(Arm_Names_Goals[5], Float32, queue_size = 1)   
        Pub1_T = rospy.Publisher(Arm_Names_Trajectory[0], Float32, queue_size = 1)
        Pub2_T = rospy.Publisher(Arm_Names_Trajectory[1], Float32, queue_size = 1)
        Pub3_T = rospy.Publisher(Arm_Names_Trajectory[2], Float32, queue_size = 1)
        Pub4_T = rospy.Publisher(Arm_Names_Trajectory[3], Float32, queue_size = 1)
        Pub5_T = rospy.Publisher(Arm_Names_Trajectory[4], Float32, queue_size = 1)
        Pub6_T = rospy.Publisher(Arm_Names_Trajectory[5], Float32, queue_size = 1)   

        while not rospy.is_shutdown():
                    down()           jectory[4], Float32, queue_size = 1)
        Pub6_T = rospy.Publisher(Arm_Names_Trajectory[5], Float32, queue_size = 1)   

        while not rospy.is_shutdown():

    except rospy.ROSInterruptException:

    except rospy.ROSInterruptException:

and when I try to use it just sits there saying "Waiting for server....", it is doing this with the modern driver too

HELP!!! is there anyway(examples would be nice) to move a UR without moveit

thanks in Advance Anthony(Biv)

edit retag flag offensive close merge delete


Could you please explain a bit what you want your program to do? I see you import FollowJointTrajectoryActionGoal but then never create a goal or an action client instance. The code you have right now makes no sense to me.

gvdhoorn gravatar image gvdhoorn  ( 2017-04-24 10:05:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-19 00:20:22 -0500

Are you trying to program it over the socket? Because I don't see anywhere that you have mentioned your port address and connection?

# Echo client program
  import socket
  HOST = "" # The remote host
  PORT = 30002 # The same port as used by the server
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect((HOST, PORT))
  s.send ("set_digital_out(2,False)" + "\n")
  data = s.recv(1024)
  print ("Received", repr(data))

Something like this in order to connect with your robot.

edit flag offensive delete link more


Thanks for the response, but this does not do anything. If you run it in isolation or within the program the node just sits there not doing anything until the attempt to connect fails and the py script dumps. Is there a specific host and port for gazebo? Is there something I don't understand.

Biv gravatar image Biv  ( 2017-04-19 01:32:17 -0500 )edit

This is not supposed to do anything, it is only to verify whether you can establish a connection or not. If you don't receive any reply then it means you cannot establish a connection with your robot. Can you try pinging your robot? Do you get back anything?

arunavanag gravatar image arunavanag  ( 2017-04-19 01:36:29 -0500 )edit

Thanks arunavanag for your help, but there is no robot currently connected to my machine. I am currently trying to get the Gazebo simulation of UR5 to work first. The code you provided does not return any so no robot found. Thanks again for your help

Biv gravatar image Biv  ( 2017-04-19 02:31:45 -0500 )edit

I think I understand, My bad, I havent used Gazebo for Universal robot. I will investigate, having found something I will post here.

arunavanag gravatar image arunavanag  ( 2017-04-19 05:11:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-04-18 21:08:22 -0500

Seen: 489 times

Last updated: Apr 24 '17