-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
167 changed files
with
4,819 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,5 +60,5 @@ | |
.btn:hover { | ||
opacity: 0.8; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.btn img { | ||
width: 500px; | ||
height: 350px; | ||
opacity: 0.4; /* 未选中时变灰 */ | ||
transition: opacity 0.5s; | ||
} | ||
|
||
.btn.active img { | ||
opacity: 1; /* 选中时恢复颜色 */ | ||
} | ||
|
||
.show-btn-active img { | ||
opacity: 1; /* 选中时恢复颜色 */ | ||
} | ||
|
||
.btn img:hover { | ||
opacity: 1.0; /* 鼠标悬停时强调效果 */ | ||
} | ||
|
||
.btn { | ||
cursor: pointer; | ||
} | ||
|
||
/* 设置button-container为flexbox布局,图片水平排列 */ | ||
.button-container { | ||
display: flex; | ||
justify-content: center; /* 居中排列 */ | ||
gap: 500px; /* 图片之间的间距 */ | ||
margin-top: 150px; | ||
margin-bottom: 150px; /* 底部增加些空隙 */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Define the task description as a JavaScript string | ||
var LLM_response_condition_cable_1 = ` | ||
from robot_controller import Controller | ||
from perception import Perception | ||
robot_controller = Controller() | ||
perception = Perception() | ||
def is_at(pose): | ||
# post-condition to check if the object is at the specified pose | ||
pass | ||
def is_grasped(): | ||
# post-condition to check if the object is grasped | ||
pass | ||
def is_released(): | ||
# post-condition to check if the object is released | ||
pass | ||
def is_inserted(env_object): | ||
# post-condition to check if the cable is inserted into the env_object | ||
pass | ||
def is_stretched(): | ||
# post-condition to check if the cable is stretched | ||
pass | ||
class ObjectSkillLibrary: | ||
# Skill library for manipulating any object | ||
def __init__(self, target_object): | ||
# target_object is the object which the robot hand directly manipulates, such as a cable or a screw | ||
self.target_object = target_object | ||
# env_object are contextual objects in the environment that target_object interacts with, such as a screw holder | ||
def move_object(self, pose): | ||
print(f"Moving {self.target_object} to {pose}") | ||
robot_controller.move_cart_pose(pose, success_condition=lambda: is_at(pose)) | ||
def grasp(self): | ||
print(f"Moving to grasp the {self.target_object} with two fingers") | ||
robot_controller.move_cart_pose(self.target_object, success_condition=is_grasped) | ||
robot_controller.grasp() | ||
def release(self): | ||
print(f"Opening the hand of the robot to release the {self.target_object}") | ||
robot_controller.open_gripper(success_condition=is_released) | ||
class CableSkillLibrary(ObjectSkillLibrary): | ||
# Skill library for manipulating cable | ||
def __init__(self): | ||
super().__init__("cable") | ||
def insert(self, direction, env_object): | ||
print(f"Inserting the {self.target_object} in {direction} into {env_object} and then loses contact") | ||
robot_controller.insert(direction, env_object, success_condition=lambda: is_inserted(env_object)) | ||
def stretch(self): | ||
print(f"Stretching the {self.target_object} linearly in opposite directions") | ||
robot_controller.stretch(success_condition=is_stretched) | ||
`; | ||
|
||
// Insert the task description into the user-request-cable-container element | ||
document.getElementById('LLM-response-condition-cable-1-container').innerHTML = | ||
'<pre style="background-color: #f8f9fa; overflow: visible; white-space: pre-wrap; word-wrap: break-word;" style="background-color: #f8f9fa; overflow: visible; white-space: pre-wrap; word-wrap: break-word;"><code class="language-python">' + Prism.highlight(LLM_response_condition_cable_1.trim(), Prism.languages.python, 'python') + '</code></pre>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Define the task description as a JavaScript string | ||
var LLM_response_condition_cable_2 = ` | ||
from robot_controller import Controller | ||
from perception import Perception | ||
robot_controller = Controller() | ||
perception = Perception() | ||
def is_at(pose, threshold=0.01): | ||
# post-condition to check if the object is at the specified pose | ||
current_pose = perception.get_robot_hand_pose() | ||
return np.linalg.norm(np.array(current_pose) - np.array(pose)) < threshold | ||
def is_grasped(): | ||
# post-condition to check if the object is grasped | ||
return perception.get_grasping_status() | ||
def is_released(): | ||
# post-condition to check if the object is released | ||
return not perception.get_grasping_status() | ||
def is_inserted(env_object, force_threshold=5.0): | ||
# post-condition to check if the cable is inserted into the env_object | ||
resistance_force = perception.get_resistance_force() | ||
return resistance_force > force_threshold | ||
def is_stretched(force_threshold=10.0): | ||
# post-condition to check if the cable is stretched | ||
resistance_force = perception.get_resistance_force() | ||
return resistance_force > force_threshold | ||
class ObjectSkillLibrary: | ||
# Skill library for manipulating any object | ||
def __init__(self, target_object): | ||
# target_object is the object which the robot hand directly manipulates, such as a cable or a screw | ||
self.target_object = target_object | ||
# env_object are contextual objects in the environment that target_object interacts with, such as a screw holder | ||
def move_object(self, pose): | ||
print(f"Moving {self.target_object} to {pose}") | ||
robot_controller.move_cart_pose(pose, success_condition=lambda: is_at(pose)) | ||
def grasp(self): | ||
print(f"Moving to grasp the {self.target_object} with two fingers") | ||
robot_controller.move_cart_pose(self.target_object, success_condition=is_grasped) | ||
robot_controller.grasp() | ||
def release(self): | ||
print(f"Opening the hand of the robot to release the {self.target_object}") | ||
robot_controller.open_gripper(success_condition=is_released) | ||
class CableSkillLibrary(ObjectSkillLibrary): | ||
# Skill library for manipulating cable | ||
def __init__(self): | ||
super().__init__("cable") | ||
def insert(self, direction, env_object): | ||
print(f"Inserting the {self.target_object} in {direction} into {env_object} and then loses contact") | ||
robot_controller.insert(direction, env_object, success_condition=lambda: is_inserted(env_object)) | ||
def stretch(self): | ||
print(f"Stretching the {self.target_object} linearly in opposite directions") | ||
robot_controller.stretch(success_condition=is_stretched) | ||
`; | ||
|
||
// Insert the task description into the user-request-cable-container element | ||
document.getElementById('LLM-response-condition-cable-2-container').innerHTML = | ||
'<pre style="background-color: #f8f9fa; overflow: visible; white-space: pre-wrap; word-wrap: break-word;" style="background-color: #f8f9fa; overflow: visible; white-space: pre-wrap; word-wrap: break-word;"><code class="language-python">' + Prism.highlight(LLM_response_condition_cable_2.trim(), Prism.languages.python, 'python') + '</code></pre>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Define the task description as a JavaScript string | ||
var LLM_response_condition_cable_3_description = ` | ||
Based on the plot, the resistance force during the "stretch" skill execution is consistently around 10 N. Therefore, we can set the threshold for the success condition is_stretched to a value slightly below 10 N to ensure that the skill is considered successful when the resistance force reaches this level. | ||
Here is the updated implementation of the is_stretched function: | ||
`; | ||
|
||
var LLM_response_condition_cable_3_code = ` | ||
from robot_controller import Controller | ||
from perception import Perception | ||
robot_controller = Controller() | ||
perception = Perception() | ||
def is_at(pose, threshold=0.01): | ||
# post-condition to check if the object is at the specified pose | ||
current_pose = perception.get_robot_hand_pose() | ||
return np.linalg.norm(np.array(current_pose) - np.array(pose)) < threshold | ||
def is_grasped(): | ||
# post-condition to check if the object is grasped | ||
return perception.get_grasping_status() | ||
def is_released(): | ||
# post-condition to check if the object is released | ||
return not perception.get_grasping_status() | ||
def is_inserted(direction, env_object, force_threshold=5.0): | ||
# post-condition to check if the object is inserted in the specified direction into the environment object | ||
resistance_force = perception.get_resistance_force() | ||
return resistance_force > force_threshold | ||
def is_stretched(force_threshold=9.0): | ||
# post-condition to check if the object is stretched | ||
resistance_force = perception.get_resistance_force() | ||
return resistance_force > force_threshold | ||
class ObjectSkillLibrary: | ||
# Skill library for manipulating any object | ||
def __init__(self, target_object): | ||
# target_object is the object which the robot hand directly manipulates, such as a cable or a screw | ||
self.target_object = target_object | ||
# env_object are contextual objects in the environment that target_object interacts with, such as a screw holder | ||
def move_object(self, pose): | ||
print(f"Moving {self.target_object} to {pose}") | ||
robot_controller.move_cart_pose(pose, success_condition=lambda: is_at(pose)) | ||
def grasp(self): | ||
print(f"Moving to grasp the {self.target_object} with two fingers") | ||
robot_controller.move_cart_pose(self.target_object, success_condition=is_grasped) | ||
robot_controller.grasp() | ||
def release(self): | ||
print(f"Opening the hand of the robot to release the {self.target_object}") | ||
robot_controller.open_gripper(success_condition=is_released) | ||
class CableSkillLibrary(ObjectSkillLibrary): | ||
# Skill library for manipulating cable | ||
def __init__(self): | ||
super().__init__("cable") | ||
def insert(self, direction, env_object): | ||
print(f"Inserting the {self.target_object} in {direction} into {env_object} and then loses contact") | ||
robot_controller.insert(direction, env_object, success_condition=lambda: is_inserted(direction, env_object)) | ||
def stretch(self): | ||
print(f"Stretching the {self.target_object} linearly in opposite directions") | ||
robot_controller.stretch(success_condition=lambda: is_stretched(force_threshold=9.0)) | ||
`; | ||
|
||
// Insert the description and code separately into the container | ||
document.getElementById('LLM-response-condition-cable-3-container').innerHTML = | ||
LLM_response_condition_cable_3_description + | ||
'<pre style="background-color: #f8f9fa; overflow: visible; white-space: pre-wrap; word-wrap: break-word;" style="background-color: #f8f9fa; overflow: visible; white-space: pre-wrap; word-wrap: break-word;"><code class="language-python">' + Prism.highlight(LLM_response_condition_cable_3_code.trim(), Prism.languages.python, 'python') + '</code></pre>'; |
Oops, something went wrong.