本文整理汇总了Python中brics_actuator.msg.JointValue类的典型用法代码示例。如果您正苦于以下问题:Python JointValue类的具体用法?Python JointValue怎么用?Python JointValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JointValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_brics_msg_gripper
def make_brics_msg_gripper(cls, arm_num, opening_m):
# Turn a desired gripper opening into a brics-friendly message
left = opening_m/2.0
right = opening_m/2.0
# create joint positions message
jp = JointPositions()
# create joint values message for both left and right fingers
jvl = JointValue()
jvr = JointValue()
# Fill in the gripper positions desired
# This is open position (max opening 0.0115 m)
if arm_num == 1:
jvl.joint_uri = 'gripper_finger_joint_l'
jvr.joint_uri = 'gripper_finger_joint_r'
else:
jvl.joint_uri = 'gripper_' + str(arm_num) + '_finger_joint_l'
jvr.joint_uri = 'gripper_' + str(arm_num) + '_finger_joint_r'
jvl.unit = 'm'
jvl.value = left
jvr.unit = 'm'
jvr.value = right
# Append those onto JointPositions
jp.positions.append(copy.deepcopy(jvl))
jp.positions.append(copy.deepcopy(jvr))
return jp
示例2: Set
def Set(self,value):
grp_cmd = JointPositions()
j_cmd = JointValue()
j_cmd.joint_uri = self.joint_name
j_cmd.unit = 'm'
j_cmd.value = value
grp_cmd.positions.append(j_cmd)
print "Sending gripper command: " + str(j_cmd.value)
self._GripperCmdPublisher.publish(grp_cmd)
示例3: make_brics_msg_arm
def make_brics_msg_arm(positions):
# create joint positions message
jp = JointPositions()
for ii in range(5):
jv = JointValue()
jv.joint_uri = 'arm_joint_' + str(ii+1)
jv.unit='rad'
jv.value = positions[ii]
jp.positions.append(copy.deepcopy(jv))
return jp
示例4: _createJointPositions
def _createJointPositions(self, joint_config):
jp = JointPositions()
for i in range(5):
jv = JointValue()
jv.joint_uri = self.joint_names[i]
jv.value = joint_config[i]
jv.unit = "rad"
jp.positions.append(jv)
return jp
示例5: make_grip_msg
def make_grip_msg(opening_mm, joint_uri):
left = opening_mm/2000.
right = opening_mm/2000.
# create joint positions message
jp = JointPositions()
# create joint values message for both left and right fingers
jvl = JointValue()
jvr = JointValue()
# Fill in the gripper positions desired
# This is open position (max opening 0.0115 m)
jvl.joint_uri = joint_uri[5]
jvl.unit = 'm'
jvl.value = left
jvr.joint_uri = joint_uri[6]
jvr.unit = 'm'
jvr.value = right
# Append those onto JointPositions
jp.positions.append(copy.deepcopy(jvl))
jp.positions.append(copy.deepcopy(jvr))
return jp
示例6: to_joint_positions
def to_joint_positions(gripper_positions):
robot = os.getenv("ROBOT")
if robot == "youbot-edufill":
left_gripper_val = gripper_positions[0]
right_gripper_val = gripper_positions[1]
pub = rospy.Publisher("/arm_1/gripper_controller/position_command", JointPositions)
rospy.sleep(0.5)
try:
jp = JointPositions()
jv1 = JointValue()
jv1.joint_uri = "gripper_finger_joint_l"
jv1.value = left_gripper_val
jv1.unit = "m"
jv2 = JointValue()
jv2.joint_uri = "gripper_finger_joint_r"
jv2.value = right_gripper_val
jv2.unit = "m"
p = Poison()
jp.poisonStamp = p
jp.positions = [jv1, jv2] # list
pub.publish(jp)
rospy.sleep(1.0)
rospy.loginfo("Gripper control command published successfully")
except Exception, e:
rospy.loginfo("%s", e)
示例7: arm_up_recover
def arm_up_recover(self):
arm_up = create_arm_up()
arm_up[0] = self.configuration[0]
arm_up[4] = self.configuration[4]
joint_positions = JointPositions()
# transform from ROS to BRICS message
for j in range(len(joint_names)):
joint_value = JointValue()
joint_value.joint_uri = joint_names[j]
joint_value.value = limit_joint(joint_names[j], arm_up[j])
joint_value.unit = self.unit
joint_positions.positions.append(joint_value)
self.position_pub.publish(joint_positions)
rospy.sleep(1)
示例8: execute
def execute(self, goal):
rospy.logdebug("Executing command goal: " + str(goal))
jnt_pos = JointPositions()
for k in range(len(self.joint_names)):
value = JointValue()
value.joint_uri = self.joint_names[k]
value.unit = "m"
value.value = goal.command.position
jnt_pos.positions.append(value)
self.pub_joint_positions.publish(jnt_pos)
rospy.sleep(2.0)
self.server.set_succeeded()
示例9: publish_arm_joint_positions
def publish_arm_joint_positions(self, joint_positions):
desiredPositions = JointPositions()
jointCommands = []
for i in range(5):
joint = JointValue()
joint.joint_uri = "arm_joint_" + str(i+1)
joint.unit = "rad"
joint.value = joint_positions[i]
jointCommands.append(joint)
desiredPositions.positions = jointCommands
self.arm_joint_pub.publish(desiredPositions)
示例10: moveGripper
def moveGripper(self, gPublisher, floatVal):
jp = JointPositions()
myPoison = Poison()
myPoison.originator = 'yb_grip'
myPoison.description = 'whoknows'
myPoison.qos = 0.0
jp.poisonStamp = myPoison
nowTime = rospy.Time.now()
jvl = JointValue()
jvl.timeStamp = nowTime
jvl.joint_uri = 'gripper_finger_joint_l'
jvl.unit = 'm'
jvl.value = floatVal
jp.positions.append(jvl)
jvr = JointValue()
jvr.timeStamp = nowTime
jvr.joint_uri = 'gripper_finger_joint_r'
jvr.unit = 'm'
jvr.value = floatVal
jp.positions.append(jvr)
gPublisher.publish(jp)
示例11: set_joints_velocities
def set_joints_velocities(self, *args): # TODO: remove *args
u"""Set velocity for each joint.
Arguments:
*args -- velocity for each joint (j1, j2, j3, j4, j5)
Устанавливает скорость каждой степени подвижности в радианах/с.
Аргументы:
*args -- скорости соотвествующих степеней (j1, j2, j3, j4, j5)
"""
assert len(args) == 5
self.joints_velocities.velocities = []
for index, value in enumerate(args):
tmp = JointValue()
tmp.timeStamp = rospy.Time.now()
tmp.joint_uri = 'arm_joint_{}'.format(index + 1)
tmp.unit = 's^-1 rad'
tmp.value = value
self.joints_velocities.velocities.append(tmp)
self.joints_velocities_publisher.publish(self.joints_velocities)
示例12: set_joints_angles
def set_joints_angles(self, *args): # TODO: remove *args
u"""Set arm joints to defined angles in radians.
Arguments:
*args -- joints angles (j1, j2, j3, j4, j5)
Устанавливает углы поворота степеней подвижности в радианах.
Аргументы:
*args -- уголы соотвествующих степеней (j1, j2, j3, j4, j5)
"""
assert len(args) <= 5
self.joints_positions.positions = []
for i in range(5):
tmp = JointValue()
tmp.timeStamp = rospy.Time.now()
tmp.joint_uri = 'arm_joint_{}'.format(i + 1)
tmp.unit = 'rad'
tmp.value = args[i]
self.joints_positions.positions.append(tmp)
self.joints_positions_publisher.publish(self.joints_positions)
示例13: create_gripper_msg
def create_gripper_msg (left_gripper, right_gripper):
jp = JointPositions()
jv1 = JointValue()
jv1.joint_uri = "gripper_finger_joint_l"
jv1.value = left_gripper
jv1.unit = "m"
jv2 = JointValue()
jv2.joint_uri = "gripper_finger_joint_r"
jv2.value = right_gripper
jv2.unit = "m"
p = Poison()
jp.poisonStamp = p
jp.positions = [jv1, jv2]
return jp
示例14: _createGripperJointPositions
def _createGripperJointPositions(self, left, right):
jp = JointPositions()
jv1 = JointValue()
jv1.joint_uri = "gripper_finger_joint_l"
jv1.value = left
jv1.unit = "m"
jv2 = JointValue()
jv2.joint_uri = "gripper_finger_joint_r"
jv2.value = right
jv2.unit = "m"
p = Poison()
jp.poisonStamp = p
jp.positions = [jv1, jv2] #list
return jp
示例15: publish_gripper_width
def publish_gripper_width(self, width):
desiredPositions = JointPositions()
jointCommands = []
joint = JointValue()
joint.joint_uri = "gripper_finger_joint_l"
joint.unit = "m"
joint.value = width
jointCommands.append(joint)
joint = JointValue()
joint.joint_uri = "gripper_finger_joint_r"
joint.unit = "m"
joint.value = width
jointCommands.append(joint)
desiredPositions.positions = jointCommands
self.gripper_pub.publish(desiredPositions)