本文整理匯總了Python中motor.Motor.set_vel方法的典型用法代碼示例。如果您正苦於以下問題:Python Motor.set_vel方法的具體用法?Python Motor.set_vel怎麽用?Python Motor.set_vel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類motor.Motor
的用法示例。
在下文中一共展示了Motor.set_vel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: RoboArm
# 需要導入模塊: from motor import Motor [as 別名]
# 或者: from motor.Motor import set_vel [as 別名]
class RoboArm(object):
def __init__(self):
self.joints = [
PWMJoint(
5, BASE_MIN_ANGLE, BASE_MIN_PWM, BASE_MAX_ANGLE,
BASE_MAX_PWM, BASE_COF1, BASE_COF0),
PWMJoint(
6, SHOULDER_MIN_ANGLE, SHOULDER_MIN_PWM, SHOULDER_MAX_ANGLE,
SHOULDER_MAX_PWM, SHOULDER_COF1, SHOULDER_COF0),
PWMJoint(
7, ELBOW_MIN_ANGLE, ELBOW_MIN_PWM, ELBOW_MAX_ANGLE,
ELBOW_MAX_PWM, ELBOW_COF1, ELBOW_COF0),
DyMiJoint(
1, WRIST_MIN_ANGLE, WRIST_MIN_PWM, WRIST_MAX_ANGLE,
WRIST_MAX_PWM, WRIST_COF1, WRIST_COF0)]
self.motor = Motor(4)
def move_arm(self, out_pos):
self.motor.set_vel(out_pos.pos7)
arm_pos = [0.] * 6
for i in range(0, 4):
legal, arm_pos[i] = joints[i].get_pos(arm_pose[i])
if not legal:
rospy.logerr('angle over bound for joint %d' % i)
joints[i].set_pos(arm_pos[i])
def close(self):
for joint in self.joints:
joint.close()