加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gripper.m 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
narasimhareddy04 提交于 2020-04-16 12:44 . Add files via upload
function gripper (clientID,closing,j1,j2)
vrep=remApi('remoteApi');
[r,p1]=vrep.simxGetJointPosition(clientID,j1,vrep.simx_opmode_blocking);
[r,p2]=vrep.simxGetJointPosition(clientID,j2,vrep.simx_opmode_blocking);
if(closing==1)
if (p1 <(p2-0.008))
vrep.simxSetJointForce(clientID,j1,10,vrep.simx_opmode_blocking);
vrep.simxSetJointForce(clientID,j2,10,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j1,-0.01,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j2,-0.04,vrep.simx_opmode_blocking);
else
vrep.simxSetJointForce(clientID,j1,10,vrep.simx_opmode_blocking);
vrep.simxSetJointForce(clientID,j2,10,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j1,-0.04,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j2,-0.04,vrep.simx_opmode_blocking);
end
else
if(p1<p2)
vrep.simxSetJointForce(clientID,j1,10,vrep.simx_opmode_blocking);
vrep.simxSetJointForce(clientID,j2,10,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j1,0.04,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j2,0.02,vrep.simx_opmode_blocking);
else
vrep.simxSetJointForce(clientID,j1,10,vrep.simx_opmode_blocking);
vrep.simxSetJointForce(clientID,j2,10,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j1,0.02,vrep.simx_opmode_blocking);
vrep.simxSetJointTargetVelocity (clientID,j2,0.04,vrep.simx_opmode_blocking);
end
end
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化