myCobot PRO 600 Moveit

mycobot_600_moveit has integrated the MoveIt section.

Before use, you need to confirm whether the IP address of the robot arm is consistent with that in the program file. If not, you need to modify the IP address in the program file.View the modifications in the listener function in the program file:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from socket import *
import math
import sys
import time
from multiprocessing import Lock

import rospy
from sensor_msgs.msg import JointState

global mc
mutex = Lock()

# Some code is omitted here...

old_list = []

def callback(data):
    """callback function,回调函数"""
    global old_list
    # rospy.loginfo(rospy.get_caller_id() + "%s", data.position)
    print ("position", data.position)
    data_list = []
    for index, value in enumerate(data.position):
        value = value * 180 / math.pi
    print ("data", data_list)

    if not old_list:
        old_list = data_list
        mc.write_angles(data_list, 1999)
    elif old_list != data_list:
        old_list = data_list
        # if mc.check_running():
            # mc.task_stop()
            # time.sleep(0.05)

        mc.write_angles(data_list, 1999)


def listener():
    global mc
    rospy.init_node("control_slider", anonymous=True)

    ip = rospy.get_param("~ip", "")
    print (ip)
    mc = ElephantRobot(ip, 5001)
    res = mc.start_client()
    if res != "":
        # print ep.wait(5)
    # print mc.get_angles()
    # print mc.get_coords()
    # print mc.get_speed()

    rospy.Subscriber("joint_states", JointState, callback)
    # spin() simply keeps python from exiting until this node is stopped
    print ("sping ...")

if __name__ == "__main__":

Open the command line and run:

roslaunch mycobot_600_moveit mycobot600_moveit.launch

The operation effect is as follows:

If you want a real robot arm to execute a plan synchronously, you need to open another command line and run:

# # The default IP of mycobot pro 600 is "" and the port number is 5001. The specific IP is subject to the network connected to the actual robot arm.
rosrun mycobot_600_moveit

results matching ""

    No results matching ""