vrep关节类型和运行
1、vrep关节种类
一共有四种关节类型:revolute joint、prismatic joint、screw、spherical joint
screw不能在torque/force模式下运行;
spherical joint仅能够在torque/force模式下运行。
2、vrep关节模式
一共有四种模式:
(1)、passive mode(被动模式)
在这种该模式下,关节不能直接被控制,而是将作为一个固定连接,我们可以使用API函数(比如: simSetJointPositon 、 simSetSphericalJointMatrix).)改变关节的位置。
(2)、inverse kinematics mode (逆运动学模式)
在这种模式下,关节充当被动关节,但在反向运动学计算中使用或者调整。
(3)、dependent mode(依赖模式)
在这种模式下,关节的位置将直接通过一个线性方程,依赖于其他关节。
(4)、torque or force mode(扭矩或力模式)
在这种模式下,关节由动态学模块模拟,当且仅当关节开启动态使能(dynamically enabled)的时候。当动态使能的时候,关节是自由的或者可以通过force/torque、velocity、position进行控制
1)the joint motor is disabled
当关节的电机禁用(joint motor is disabled)的时候,关节是自由的,并且仅受它自己的限制。
2)the joint’s motor is enabled,but the control loop is disabled
启用关节电动机并禁用控制回路后,如果关节能够传递最大扭矩/力,则关节将尝试达到所需的目标速度。
3)the joint’s motor is enabled,and the control loop is enabled
启用关节电动机并启用控制回路后,用户可以使用3种控制模式:
1、custom control
自定义控件:关节回调函数将负责控制关节的动态行为,使您可以使用任何可想象的算法来控制关节。
2、PID control
3、spring-damper mode(弹簧-阻尼器模式)
通过力/转矩调制,关节将像弹簧-阻尼器系统一样工作
3、vrep关节控制
控制关节的方式取决于关节的模式,下面通过对同关节的模式进行控制分析:
(1)、the joint is not force/torque mode
在这个模式下,我们可以直接或者间接地设置关节的位置—通过使用simxSetJointPosition这个API函数来设置。
使用函数如下:
vrep.setJointPosition(client_id, joint,90*math.pi/180,vrep.simx_opmode_streaming) ---- set the position to 90 degrees
(2)、the joint is in force/torque mode
关节设置在这种模式之下,并被动态启用(也就是说设置有动态特性),则它将由物理引擎间接处理。关节的动态特性主要包含有两种:电机特性(motor properties)和控制特性(control properties);如果关节的电动机未被启用,则关节将不受控制(也就是说这个关节是自由的),否则的话,关节将存在下面这两种动态模式:
1)、the joint’s motor is enabled,but the control loop is disabled
在这种模式下,可以使用API函数simxSetJointTargetVelocity达到目标速度,使用API函数simSetJointForce达到指定的maximum force/torque。
2)、the joint’s motor is enabled,and the control loop is enabled
在这种模式下,关节可以在位置控制(例如PID控制)下运行,可以使用API函数simxSetJointTargetPosition达到物体的指定位置
(3)、总结
总的来说,vrep关节控制可以认为是分为以上三种情况,这三种情况下分别使用不同的函数去对我们的关节进行设置。
参考链接:
链接: 官方文档