Skip to content

Commit b8077ff

Browse files
committed
add changes should be pushed to main
1 parent 164938a commit b8077ff

29 files changed

+1279
-575
lines changed

grasp_detection/src/detectors/config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def __init__(self):
5656
self.max_point_num = 100000
5757

5858
self.debug = False # whether to visualize the grasps
59-
60-
61-
62-
59+
# Still buggy, DO not use
60+
self.save_visualization = False # whether to save the visualization
61+
self.save_visualization_dir = "/home/junting/Pictures/saved_anygrasp"

grasp_detection/src/detectors/detector_anygrasp.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import sys
3+
from datetime import datetime
34
import numpy as np
45
from typing import List, Tuple, Dict
56
import open3d as o3d
@@ -111,8 +112,35 @@ def detect_callback(self, req: DetectGraspsRequest)->DetectGraspsResponse:
111112
# create world coordinate frame
112113
world_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(size=0.1, origin=min_bound)
113114
grippers[0].paint_uniform_color([1,0,0])
114-
o3d.visualization.draw_geometries([*grippers, cloud, world_frame])
115+
if self.debug:
116+
# o3d.visualization.draw_geometries([*grippers, cloud, world_frame])
117+
o3d.visualization.draw_geometries([grippers[0], cloud])
118+
119+
# Do no use this snippet, bug still remains until Feb. 2024
120+
if self.config.save_visualization:
121+
# create the directory if not exist
122+
if not os.path.exists(self.config.save_visualization_dir):
123+
os.makedirs(self.config.save_visualization_dir)
124+
formatted_timestr = datetime.now().strftime("%Y-%m-%d-%H:%M")
125+
save_path = os.path.join(self.config.save_visualization_dir, f"{formatted_timestr}.png")
126+
127+
vis = o3d.visualization.Visualizer()
128+
vis.create_window()
129+
130+
# add point cloud and grippers to the visualizer
131+
cloud = cloud.transform(trans_mat)
132+
grippers = gg.to_open3d_geometry_list()
133+
grippers[0].paint_uniform_color([1,0,0])
134+
for gripper in grippers:
135+
vis.add_geometry(gripper)
136+
vis.add_geometry(cloud)
137+
138+
vis.run()
139+
# vis.update_renderer()
140+
vis.capture_screen_image(save_path)
141+
vis.destroy_window()
115142
# o3d.visualization.draw_geometries([grippers[0], cloud, world_frame])
143+
del vis
116144

117145
# compose response
118146
grasps_msg = []

grasp_detection/src/run_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
if __name__ == '__main__':
2121

22-
rospy.init_node('grasp_detector_node')
22+
rospy.init_node('grasp_detector_node', log_level=rospy.INFO)
2323

2424
# Load ROS parameters
2525
model_name = rospy.get_param('~model_name', 'anygrasp')
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
objects = [table, cabinet, white_and_yellow_mug, cabinet.drawer_0, cabinet.drawer_1, cabinet.handle_0, cabinet.handle_1] ; # place the mug into the second top drawer
1+
objects = [table, cabinet, white_and_yellow_mug, cabinet.drawer_0, cabinet.drawer_1, cabinet.handle_0, cabinet.handle_1] ; # Place the mug into the second top drawer. Note that the drawer is closed, please first open it.

instruct_to_policy/data/benchmark/worlds/world_2_pick_and_place.world

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<geometry>
6767
<mesh>
6868
<uri>model://013_apple/google_16k/textured.obj</uri>
69-
<scale>0.720932 0.720932 0.720932</scale>
69+
<scale>0.7 0.7 0.7</scale>
7070
</mesh>
7171
</geometry>
7272
<surface>
@@ -96,7 +96,7 @@
9696
<geometry>
9797
<mesh>
9898
<uri>model://013_apple/google_16k/textured.obj</uri>
99-
<scale>0.720932 0.720932 0.720932</scale>
99+
<scale>0.7 0.7 0.7</scale>
100100
</mesh>
101101
</geometry>
102102
<material>
@@ -110,7 +110,7 @@
110110
<enable_wind>0</enable_wind>
111111
<kinematic>0</kinematic>
112112
</link>
113-
<pose>-0.215209 -0.226958 0.81539 0.003841 -0.000706 -0.005062</pose>
113+
<pose>-0.085209 -0.166958 0.81539 0.003841 -0.000706 -0.005062</pose>
114114
</model>
115115
<model name="footed_bowl">
116116
<link name="link">
@@ -129,7 +129,7 @@
129129
<collision name="collision">
130130
<geometry>
131131
<mesh>
132-
<scale>1 1 1</scale>
132+
<scale>1 1 0.7</scale>
133133
<uri>model://Footed_Bowl_Sand/meshes/model.obj</uri>
134134
</mesh>
135135
</geometry>
@@ -159,7 +159,7 @@
159159
<visual name="visual">
160160
<geometry>
161161
<mesh>
162-
<scale>1 1 1</scale>
162+
<scale>1 1 0.7</scale>
163163
<uri>model://Footed_Bowl_Sand/meshes/model.obj</uri>
164164
</mesh>
165165
</geometry>

