机械抓安装

来源:互联网 发布:java base64编码 解码 编辑:程序博客网 时间:2024/05/02 01:12

1. 机械抓驱动在ubuntu 16.04, anaconda,ros环境中安装的.

由于机械抓是ubuntu14.04版本,所以catkin_make之前,将内部文件做了修改

2. anaconda 需要添加的库:

2.1 pymodbus库

下载地址为:https://github.com/riptideio/pymodbus

安装方法:

git clone git://github.com/bashwork/pymodbus.gitcd pymodbuspython setup.py install

2.2 pyserial库(pymodbus需要用)

下载地址: https://github.com/pyserial/pyserial

安装方法:

    在线的:conda install -c conda-forge pyserial

       或者: pip install pyserial

由于本人网速超级慢,所以下载后安装的,安装方法

python setup.py install

3 安装seom

sudo apt-get install ros-kinetic-soem

4. 安装后的操作

插上机械抓USB

dmesg | grep tty

sudo chmod +777 /dev/ttyUSB1

然后运行:

roscore

rosrun robotiq_c_model_control CModelRtuNode.py /dev/ttyUSB0

rosrun robotiq_c_model_control CModelSimpleController.py

5. 修改的命令

#.launch<node name="wgb_control" pkg="robotiq_c_model_control" type="CModelRtuNode.py"/># spyder pub = rospy.Publisher('CModelRobotOutput', outputMsg.CModel_robot_output)    command = outputMsg.CModel_robot_output();                 command.rACT = 1    command.rGTO = 1    command.rATR = 0                    i=0    command.rFR  = 150             command.rSP = 100    while not rospy.is_shutdown():        i = i+1        try:            joint_states = rospy.wait_for_message("joint_states", JointState)            joints_pos = joint_states.position            print("wgb", joints_pos)            d = 10.0    #        g.trajectory.points = [JointTrajectoryPoint(positions=joints_pos, velocities=[0]*6, time_from_start=rospy.Duration(0.0))]            print("wgbwgb----------------------------------------------------------")    #            for i in range(2):    #            g.trajectory.points.append(    #                JointTrajectoryPoint(positions=Q1, velocities=[0]*6, time_from_start=rospy.Duration(d)))            g.trajectory.points = [JointTrajectoryPoint(positions=joints_pos, velocities=[0]*6, time_from_start=rospy.Duration(0.0))]            g.trajectory.points.append(                JointTrajectoryPoint(positions=Q1, velocities=[0.001]*6, time_from_start=rospy.Duration(d)))            d += 20            g.trajectory.points.append(                JointTrajectoryPoint(positions=Q2, velocities=[0]*6, time_from_start=rospy.Duration(d)))            d += 2            g.trajectory.points.append(                JointTrajectoryPoint(positions=Q3, velocities=[0]*6, time_from_start=rospy.Duration(d)))            d += 40            client.send_goal(g)                        print("gripper888888888888888888888888888888888888888888888888883: i%2 = " )#####################################################################################################################################################            command.rPR  = (i%2) * 255            pub.publish(command)            rospy.sleep(2)            client.wait_for_result()                    #        client.send_goal(g)#        client.wait_for_result()        except KeyboardInterrupt:            client.cancel_goal()            raise        except:            raise

6.







原创粉丝点击