def timer_callback(self, event):
msg = JointState()
self.mutex.acquire()
if time.time() - self.last_command_time < 0.5:
dq = cartesian_control(self.joint_transforms,
self.x_current, self.x_target,
False, self.q_current, self.q0_desired)
msg.velocity = dq
elif time.time() - self.last_red_command_time < 0.5:
dq = cartesian_control(self.joint_transforms,
self.x_current, self.x_current,
True, self.q_current, self.q0_desired)
msg.velocity = dq
else:
msg.velocity = numpy.zeros(7)
self.mutex.release()
self.pub_vel.publish(msg)
评论列表
文章目录