Ask Your Question
0

UR5 - Gazebo 5 - Simulation not moving

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

Biv gravatar image

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

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):
        logger.info("Shutting down ROS node...")
        rospy.signal_shutdown("User exited simulation")
        return True


def move_to_position(Arm): 

     Pub1_T.publish(0.5)
     Pub2_T.publish(0.5)
     Pub3_T.publish(0.5)
     Pub4_T.publish(0.5)
     Pub5_T.publish(0.5)
     Pub6_T.publish(0.5)

     Pub1_G.publish(Arm[0])
     Pub2_G.publish(Arm[1])
     Pub3_G.publish(Arm[2])
     Pub4_G.publish(Arm[3])
     Pub5_G.publish(Arm[4])
     Pub6_G.publish(Arm[5])
     rospy.sleep(20) 




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

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



if __name__ == '__main__':
    rospy.init_node('Winston_wave')
    try:
        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():
                    up()
                    down()           jectory[4], Float32, queue_size = 1)
        Pub6_T = rospy.Publisher(Arm_Names_Trajectory[5], Float32, queue_size = 1)   


        while not rospy.is_shutdown():
                    up()
                    down()           

    except rospy.ROSInterruptException:
        pass


    except rospy.ROSInterruptException:
        pass

and when I try to use test_move.py 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

Comments

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 imagegvdhoorn ( 2017-04-24 10:05:20 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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 = "192.168.88.60" # 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)
  s.close()
  print ("Received", repr(data))

Something like this in order to connect with your robot.

edit flag offensive delete link more

Comments

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 imageBiv ( 2017-04-19 01:32:17 -0600 )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 imagearunavanag ( 2017-04-19 01:36:29 -0600 )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 imageBiv ( 2017-04-19 02:31:45 -0600 )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 imagearunavanag ( 2017-04-19 05:11:31 -0600 )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

2 followers

Stats

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

Seen: 326 times

Last updated: Apr 24 '17