Skip to content

Commit

Permalink
Script for getting heatmap and grasps
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaireLC committed Mar 28, 2024
1 parent 8955e50 commit 49f1f63
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions get_proposals_from_pcd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
PCD_PATH="$1"

AO_CONDA_ENV="ao-release"
CGN_CONDA_ENV="cgn"

CGN_ROOT_DIR="./contact_graspnet"

OUTPUT_DIR="./output"

# Get heatmap prediction
echo "Running run_pointscore_inference.py to get heatmap predictions..."
conda run -n $AO_CONDA_ENV python run_pointscore_inference.py --pcd_path $PCD_PATH --output_dir $OUTPUT_DIR

# Get heatmap path
filename=$(basename -- "$PCD_PATH")
extension="${filename##*.}"
data_name="${filename%.*}"
heatmap_path=$OUTPUT_DIR"/point_score/"$data_name".npz"

if [ ! -f $heatmap_path ]; then
echo "Heatmap file" $heatmap_path "not found! Heatmap inference may have failed. Exiting..."
exit 1
fi

echo "Getting grasp orientations..."

# Generate and save grasp proposals
conda run -n $CGN_CONDA_ENV python contact_graspnet/contact_graspnet/run_cgn_on_heatmap_file.py $heatmap_path --viz_top_k 10 --viz_save_as_mp4

proposal_path=$OUTPUT_DIR"/grasp_proposals/"$data_name".npz"
echo "Saved grasp proposals to "$proposal_path

0 comments on commit 49f1f63

Please sign in to comment.