本文整理汇总了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()