机械抓安装

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.git
cd pymodbus
python 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.







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值