本文整理汇总了Python中executor.Executor.record方法的典型用法代码示例。如果您正苦于以下问题:Python Executor.record方法的具体用法?Python Executor.record怎么用?Python Executor.record使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类executor.Executor
的用法示例。
在下文中一共展示了Executor.record方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Task
# 需要导入模块: from executor import Executor [as 别名]
# 或者: from executor.Executor import record [as 别名]
#.........这里部分代码省略.........
self._executor.move_to_pose(approach)
def _retract(self):
# retrieve current pose from endpoint
retract = copy.deepcopy(self._executor.get_current_pose())
retract.position.z = retract.position.z + self._hover_distance
self._executor.move_to_pose(retract)
def transfer(self, start_pose, end_pose, obstacles):
print("Picking up the object")
self.pick(start_pose)
joint_names = self._executor.joint_names()
joints = self._executor.ik_request(start_pose)
start_joints = [joints[i] for i in joint_names]
joints = self._executor.ik_request(end_pose)
end_joints = [joints[i] for i in joint_names]
print start_joints
print end_joints
print "Adapting Trajectory Learned from Demonstrations"
resp = self._trajsvc(start_joints, end_joints, obstacles, True)
# resp = AdaptationResponse()
# resp.filename = '/home/aecins/ros_ws/src/baxter_adapt/MPC/generated/JointsTrajectory'
# resp.response = True
print resp
if resp.response is True:
while os.path.isfile(resp.filename) is False:
print "Wait for trajectory generation"
rospy.sleep(2.0)
print("Perform trajectory")
traj = open(resp.filename, 'r').readlines()
self._executor.move_as_trajectory(traj)
def transfer_imitation(self, start_pose, end_pose):
print("Picking up the object")
self.pick(start_pose)
print("Computing imitation trajectory")
joint_names = self._executor.joint_names()
joints = self._executor.ik_request(start_pose)
start_joints = [joints[i] for i in joint_names]
joints = self._executor.ik_request(end_pose)
end_joints = [joints[i] for i in joint_names]
print start_joints
print end_joints
obstacles = []
resp = self._trajsvc(start_joints, end_joints, obstacles, False)
print resp
if resp.response is True:
print("Perform trajectory")
traj = open(resp.filename, 'r').readlines()
self._executor.move_as_trajectory(traj)
def get_current_joints(self):
return self._executor.get_current_joints()
def get_current_pose(self):
return self._executor.get_current_pose()
def pick(self, pose):
# open the gripper
self._executor.gripper_open()
# servo above pose
self._approach(pose)
# servo to pose
self._executor.move_to_pose(pose)
# close gripper
self._executor.gripper_close()
# retract to clear object
self._retract()
def place(self, pose):
# servo above pose
#self._approach(pose)
# servo to pose
self._executor.move_to_pose(pose)
# open the gripper
self._executor.gripper_open()
# retract to clear object
self._retract()
def learning(self):
print('Learning weights from feedback')
feedback = self.get_feedback()
resp = self._learningsvc(feedback)
print('Updated weights for movement adaptation')
def get_feedback(self):
filename = os.getcwd() + '/trajectory_improved'
print('Please help me improve the task.')
self._executor.record(filename)
print('Done')
return filename