def _execute_gripper_commands(self):
start_time = rospy.get_time() - self._trajectory_actual_offset.to_sec()
r_cmd = self._r_grip.trajectory.points
l_cmd = self._l_grip.trajectory.points
pnt_times = [pnt.time_from_start.to_sec() for pnt in r_cmd]
end_time = pnt_times[-1]
rate = rospy.Rate(self._gripper_rate)
now_from_start = rospy.get_time() - start_time
while(now_from_start < end_time + (1.0 / self._gripper_rate) and
not rospy.is_shutdown()):
idx = bisect(pnt_times, now_from_start) - 1
if self._r_gripper.type() != 'custom':
self._r_gripper.command_position(r_cmd[idx].positions[0])
if self._l_gripper.type() != 'custom':
self._l_gripper.command_position(l_cmd[idx].positions[0])
rate.sleep()
now_from_start = rospy.get_time() - start_time
joint_trajectory_file_playback.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录