instruct_to_policy/data/benchmark/worlds/world_4_clear_table_to_basket.world

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<collision name="collision">
124124
<geometry>
125125
<mesh>
126-
<scale>1 1 1</scale>
126+
<scale>0.7 0.7 0.7</scale>
127127
<uri>model://017_orange/google_16k/textured_coacd_0.02.obj</uri>
128128
</mesh>
129129
</geometry>
@@ -153,7 +153,7 @@
153153
<visual name="visual">
154154
<geometry>
155155
<mesh>
156-
<scale>1 1 1</scale>
156+
<scale>0.7 0.7 0.7</scale>
157157
<uri>model://017_orange/google_16k/textured.obj</uri>
158158
</mesh>
159159
</geometry>
@@ -168,7 +168,7 @@
168168
<enable_wind>0</enable_wind>
169169
<kinematic>0</kinematic>
170170
</link>
171-
<pose>-0.069084 -0.312195 0.815503 0.003887 0.011289 1.4e-05</pose>
171+
<pose>0.06906 -0.02198 0.86753 2.67156 -0.273982 3.11429</pose>
172172
</model>
173173
<model name="toy_bus">
174174
<link name="link">
@@ -226,7 +226,7 @@
226226
<enable_wind>0</enable_wind>
227227
<kinematic>0</kinematic>
228228
</link>
229-
<pose>0.082475 -0.061716 0.83037 0.199767 -1.55924 -1.03876</pose>
229+
<pose>-0.135539 -0.364542 0.814753 0.008174 -0.002427 -0.983971</pose>
230230
</model>
231231
</world>
232232
</sdf>

instruct_to_policy/launch/moveit_run_panda.launch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<arg name="enable_moveit_sensor_plugins" default="false" />
3232

3333
<!-- if enable_moveit_sensor_plugins set to true, set sensors_config_file -->
34-
<arg name="sensors_config_file" if="$(arg enable_moveit_sensor_plugins)" value="$(find panda_moveit_config)/config/sensors_triple_d435_pointcloud.yaml"/>
35-
<!-- <arg name="sensors_config_file" if="$(arg enable_moveit_sensor_plugins)" value="$(find panda_moveit_config)/config/sensors_triple_d435_depthmap.yaml"/> -->
34+
<!-- <arg name="sensors_config_file" if="$(arg enable_moveit_sensor_plugins)" value="$(find panda_moveit_config)/config/sensors_triple_d435_pointcloud.yaml"/> -->
35+
<arg name="sensors_config_file" if="$(arg enable_moveit_sensor_plugins)" value="$(find panda_moveit_config)/config/sensors_triple_d435_depthmap.yaml"/>
3636
<arg name="sensors_config_file" unless="$(arg enable_moveit_sensor_plugins)" value="$(find panda_moveit_config)/config/sensors_empty.yaml"/>
3737

3838
<!-- Use rviz config for MoveIt tutorial -->

instruct_to_policy/scripts/bash/run_code_gen.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@ function gen_code {
1515
}
1616

1717
config_files=(
18-
# "perception_few_shot_gpt_3.5.yaml"
18+
# "perception_few_shot_gpt_3.yaml"
1919
# "perception_few_shot_gpt_4.yaml"
2020
# "perception_few_shot_codellama.yaml"
2121
# "perception_few_shot_llama2_chat.yaml"
2222
# "perception_few_shot_gemini.yaml"
23+
# "text_few_shot_gpt_3.yaml"
24+
# "text_few_shot_gpt_4.yaml"
25+
# "text_few_shot_codellama.yaml"
26+
# "text_few_shot_llama2_chat.yaml"
27+
# "text_few_shot_gemini.yaml"
28+
"text_gpt_3.yaml"
29+
"text_gpt_4.yaml"
30+
"text_codellama.yaml"
31+
"text_llama2_chat.yaml"
32+
"text_gemini.yaml"
2333
)
2434

2535
task_query_files=(

instruct_to_policy/scripts/data/create_ycb_sdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
help="CoACD threshold (defaults to 0.02)")
2929

3030
args = parser.parse_args()
31-
args.use_coacd = True # ycb objects are poorly meshed, need to use coacd to get better physics simulation results
31+
args.use_coacd = False # ycb objects are poorly meshed, need to use coacd to get better physics simulation results
3232

3333
# Get the list of all downloaded mesh folders
3434
folder_names = os.listdir(args.model_folder)

0 commit comments

Comments
 (0)